From 4937ab9a3d67bdb756b8632dd934d4330e3b6f5a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:27:47 +0000 Subject: [PATCH 01/74] chore(internal): version bump From cedc29f79a787b41f0474355d38e2ef94c044123 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 14:03:52 +0000 Subject: [PATCH 02/74] feat(api): api update --- .github/workflows/create-releases.yml | 47 ----------------- .github/workflows/publish-sonatype.yml | 8 +-- .github/workflows/release-doctor.yml | 1 + LICENSE | 2 +- bin/check-release-environment | 4 ++ .../InferencePipelineRetrieveResponse.kt | 52 +++++++++++++++++++ .../models/InferencePipelineUpdateResponse.kt | 52 +++++++++++++++++++ .../ProjectInferencePipelineCreateParams.kt | 26 ++++++++++ .../ProjectInferencePipelineCreateResponse.kt | 52 +++++++++++++++++++ .../ProjectInferencePipelineListResponse.kt | 52 +++++++++++++++++++ 10 files changed, 242 insertions(+), 54 deletions(-) delete mode 100644 .github/workflows/create-releases.yml diff --git a/.github/workflows/create-releases.yml b/.github/workflows/create-releases.yml deleted file mode 100644 index 58107af0..00000000 --- a/.github/workflows/create-releases.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Create releases -on: - schedule: - - cron: '0 5 * * *' # every day at 5am UTC - push: - branches: - - main - -jobs: - release: - name: release - if: github.ref == 'refs/heads/main' && github.repository == 'openlayer-ai/openlayer-java' - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - uses: stainless-api/trigger-release-please@v1 - id: release - with: - repo: ${{ github.event.repository.full_name }} - stainless-api-key: ${{ secrets.STAINLESS_API_KEY }} - - - name: Set up Java - if: ${{ steps.release.outputs.releases_created }} - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: | - 8 - 17 - cache: gradle - - - name: Set up Gradle - if: ${{ steps.release.outputs.releases_created }} - uses: gradle/gradle-build-action@v2 - - - name: Publish to Sonatype - if: ${{ steps.release.outputs.releases_created }} - run: | - ./gradlew --parallel --no-daemon publish - env: - SONATYPE_USERNAME: ${{ secrets.OPENLAYER_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }} - SONATYPE_PASSWORD: ${{ secrets.OPENLAYER_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }} - GPG_SIGNING_KEY_ID: ${{ secrets.OPENLAYER_SONATYPE_GPG_SIGNING_KEY_ID || secrets.GPG_SIGNING_KEY_ID }} - GPG_SIGNING_KEY: ${{ secrets.OPENLAYER_SONATYPE_GPG_SIGNING_KEY || secrets.GPG_SIGNING_KEY }} - GPG_SIGNING_PASSWORD: ${{ secrets.OPENLAYER_SONATYPE_GPG_SIGNING_PASSWORD || secrets.GPG_SIGNING_PASSWORD }} diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index de1b147f..d852c899 100644 --- a/.github/workflows/publish-sonatype.yml +++ b/.github/workflows/publish-sonatype.yml @@ -1,13 +1,9 @@ -# This workflow is triggered when a GitHub release is created. -# It can also be run manually to re-publish to Sonatype in case it failed for some reason. -# You can run this workflow by navigating to https://www.github.com/openlayer-ai/openlayer-java/actions/workflows/publish-sonatype.yml +# workflow for re-running publishing to Sonatype in case it fails for some reason +# you can run this workflow by navigating to https://www.github.com/openlayer-ai/openlayer-java/actions/workflows/publish-sonatype.yml name: Publish Sonatype on: workflow_dispatch: - release: - types: [published] - jobs: publish: name: publish diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index b4ed7fd0..d2c76fa2 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -18,6 +18,7 @@ jobs: run: | bash ./bin/check-release-environment env: + STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }} SONATYPE_USERNAME: ${{ secrets.OPENLAYER_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.OPENLAYER_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }} GPG_SIGNING_KEY: ${{ secrets.OPENLAYER_SONATYPE_GPG_SIGNING_KEY || secrets.GPG_SIGNING_KEY }} diff --git a/LICENSE b/LICENSE index 82530825..ac864c56 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2024 Openlayer + Copyright 2025 Openlayer Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/bin/check-release-environment b/bin/check-release-environment index 14a9e4dc..c393cdbb 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,6 +2,10 @@ errors=() +if [ -z "${STAINLESS_API_KEY}" ]; then + errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organization secrets on GitHub.") +fi + if [ -z "${SONATYPE_USERNAME}" ]; then errors+=("The OPENLAYER_SONATYPE_USERNAME secret has not been set. Please set it in either this repository's secrets or your organization secrets") fi diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt index 3dd305e3..0022e99c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt @@ -1507,72 +1507,98 @@ private constructor( private var validated: Boolean = false + /** The workspace id. */ fun id(): String = id.getRequired("id") + /** The workspace name. */ fun name(): String = name.getRequired("name") + /** The workspace slug. */ fun slug(): String = slug.getRequired("slug") + /** The workspace creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + /** The workspace last updated date. */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** The workspace creator id. */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + /** The workspace invite code. */ fun inviteCode(): Optional = Optional.ofNullable(inviteCode.getNullable("inviteCode")) fun wildcardDomains(): Optional> = Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) + /** The number of projects in the workspace. */ fun projectCount(): Long = projectCount.getRequired("projectCount") + /** The number of members in the workspace. */ fun memberCount(): Long = memberCount.getRequired("memberCount") fun monthlyUsage(): Optional> = Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) + /** The number of invites in the workspace. */ fun inviteCount(): Long = inviteCount.getRequired("inviteCount") + /** The start date of the current billing period. */ fun periodStartDate(): Optional = Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) + /** The end date of the current billing period. */ fun periodEndDate(): Optional = Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) + /** Whether the workspace only allows SAML authentication. */ fun samlOnlyAccess(): Optional = Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) fun status(): Status = status.getRequired("status") + /** The workspace id. */ @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The workspace name. */ @JsonProperty("name") @ExcludeMissing fun _name() = name + /** The workspace slug. */ @JsonProperty("slug") @ExcludeMissing fun _slug() = slug + /** The workspace creation date. */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + /** The workspace last updated date. */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + /** The workspace creator id. */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + /** The workspace invite code. */ @JsonProperty("inviteCode") @ExcludeMissing fun _inviteCode() = inviteCode @JsonProperty("wildcardDomains") @ExcludeMissing fun _wildcardDomains() = wildcardDomains + /** The number of projects in the workspace. */ @JsonProperty("projectCount") @ExcludeMissing fun _projectCount() = projectCount + /** The number of members in the workspace. */ @JsonProperty("memberCount") @ExcludeMissing fun _memberCount() = memberCount @JsonProperty("monthlyUsage") @ExcludeMissing fun _monthlyUsage() = monthlyUsage + /** The number of invites in the workspace. */ @JsonProperty("inviteCount") @ExcludeMissing fun _inviteCount() = inviteCount + /** The start date of the current billing period. */ @JsonProperty("periodStartDate") @ExcludeMissing fun _periodStartDate() = periodStartDate + /** The end date of the current billing period. */ @JsonProperty("periodEndDate") @ExcludeMissing fun _periodEndDate() = periodEndDate + /** Whether the workspace only allows SAML authentication. */ @JsonProperty("samlOnlyAccess") @ExcludeMissing fun _samlOnlyAccess() = samlOnlyAccess @JsonProperty("status") @ExcludeMissing fun _status() = status @@ -1651,48 +1677,62 @@ private constructor( additionalProperties(workspace.additionalProperties) } + /** The workspace id. */ fun id(id: String) = id(JsonField.of(id)) + /** The workspace id. */ @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + /** The workspace name. */ fun name(name: String) = name(JsonField.of(name)) + /** The workspace name. */ @JsonProperty("name") @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } + /** The workspace slug. */ fun slug(slug: String) = slug(JsonField.of(slug)) + /** The workspace slug. */ @JsonProperty("slug") @ExcludeMissing fun slug(slug: JsonField) = apply { this.slug = slug } + /** The workspace creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + /** The workspace creation date. */ @JsonProperty("dateCreated") @ExcludeMissing fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } + /** The workspace last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + /** The workspace last updated date. */ @JsonProperty("dateUpdated") @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } + /** The workspace creator id. */ fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) + /** The workspace creator id. */ @JsonProperty("creatorId") @ExcludeMissing fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + /** The workspace invite code. */ fun inviteCode(inviteCode: String) = inviteCode(JsonField.of(inviteCode)) + /** The workspace invite code. */ @JsonProperty("inviteCode") @ExcludeMissing fun inviteCode(inviteCode: JsonField) = apply { this.inviteCode = inviteCode } @@ -1706,16 +1746,20 @@ private constructor( this.wildcardDomains = wildcardDomains } + /** The number of projects in the workspace. */ fun projectCount(projectCount: Long) = projectCount(JsonField.of(projectCount)) + /** The number of projects in the workspace. */ @JsonProperty("projectCount") @ExcludeMissing fun projectCount(projectCount: JsonField) = apply { this.projectCount = projectCount } + /** The number of members in the workspace. */ fun memberCount(memberCount: Long) = memberCount(JsonField.of(memberCount)) + /** The number of members in the workspace. */ @JsonProperty("memberCount") @ExcludeMissing fun memberCount(memberCount: JsonField) = apply { this.memberCount = memberCount } @@ -1729,33 +1773,41 @@ private constructor( this.monthlyUsage = monthlyUsage } + /** The number of invites in the workspace. */ fun inviteCount(inviteCount: Long) = inviteCount(JsonField.of(inviteCount)) + /** The number of invites in the workspace. */ @JsonProperty("inviteCount") @ExcludeMissing fun inviteCount(inviteCount: JsonField) = apply { this.inviteCount = inviteCount } + /** The start date of the current billing period. */ fun periodStartDate(periodStartDate: OffsetDateTime) = periodStartDate(JsonField.of(periodStartDate)) + /** The start date of the current billing period. */ @JsonProperty("periodStartDate") @ExcludeMissing fun periodStartDate(periodStartDate: JsonField) = apply { this.periodStartDate = periodStartDate } + /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: OffsetDateTime) = periodEndDate(JsonField.of(periodEndDate)) + /** The end date of the current billing period. */ @JsonProperty("periodEndDate") @ExcludeMissing fun periodEndDate(periodEndDate: JsonField) = apply { this.periodEndDate = periodEndDate } + /** Whether the workspace only allows SAML authentication. */ fun samlOnlyAccess(samlOnlyAccess: Boolean) = samlOnlyAccess(JsonField.of(samlOnlyAccess)) + /** Whether the workspace only allows SAML authentication. */ @JsonProperty("samlOnlyAccess") @ExcludeMissing fun samlOnlyAccess(samlOnlyAccess: JsonField) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt index b570b222..f41bc623 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt @@ -1506,72 +1506,98 @@ private constructor( private var validated: Boolean = false + /** The workspace id. */ fun id(): String = id.getRequired("id") + /** The workspace name. */ fun name(): String = name.getRequired("name") + /** The workspace slug. */ fun slug(): String = slug.getRequired("slug") + /** The workspace creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + /** The workspace last updated date. */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** The workspace creator id. */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + /** The workspace invite code. */ fun inviteCode(): Optional = Optional.ofNullable(inviteCode.getNullable("inviteCode")) fun wildcardDomains(): Optional> = Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) + /** The number of projects in the workspace. */ fun projectCount(): Long = projectCount.getRequired("projectCount") + /** The number of members in the workspace. */ fun memberCount(): Long = memberCount.getRequired("memberCount") fun monthlyUsage(): Optional> = Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) + /** The number of invites in the workspace. */ fun inviteCount(): Long = inviteCount.getRequired("inviteCount") + /** The start date of the current billing period. */ fun periodStartDate(): Optional = Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) + /** The end date of the current billing period. */ fun periodEndDate(): Optional = Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) + /** Whether the workspace only allows SAML authentication. */ fun samlOnlyAccess(): Optional = Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) fun status(): Status = status.getRequired("status") + /** The workspace id. */ @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The workspace name. */ @JsonProperty("name") @ExcludeMissing fun _name() = name + /** The workspace slug. */ @JsonProperty("slug") @ExcludeMissing fun _slug() = slug + /** The workspace creation date. */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + /** The workspace last updated date. */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + /** The workspace creator id. */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + /** The workspace invite code. */ @JsonProperty("inviteCode") @ExcludeMissing fun _inviteCode() = inviteCode @JsonProperty("wildcardDomains") @ExcludeMissing fun _wildcardDomains() = wildcardDomains + /** The number of projects in the workspace. */ @JsonProperty("projectCount") @ExcludeMissing fun _projectCount() = projectCount + /** The number of members in the workspace. */ @JsonProperty("memberCount") @ExcludeMissing fun _memberCount() = memberCount @JsonProperty("monthlyUsage") @ExcludeMissing fun _monthlyUsage() = monthlyUsage + /** The number of invites in the workspace. */ @JsonProperty("inviteCount") @ExcludeMissing fun _inviteCount() = inviteCount + /** The start date of the current billing period. */ @JsonProperty("periodStartDate") @ExcludeMissing fun _periodStartDate() = periodStartDate + /** The end date of the current billing period. */ @JsonProperty("periodEndDate") @ExcludeMissing fun _periodEndDate() = periodEndDate + /** Whether the workspace only allows SAML authentication. */ @JsonProperty("samlOnlyAccess") @ExcludeMissing fun _samlOnlyAccess() = samlOnlyAccess @JsonProperty("status") @ExcludeMissing fun _status() = status @@ -1650,48 +1676,62 @@ private constructor( additionalProperties(workspace.additionalProperties) } + /** The workspace id. */ fun id(id: String) = id(JsonField.of(id)) + /** The workspace id. */ @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + /** The workspace name. */ fun name(name: String) = name(JsonField.of(name)) + /** The workspace name. */ @JsonProperty("name") @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } + /** The workspace slug. */ fun slug(slug: String) = slug(JsonField.of(slug)) + /** The workspace slug. */ @JsonProperty("slug") @ExcludeMissing fun slug(slug: JsonField) = apply { this.slug = slug } + /** The workspace creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + /** The workspace creation date. */ @JsonProperty("dateCreated") @ExcludeMissing fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } + /** The workspace last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + /** The workspace last updated date. */ @JsonProperty("dateUpdated") @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } + /** The workspace creator id. */ fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) + /** The workspace creator id. */ @JsonProperty("creatorId") @ExcludeMissing fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + /** The workspace invite code. */ fun inviteCode(inviteCode: String) = inviteCode(JsonField.of(inviteCode)) + /** The workspace invite code. */ @JsonProperty("inviteCode") @ExcludeMissing fun inviteCode(inviteCode: JsonField) = apply { this.inviteCode = inviteCode } @@ -1705,16 +1745,20 @@ private constructor( this.wildcardDomains = wildcardDomains } + /** The number of projects in the workspace. */ fun projectCount(projectCount: Long) = projectCount(JsonField.of(projectCount)) + /** The number of projects in the workspace. */ @JsonProperty("projectCount") @ExcludeMissing fun projectCount(projectCount: JsonField) = apply { this.projectCount = projectCount } + /** The number of members in the workspace. */ fun memberCount(memberCount: Long) = memberCount(JsonField.of(memberCount)) + /** The number of members in the workspace. */ @JsonProperty("memberCount") @ExcludeMissing fun memberCount(memberCount: JsonField) = apply { this.memberCount = memberCount } @@ -1728,33 +1772,41 @@ private constructor( this.monthlyUsage = monthlyUsage } + /** The number of invites in the workspace. */ fun inviteCount(inviteCount: Long) = inviteCount(JsonField.of(inviteCount)) + /** The number of invites in the workspace. */ @JsonProperty("inviteCount") @ExcludeMissing fun inviteCount(inviteCount: JsonField) = apply { this.inviteCount = inviteCount } + /** The start date of the current billing period. */ fun periodStartDate(periodStartDate: OffsetDateTime) = periodStartDate(JsonField.of(periodStartDate)) + /** The start date of the current billing period. */ @JsonProperty("periodStartDate") @ExcludeMissing fun periodStartDate(periodStartDate: JsonField) = apply { this.periodStartDate = periodStartDate } + /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: OffsetDateTime) = periodEndDate(JsonField.of(periodEndDate)) + /** The end date of the current billing period. */ @JsonProperty("periodEndDate") @ExcludeMissing fun periodEndDate(periodEndDate: JsonField) = apply { this.periodEndDate = periodEndDate } + /** Whether the workspace only allows SAML authentication. */ fun samlOnlyAccess(samlOnlyAccess: Boolean) = samlOnlyAccess(JsonField.of(samlOnlyAccess)) + /** Whether the workspace only allows SAML authentication. */ @JsonProperty("samlOnlyAccess") @ExcludeMissing fun samlOnlyAccess(samlOnlyAccess: JsonField) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt index 39cf115e..68e52c0f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt @@ -1162,34 +1162,47 @@ constructor( private val additionalProperties: Map, ) { + /** The workspace id. */ @JsonProperty("id") fun id(): String? = id + /** The workspace name. */ @JsonProperty("name") fun name(): String? = name + /** The workspace slug. */ @JsonProperty("slug") fun slug(): String? = slug + /** The workspace creation date. */ @JsonProperty("dateCreated") fun dateCreated(): OffsetDateTime? = dateCreated + /** The workspace last updated date. */ @JsonProperty("dateUpdated") fun dateUpdated(): OffsetDateTime? = dateUpdated + /** The workspace creator id. */ @JsonProperty("creatorId") fun creatorId(): String? = creatorId + /** The workspace invite code. */ @JsonProperty("inviteCode") fun inviteCode(): String? = inviteCode @JsonProperty("wildcardDomains") fun wildcardDomains(): List? = wildcardDomains + /** The number of projects in the workspace. */ @JsonProperty("projectCount") fun projectCount(): Long? = projectCount + /** The number of members in the workspace. */ @JsonProperty("memberCount") fun memberCount(): Long? = memberCount @JsonProperty("monthlyUsage") fun monthlyUsage(): List? = monthlyUsage + /** The number of invites in the workspace. */ @JsonProperty("inviteCount") fun inviteCount(): Long? = inviteCount + /** The start date of the current billing period. */ @JsonProperty("periodStartDate") fun periodStartDate(): OffsetDateTime? = periodStartDate + /** The end date of the current billing period. */ @JsonProperty("periodEndDate") fun periodEndDate(): OffsetDateTime? = periodEndDate + /** Whether the workspace only allows SAML authentication. */ @JsonProperty("samlOnlyAccess") fun samlOnlyAccess(): Boolean? = samlOnlyAccess @JsonProperty("status") fun status(): Status? = status @@ -1246,21 +1259,28 @@ constructor( additionalProperties(workspace.additionalProperties) } + /** The workspace id. */ @JsonProperty("id") fun id(id: String) = apply { this.id = id } + /** The workspace name. */ @JsonProperty("name") fun name(name: String) = apply { this.name = name } + /** The workspace slug. */ @JsonProperty("slug") fun slug(slug: String) = apply { this.slug = slug } + /** The workspace creation date. */ @JsonProperty("dateCreated") fun dateCreated(dateCreated: OffsetDateTime) = apply { this.dateCreated = dateCreated } + /** The workspace last updated date. */ @JsonProperty("dateUpdated") fun dateUpdated(dateUpdated: OffsetDateTime) = apply { this.dateUpdated = dateUpdated } + /** The workspace creator id. */ @JsonProperty("creatorId") fun creatorId(creatorId: String) = apply { this.creatorId = creatorId } + /** The workspace invite code. */ @JsonProperty("inviteCode") fun inviteCode(inviteCode: String) = apply { this.inviteCode = inviteCode } @@ -1269,9 +1289,11 @@ constructor( this.wildcardDomains = wildcardDomains } + /** The number of projects in the workspace. */ @JsonProperty("projectCount") fun projectCount(projectCount: Long) = apply { this.projectCount = projectCount } + /** The number of members in the workspace. */ @JsonProperty("memberCount") fun memberCount(memberCount: Long) = apply { this.memberCount = memberCount } @@ -1280,19 +1302,23 @@ constructor( this.monthlyUsage = monthlyUsage } + /** The number of invites in the workspace. */ @JsonProperty("inviteCount") fun inviteCount(inviteCount: Long) = apply { this.inviteCount = inviteCount } + /** The start date of the current billing period. */ @JsonProperty("periodStartDate") fun periodStartDate(periodStartDate: OffsetDateTime) = apply { this.periodStartDate = periodStartDate } + /** The end date of the current billing period. */ @JsonProperty("periodEndDate") fun periodEndDate(periodEndDate: OffsetDateTime) = apply { this.periodEndDate = periodEndDate } + /** Whether the workspace only allows SAML authentication. */ @JsonProperty("samlOnlyAccess") fun samlOnlyAccess(samlOnlyAccess: Boolean) = apply { this.samlOnlyAccess = samlOnlyAccess diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt index 44828f13..963a65e3 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt @@ -1508,72 +1508,98 @@ private constructor( private var validated: Boolean = false + /** The workspace id. */ fun id(): String = id.getRequired("id") + /** The workspace name. */ fun name(): String = name.getRequired("name") + /** The workspace slug. */ fun slug(): String = slug.getRequired("slug") + /** The workspace creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + /** The workspace last updated date. */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** The workspace creator id. */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + /** The workspace invite code. */ fun inviteCode(): Optional = Optional.ofNullable(inviteCode.getNullable("inviteCode")) fun wildcardDomains(): Optional> = Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) + /** The number of projects in the workspace. */ fun projectCount(): Long = projectCount.getRequired("projectCount") + /** The number of members in the workspace. */ fun memberCount(): Long = memberCount.getRequired("memberCount") fun monthlyUsage(): Optional> = Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) + /** The number of invites in the workspace. */ fun inviteCount(): Long = inviteCount.getRequired("inviteCount") + /** The start date of the current billing period. */ fun periodStartDate(): Optional = Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) + /** The end date of the current billing period. */ fun periodEndDate(): Optional = Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) + /** Whether the workspace only allows SAML authentication. */ fun samlOnlyAccess(): Optional = Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) fun status(): Status = status.getRequired("status") + /** The workspace id. */ @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The workspace name. */ @JsonProperty("name") @ExcludeMissing fun _name() = name + /** The workspace slug. */ @JsonProperty("slug") @ExcludeMissing fun _slug() = slug + /** The workspace creation date. */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + /** The workspace last updated date. */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + /** The workspace creator id. */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + /** The workspace invite code. */ @JsonProperty("inviteCode") @ExcludeMissing fun _inviteCode() = inviteCode @JsonProperty("wildcardDomains") @ExcludeMissing fun _wildcardDomains() = wildcardDomains + /** The number of projects in the workspace. */ @JsonProperty("projectCount") @ExcludeMissing fun _projectCount() = projectCount + /** The number of members in the workspace. */ @JsonProperty("memberCount") @ExcludeMissing fun _memberCount() = memberCount @JsonProperty("monthlyUsage") @ExcludeMissing fun _monthlyUsage() = monthlyUsage + /** The number of invites in the workspace. */ @JsonProperty("inviteCount") @ExcludeMissing fun _inviteCount() = inviteCount + /** The start date of the current billing period. */ @JsonProperty("periodStartDate") @ExcludeMissing fun _periodStartDate() = periodStartDate + /** The end date of the current billing period. */ @JsonProperty("periodEndDate") @ExcludeMissing fun _periodEndDate() = periodEndDate + /** Whether the workspace only allows SAML authentication. */ @JsonProperty("samlOnlyAccess") @ExcludeMissing fun _samlOnlyAccess() = samlOnlyAccess @JsonProperty("status") @ExcludeMissing fun _status() = status @@ -1652,48 +1678,62 @@ private constructor( additionalProperties(workspace.additionalProperties) } + /** The workspace id. */ fun id(id: String) = id(JsonField.of(id)) + /** The workspace id. */ @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + /** The workspace name. */ fun name(name: String) = name(JsonField.of(name)) + /** The workspace name. */ @JsonProperty("name") @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } + /** The workspace slug. */ fun slug(slug: String) = slug(JsonField.of(slug)) + /** The workspace slug. */ @JsonProperty("slug") @ExcludeMissing fun slug(slug: JsonField) = apply { this.slug = slug } + /** The workspace creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + /** The workspace creation date. */ @JsonProperty("dateCreated") @ExcludeMissing fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } + /** The workspace last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + /** The workspace last updated date. */ @JsonProperty("dateUpdated") @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } + /** The workspace creator id. */ fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) + /** The workspace creator id. */ @JsonProperty("creatorId") @ExcludeMissing fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + /** The workspace invite code. */ fun inviteCode(inviteCode: String) = inviteCode(JsonField.of(inviteCode)) + /** The workspace invite code. */ @JsonProperty("inviteCode") @ExcludeMissing fun inviteCode(inviteCode: JsonField) = apply { this.inviteCode = inviteCode } @@ -1707,16 +1747,20 @@ private constructor( this.wildcardDomains = wildcardDomains } + /** The number of projects in the workspace. */ fun projectCount(projectCount: Long) = projectCount(JsonField.of(projectCount)) + /** The number of projects in the workspace. */ @JsonProperty("projectCount") @ExcludeMissing fun projectCount(projectCount: JsonField) = apply { this.projectCount = projectCount } + /** The number of members in the workspace. */ fun memberCount(memberCount: Long) = memberCount(JsonField.of(memberCount)) + /** The number of members in the workspace. */ @JsonProperty("memberCount") @ExcludeMissing fun memberCount(memberCount: JsonField) = apply { this.memberCount = memberCount } @@ -1730,33 +1774,41 @@ private constructor( this.monthlyUsage = monthlyUsage } + /** The number of invites in the workspace. */ fun inviteCount(inviteCount: Long) = inviteCount(JsonField.of(inviteCount)) + /** The number of invites in the workspace. */ @JsonProperty("inviteCount") @ExcludeMissing fun inviteCount(inviteCount: JsonField) = apply { this.inviteCount = inviteCount } + /** The start date of the current billing period. */ fun periodStartDate(periodStartDate: OffsetDateTime) = periodStartDate(JsonField.of(periodStartDate)) + /** The start date of the current billing period. */ @JsonProperty("periodStartDate") @ExcludeMissing fun periodStartDate(periodStartDate: JsonField) = apply { this.periodStartDate = periodStartDate } + /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: OffsetDateTime) = periodEndDate(JsonField.of(periodEndDate)) + /** The end date of the current billing period. */ @JsonProperty("periodEndDate") @ExcludeMissing fun periodEndDate(periodEndDate: JsonField) = apply { this.periodEndDate = periodEndDate } + /** Whether the workspace only allows SAML authentication. */ fun samlOnlyAccess(samlOnlyAccess: Boolean) = samlOnlyAccess(JsonField.of(samlOnlyAccess)) + /** Whether the workspace only allows SAML authentication. */ @JsonProperty("samlOnlyAccess") @ExcludeMissing fun samlOnlyAccess(samlOnlyAccess: JsonField) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt index 5ee1acf6..899a007d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt @@ -1597,77 +1597,103 @@ private constructor( private var validated: Boolean = false + /** The workspace id. */ fun id(): String = id.getRequired("id") + /** The workspace name. */ fun name(): String = name.getRequired("name") + /** The workspace slug. */ fun slug(): String = slug.getRequired("slug") + /** The workspace creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + /** The workspace last updated date. */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** The workspace creator id. */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + /** The workspace invite code. */ fun inviteCode(): Optional = Optional.ofNullable(inviteCode.getNullable("inviteCode")) fun wildcardDomains(): Optional> = Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) + /** The number of projects in the workspace. */ fun projectCount(): Long = projectCount.getRequired("projectCount") + /** The number of members in the workspace. */ fun memberCount(): Long = memberCount.getRequired("memberCount") fun monthlyUsage(): Optional> = Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) + /** The number of invites in the workspace. */ fun inviteCount(): Long = inviteCount.getRequired("inviteCount") + /** The start date of the current billing period. */ fun periodStartDate(): Optional = Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) + /** The end date of the current billing period. */ fun periodEndDate(): Optional = Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) + /** Whether the workspace only allows SAML authentication. */ fun samlOnlyAccess(): Optional = Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) fun status(): Status = status.getRequired("status") + /** The workspace id. */ @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The workspace name. */ @JsonProperty("name") @ExcludeMissing fun _name() = name + /** The workspace slug. */ @JsonProperty("slug") @ExcludeMissing fun _slug() = slug + /** The workspace creation date. */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + /** The workspace last updated date. */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + /** The workspace creator id. */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + /** The workspace invite code. */ @JsonProperty("inviteCode") @ExcludeMissing fun _inviteCode() = inviteCode @JsonProperty("wildcardDomains") @ExcludeMissing fun _wildcardDomains() = wildcardDomains + /** The number of projects in the workspace. */ @JsonProperty("projectCount") @ExcludeMissing fun _projectCount() = projectCount + /** The number of members in the workspace. */ @JsonProperty("memberCount") @ExcludeMissing fun _memberCount() = memberCount @JsonProperty("monthlyUsage") @ExcludeMissing fun _monthlyUsage() = monthlyUsage + /** The number of invites in the workspace. */ @JsonProperty("inviteCount") @ExcludeMissing fun _inviteCount() = inviteCount + /** The start date of the current billing period. */ @JsonProperty("periodStartDate") @ExcludeMissing fun _periodStartDate() = periodStartDate + /** The end date of the current billing period. */ @JsonProperty("periodEndDate") @ExcludeMissing fun _periodEndDate() = periodEndDate + /** Whether the workspace only allows SAML authentication. */ @JsonProperty("samlOnlyAccess") @ExcludeMissing fun _samlOnlyAccess() = samlOnlyAccess @JsonProperty("status") @ExcludeMissing fun _status() = status @@ -1746,50 +1772,64 @@ private constructor( additionalProperties(workspace.additionalProperties) } + /** The workspace id. */ fun id(id: String) = id(JsonField.of(id)) + /** The workspace id. */ @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + /** The workspace name. */ fun name(name: String) = name(JsonField.of(name)) + /** The workspace name. */ @JsonProperty("name") @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } + /** The workspace slug. */ fun slug(slug: String) = slug(JsonField.of(slug)) + /** The workspace slug. */ @JsonProperty("slug") @ExcludeMissing fun slug(slug: JsonField) = apply { this.slug = slug } + /** The workspace creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + /** The workspace creation date. */ @JsonProperty("dateCreated") @ExcludeMissing fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } + /** The workspace last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + /** The workspace last updated date. */ @JsonProperty("dateUpdated") @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } + /** The workspace creator id. */ fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) + /** The workspace creator id. */ @JsonProperty("creatorId") @ExcludeMissing fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + /** The workspace invite code. */ fun inviteCode(inviteCode: String) = inviteCode(JsonField.of(inviteCode)) + /** The workspace invite code. */ @JsonProperty("inviteCode") @ExcludeMissing fun inviteCode(inviteCode: JsonField) = apply { @@ -1805,16 +1845,20 @@ private constructor( this.wildcardDomains = wildcardDomains } + /** The number of projects in the workspace. */ fun projectCount(projectCount: Long) = projectCount(JsonField.of(projectCount)) + /** The number of projects in the workspace. */ @JsonProperty("projectCount") @ExcludeMissing fun projectCount(projectCount: JsonField) = apply { this.projectCount = projectCount } + /** The number of members in the workspace. */ fun memberCount(memberCount: Long) = memberCount(JsonField.of(memberCount)) + /** The number of members in the workspace. */ @JsonProperty("memberCount") @ExcludeMissing fun memberCount(memberCount: JsonField) = apply { @@ -1830,35 +1874,43 @@ private constructor( this.monthlyUsage = monthlyUsage } + /** The number of invites in the workspace. */ fun inviteCount(inviteCount: Long) = inviteCount(JsonField.of(inviteCount)) + /** The number of invites in the workspace. */ @JsonProperty("inviteCount") @ExcludeMissing fun inviteCount(inviteCount: JsonField) = apply { this.inviteCount = inviteCount } + /** The start date of the current billing period. */ fun periodStartDate(periodStartDate: OffsetDateTime) = periodStartDate(JsonField.of(periodStartDate)) + /** The start date of the current billing period. */ @JsonProperty("periodStartDate") @ExcludeMissing fun periodStartDate(periodStartDate: JsonField) = apply { this.periodStartDate = periodStartDate } + /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: OffsetDateTime) = periodEndDate(JsonField.of(periodEndDate)) + /** The end date of the current billing period. */ @JsonProperty("periodEndDate") @ExcludeMissing fun periodEndDate(periodEndDate: JsonField) = apply { this.periodEndDate = periodEndDate } + /** Whether the workspace only allows SAML authentication. */ fun samlOnlyAccess(samlOnlyAccess: Boolean) = samlOnlyAccess(JsonField.of(samlOnlyAccess)) + /** Whether the workspace only allows SAML authentication. */ @JsonProperty("samlOnlyAccess") @ExcludeMissing fun samlOnlyAccess(samlOnlyAccess: JsonField) = apply { From ca0467688568fe952dc57739c6306209f68761f8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 24 Jan 2025 15:43:00 +0000 Subject: [PATCH 03/74] chore(internal): codegen related update --- README.md | 45 +- build.gradle.kts | 6 - buildSrc/build.gradle.kts | 2 +- .../src/main/kotlin/openlayer.java.gradle.kts | 4 - .../main/kotlin/openlayer.kotlin.gradle.kts | 9 +- .../main/kotlin/openlayer.publish.gradle.kts | 9 +- gradle/wrapper/gradle-wrapper.jar | Bin 43453 -> 43583 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 6 +- gradlew.bat | 2 + .../client/okhttp/OpenlayerOkHttpClient.kt | 3 + .../okhttp/OpenlayerOkHttpClientAsync.kt | 3 + .../kotlin/com/openlayer/api/core/Check.kt | 30 + .../com/openlayer/api/core/ClientOptions.kt | 25 +- .../kotlin/com/openlayer/api/core/Utils.kt | 4 +- .../kotlin/com/openlayer/api/core/Values.kt | 2 + .../openlayer/api/errors/OpenlayerError.kt | 11 +- .../api/models/CommitTestResultListParams.kt | 67 +- .../models/CommitTestResultListResponse.kt | 1337 +++++----- .../InferencePipelineDataStreamParams.kt | 1288 ++++++---- .../InferencePipelineDataStreamResponse.kt | 50 +- .../models/InferencePipelineDeleteParams.kt | 11 +- .../models/InferencePipelineRetrieveParams.kt | 25 +- .../InferencePipelineRetrieveResponse.kt | 2023 ++++++++------- .../InferencePipelineRowUpdateParams.kt | 374 ++- .../InferencePipelineRowUpdateResponse.kt | 50 +- .../InferencePipelineTestResultListParams.kt | 58 +- ...InferencePipelineTestResultListResponse.kt | 1338 +++++----- .../models/InferencePipelineUpdateParams.kt | 262 +- .../models/InferencePipelineUpdateResponse.kt | 2022 ++++++++------- .../api/models/ProjectCommitCreateParams.kt | 676 +++-- .../api/models/ProjectCommitCreateResponse.kt | 923 +++---- .../api/models/ProjectCommitListParams.kt | 24 +- .../api/models/ProjectCommitListResponse.kt | 1003 ++++---- .../api/models/ProjectCreateParams.kt | 549 +++-- .../api/models/ProjectCreateResponse.kt | 789 +++--- .../ProjectInferencePipelineCreateParams.kt | 1706 +++++++++---- .../ProjectInferencePipelineCreateResponse.kt | 2023 ++++++++------- .../ProjectInferencePipelineListParams.kt | 30 +- .../ProjectInferencePipelineListResponse.kt | 2175 +++++++++-------- .../openlayer/api/models/ProjectListParams.kt | 34 +- .../api/models/ProjectListResponse.kt | 877 ++++--- .../models/StoragePresignedUrlCreateParams.kt | 10 +- .../StoragePresignedUrlCreateResponse.kt | 94 +- .../services/async/CommitServiceAsyncImpl.kt | 2 +- .../InferencePipelineServiceAsyncImpl.kt | 2 +- .../services/async/ProjectServiceAsyncImpl.kt | 2 +- .../services/async/StorageServiceAsyncImpl.kt | 2 +- .../commits/TestResultServiceAsyncImpl.kt | 2 +- .../DataServiceAsyncImpl.kt | 2 +- .../inferencePipelines/RowServiceAsyncImpl.kt | 2 +- .../TestResultServiceAsyncImpl.kt | 2 +- .../async/projects/CommitServiceAsyncImpl.kt | 2 +- .../InferencePipelineServiceAsyncImpl.kt | 2 +- .../storage/PresignedUrlServiceAsyncImpl.kt | 2 +- .../services/blocking/CommitServiceImpl.kt | 2 +- .../blocking/InferencePipelineServiceImpl.kt | 2 +- .../services/blocking/ProjectServiceImpl.kt | 2 +- .../services/blocking/StorageServiceImpl.kt | 2 +- .../blocking/commits/TestResultServiceImpl.kt | 2 +- .../inferencePipelines/DataServiceImpl.kt | 2 +- .../inferencePipelines/RowServiceImpl.kt | 2 +- .../TestResultServiceImpl.kt | 2 +- .../blocking/projects/CommitServiceImpl.kt | 2 +- .../projects/InferencePipelineServiceImpl.kt | 2 +- .../storage/PresignedUrlServiceImpl.kt | 2 +- .../CommitTestResultListResponseTest.kt | 134 +- .../InferencePipelineDataStreamParamsTest.kt | 169 +- .../InferencePipelineRetrieveParamsTest.kt | 4 +- .../InferencePipelineRetrieveResponseTest.kt | 34 +- .../InferencePipelineRowUpdateParamsTest.kt | 6 +- ...rencePipelineTestResultListResponseTest.kt | 142 +- .../InferencePipelineUpdateParamsTest.kt | 6 +- .../InferencePipelineUpdateResponseTest.kt | 34 +- .../models/ProjectCommitCreateParamsTest.kt | 71 +- .../models/ProjectCommitCreateResponseTest.kt | 2 - .../models/ProjectCommitListResponseTest.kt | 84 +- .../api/models/ProjectCreateParamsTest.kt | 2 +- ...rojectInferencePipelineCreateParamsTest.kt | 177 +- ...jectInferencePipelineCreateResponseTest.kt | 35 +- ...rojectInferencePipelineListResponseTest.kt | 239 +- .../api/models/ProjectListResponseTest.kt | 82 +- .../api/services/ErrorHandlingTest.kt | 671 +++-- .../api/services/ServiceParamsTest.kt | 61 +- .../blocking/InferencePipelineServiceTest.kt | 2 +- .../inferencePipelines/DataServiceTest.kt | 61 +- .../blocking/projects/CommitServiceTest.kt | 12 - .../projects/InferencePipelineServiceTest.kt | 58 +- 88 files changed, 12518 insertions(+), 9593 deletions(-) create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt diff --git a/README.md b/README.md index ed0596e7..f4351177 100644 --- a/README.md +++ b/README.md @@ -6,31 +6,23 @@ -The Openlayer Java SDK provides convenient access to the Openlayer REST API from applications written in Java. It includes helper classes with helpful types and documentation for every request and response property. - -The Openlayer Java SDK is similar to the Openlayer Kotlin SDK but with minor differences that make it more ergonomic for use in Java, such as `Optional` instead of nullable values, `Stream` instead of `Sequence`, and `CompletableFuture` instead of suspend functions. +The Openlayer Java SDK provides convenient access to the Openlayer REST API from applications written in Java. It is generated with [Stainless](https://www.stainlessapi.com/). -## Documentation - -The REST API documentation can be found on [openlayer.com](https://openlayer.com/docs/api-reference/rest/overview). - ---- - -## Getting started +The REST API documentation can be found on [openlayer.com](https://openlayer.com/docs/api-reference/rest/overview). -### Install dependencies - -#### Gradle +## Installation +### Gradle + ```kotlin implementation("com.openlayer.api:openlayer-java:0.1.0-alpha.11") ``` -#### Maven +### Maven ```xml @@ -42,6 +34,12 @@ implementation("com.openlayer.api:openlayer-java:0.1.0-alpha.11") +## Requirements + +This library requires Java 8 or later. + +## Usage + ### Configure the client Use `OpenlayerOkHttpClient.builder()` to configure the client. @@ -77,24 +75,23 @@ To create a new inference pipeline data, first use the `InferencePipelineDataStr import com.openlayer.api.core.JsonValue; import com.openlayer.api.models.InferencePipelineDataStreamParams; import com.openlayer.api.models.InferencePipelineDataStreamResponse; -import java.util.List; InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config(InferencePipelineDataStreamParams.Config.ofLlmData(InferencePipelineDataStreamParams.Config.LlmData.builder() - .inputVariableNames(List.of("user_query")) + .config(InferencePipelineDataStreamParams.Config.LlmData.builder() + .addInputVariableName("user_query") .outputColumnName("output") .numOfTokenColumnName("tokens") .costColumnName("cost") .timestampColumnName("timestamp") - .build())) - .rows(List.of(InferencePipelineDataStreamParams.Row.builder() + .build()) + .addRow(InferencePipelineDataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("what is the meaning of life?")) .putAdditionalProperty("output", JsonValue.from("42")) .putAdditionalProperty("tokens", JsonValue.from(7)) .putAdditionalProperty("cost", JsonValue.from(0.02)) .putAdditionalProperty("timestamp", JsonValue.from(1610000000)) - .build())) + .build()) .build(); InferencePipelineDataStreamResponse response = client.inferencePipelines().data().stream(params); ``` @@ -249,7 +246,7 @@ This library is typed for convenient access to the documented API. If you need t To make requests using undocumented parameters, you can provide or override parameters on the params object while building it. -```kotlin +```java FooCreateParams address = FooCreateParams.builder() .id("my_id") .putAdditionalProperty("secret_prop", JsonValue.from("hello")) @@ -280,13 +277,9 @@ $ export OPENLAYER_LOG=debug This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions: -1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_. +1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_ 2. Changes that we do not expect to impact the vast majority of users in practice. We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience. We are keen for your feedback; please open an [issue](https://www.github.com/openlayer-ai/openlayer-java/issues) with questions, bugs, or suggestions. - -## Requirements - -This library requires Java 8 or later. diff --git a/build.gradle.kts b/build.gradle.kts index 6466dce7..9e6b6623 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,10 +1,4 @@ -plugins { - -} - allprojects { group = "com.openlayer.api" version = "0.1.0-alpha.11" // x-release-please-version } - - diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 493cb327..8a1d7a10 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,6 +1,6 @@ plugins { `kotlin-dsl` - kotlin("jvm") version "1.9.22" + kotlin("jvm") version "2.1.0" id("com.vanniktech.maven.publish") version "0.28.0" } diff --git a/buildSrc/src/main/kotlin/openlayer.java.gradle.kts b/buildSrc/src/main/kotlin/openlayer.java.gradle.kts index 32a150ed..a2c35b93 100644 --- a/buildSrc/src/main/kotlin/openlayer.java.gradle.kts +++ b/buildSrc/src/main/kotlin/openlayer.java.gradle.kts @@ -1,9 +1,5 @@ import com.diffplug.gradle.spotless.SpotlessExtension import org.gradle.api.tasks.testing.logging.TestExceptionFormat -import com.vanniktech.maven.publish.JavaLibrary -import com.vanniktech.maven.publish.JavadocJar -import com.vanniktech.maven.publish.MavenPublishBaseExtension -import com.vanniktech.maven.publish.SonatypeHost plugins { `java-library` diff --git a/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts b/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts index b0bd08ab..bc361253 100644 --- a/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts @@ -1,6 +1,5 @@ import com.diffplug.gradle.spotless.SpotlessExtension import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import com.vanniktech.maven.publish.* plugins { id("openlayer.java") @@ -22,8 +21,12 @@ configure { tasks.withType().configureEach { kotlinOptions { - allWarningsAsErrors = true - freeCompilerArgs = listOf("-Xjvm-default=all", "-Xjdk-release=1.8") + freeCompilerArgs = listOf( + "-Xjvm-default=all", + "-Xjdk-release=1.8", + // Suppress deprecation warnings because we may still reference and test deprecated members. + "-Xsuppress-warning=DEPRECATION" + ) jvmTarget = "1.8" } } diff --git a/buildSrc/src/main/kotlin/openlayer.publish.gradle.kts b/buildSrc/src/main/kotlin/openlayer.publish.gradle.kts index d159a4fa..51f10524 100644 --- a/buildSrc/src/main/kotlin/openlayer.publish.gradle.kts +++ b/buildSrc/src/main/kotlin/openlayer.publish.gradle.kts @@ -1,10 +1,3 @@ -import org.gradle.api.publish.PublishingExtension -import org.gradle.api.publish.maven.MavenPublication -import org.gradle.kotlin.dsl.configure -import org.gradle.kotlin.dsl.register -import org.gradle.kotlin.dsl.get -import com.vanniktech.maven.publish.JavaLibrary -import com.vanniktech.maven.publish.JavadocJar import com.vanniktech.maven.publish.MavenPublishBaseExtension import com.vanniktech.maven.publish.SonatypeHost @@ -25,7 +18,7 @@ configure { signAllPublications() publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) - this.coordinates(project.group.toString(), project.name, project.version.toString()) + coordinates(project.group.toString(), project.name, project.version.toString()) pom { name.set("Openlayer API") diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e6441136f3d4ba8a0da8d277868979cfbc8ad796..a4b76b9530d66f5e68d973ea569d8e19de379189 100644 GIT binary patch delta 12612 zcmY+pRa6|n(lttO3GVLh?(Xh3xVuAe26uONcL=V5;I6?T_zdn2`Oi5I_gl9gx~lft zRjVKRp?B~8Wyrx5$mS3|py!Njy{0Wt4i%@s8v88pK z6fPNA45)|*9+*w5kcg$o)}2g}%JfXe6l9ig4T8ia3Hlw#3f^fAKW63%<~GZJd-0YA z9YjleCs~#Y?V+`#nr+49hhsr$K$k!lg}AZDw@>2j=f7t~5IW6#K|lAX7|^N}lJ)I!km`nrwx> z))1Es16__aXGVzQM0EC8xH+O!nqTFBg9Ci{NwRK*CP<6s`Gq(~#lqb(zOlh6ZDBK* zr$|NDj^s6VanrKa+QC;5>twePaexqRI%RO~OY075y?NN90I|f^(P# zF=b>fZ73b5JzD`#GC3lTQ_B3lMeBWgQUGYnFw*HQC}^z{$6G4j(n4y-pRxPT(d2Wgb%vCH(?+t&Pj z)QM`zc`U`+<~D+9E{4Uj2kc#*6eZMU$4Oj6QMfA^K!rbl`iBix=2sPrs7j@aqIrE zTaZJ2M09>rp$mgyUZ!r2$UK{+DGqgl`n;*qFF~M(r#eh`T{MO?2&j?xgr8FU$u3-` zhRDc_I23LL4)K&xg$^&l-W=!Jp-P(_Ie07q>Je;QLxi8LaEc%;WIacJD_T69egF?7 z;I_Sg_!+qrur8$Hq4grigaiVF>U7uWJ@Hkd&%kmFnQN-P^fq0gB1|uRt!U#X;DnlV zo?yHWTw7g5B;#xxY`adhi4yZn@f(7-Xa(J6S=#d@&rlFw!qfvholE>MEb|VWn^g}G zMSrK&zQ^vDId&ojL!{%{o7?s{7;{+u%L{|tar(gp?Uxq3p?xAysB>0E$eG#$tvkk9 z2Q2gEP17{U6@UD*v({5MP-CTZfvWMItVjb4c;i~WLq&{?Q1(koX&vt7+$z}10{^Id z{KDjGi0JpD7@;~odF__0m|p;5rIrHidOP9^mwKe#-&JX-X@acc)06G{LO1Wu)#gvZ za~y9(fhA%UwkDOVU1LBJ`0ROE z4&)dJKK%mG@+CIm?+wt9f~@xIMr8}UH*K1j| z0pppo{7gv3v{URwxVMeg>Ps!L5IKxm zjac2egjgb0vH5i75$s|sY_RYec#>faqJk|AGgV;v=^%BM(^p{p;(^SVt-88G9f!q; z>p}9E4^f0=01S2pQBE4}9YqE%TV)*hlU^8k9{&=K76+*Ax^r=AkBb%OCP^P2nm0Ri z;D-|Zk?gGeU<12ti2CnPVNA(Pb)02+r|&yTWW-OJO7 zNLb0pps6aN?A~NJp5kj{{IOlf!5KWMleV@-hYLift)D>-7K+tgs=7Ake}oBnIy-y1 z(Hn@Hjw=_(x>dO5ysQsrnE%A*bk0K<-j{1Yqz@#n#jOL^AzCr#wR|WYzqk6i7v)Lf zkXdKxzuu20aP{Tbg$(+9&oh7cd(Uoqqf<#ujb$q4sZ~gxFbQfS zS)kNklyL*{2AELgjZ(LBu*>S(oH5AaJ;YiB@;l@=O%F6B?oanzoYRM^fQ9-<~^=3$H0g^JPMLQo@SZ@QuNvy)tyJ)LSj`+()#fy?{aV4Yg^7dlQ7AQM^3GLCR2dAFR zJjtfKiVqF`l-H_fz0HD|9g>)pOxn}k!vdZ=DO!7Sikm{Z%P6BrRkBS6W?ZB5W&7rT z@uYpf@M@a!z7H&o@-yrcCL^Ff3e7p3T`R9p?@o-acXmbTSa0>ZANzCSgovsd%;i$| zVus`not!oL#(W`L-!9w0jdaECaG4hk{V7IOs676ZquZH~0TX5hDq|)x z6T497l|E?f4)LA>j=S8}b$0LS=I4h|hUFJYJODT8Li@#6kF$k0)@*l{RnM1HQ%?VT ze-Pqlc!~t(oumVC*?5fwR;P6u{tHaZ~*LlD;B)4f? z?lpWfa2P@)g57flVl83Ej%P`2)gGyaPjhvD(%i~{`2b>#3!+y&` z!2nuwHMFA-zUY}f1^0B8<`N)Gr=A4TS@b1qykmd0Pq{?r)+1^^+D(=xasb^Tf!oK9 zBLL+*p6M_#ufgLzgq1zcSwZsZnQWFLC3`Yxdg-2=*tT`J9nrfYt)RF)YryBf8_gW{ zvKbB+oZLehfT)S#<|y1)E0hW^?+AnqPXq9Hu;v3dsMGdr{SVyF63;K<8VcgI#~}1i zLYSBL0K;RTT(;>2x=*!1Di9w0mwr;`CN}kM65|Ay{~z}_^JKOsRaN<~#9O^iiW<5P zYN7r~HV!#Nz~IZU`P>1Xe%4f~K}KcF#X&5kO*G}-)74S*tQ8CietdPcA1Yl;S=Mr# z`#MYY!{s^uo=jn7;k6O%(}fN+*0cWMpt~#n9DR<3NyU?+3D^AgI}S)Cu-Tljg`VY} zX1=fq$?8$DtOeGxE6f8lbS_6Q3C4+LDTO$}_IpM$Xv<|QSC%+Oll^q$y`7o@jD{dp zNDl|&X)r7wETa-#h*d`KXntxI(Y{vLha{$0i7@G8xx^m=c<{lJ9?p-i!^W{%j7-oo z0W^SzZ^(Wkyz*We{lEn%Yhu-ycUOHtrRiVJL4~&S91*D0MrLu}Q>v-Mc?GcWfpyz% zX|UvcN@krFO#@v|CtYM}g|=L3%aMo$E5<@CM%c*;?u>LOTz00@+dt1{yg1y=$h+{|D17U}$*^fE^H&8b431EUE z<9tv0V_#%#&1N#j7AKCj!tTK@J%oFW*ESW<(#Gl#Xs%v<@AitI?s92nLzm<)w3Wkkom1f$gcdUi%g_*jofy&}N#luL<$GVIe{iQkQ)sIHVy zBgItnPBFamrv6Kb{eE($Q(f`ZPeW!Hm%Y@F*OF1sKB{Yy|C>WEv_mfvv-N-jh)B-5 z4a!1WcT@9a+hGaBrc~sz=>G?Q!*Zp^JFRUvBMyNR1;`)j$RhH$6gEyVKhd$&K-CFT zXaWC-Y=fyOnqT84iMn9o5oLEOI(_3fk!W^8-74|q1QhQ|CmT0i=b;6Z3u?E{p7V{? z;f#Q-33!L+4&QQcZ~GAqu$NS{M;u%`+#9=7^Oa5PKvCCCWNG_~l(CidS!+xr-*gg{ z$UQ`_1tLT_9jB=Hckkwu>G{s0b0F4bnR7GibmHo?>TR&<3?D;5Fb#gd8*wYa$$~ar z7epl1qM)L{kwiNjQk}?)CFpNTd?0wAOUZ|gC{Ub|c-7h~+Rm(JbdoRe!RNVBQi!M8 z+~U6E2X&KSA*T6KJvsqwqZl#1&==Dm(#b^&VAKQ>7ygv*Fyr;)q9*^F@dCTg2g!w~ z%hg)UXAUyIpIbLXJv1nZX+a_C)BOH2hUim|>=JHCRf(!dtTidb&*~I!JrfRe+PO>w z@ox$G2a3i9d_N9J=|2$y2m-P&#PTNwe!oLBZFs;z|F5kXvBDn<)WwE0E3$ow=zg3R zK(9;sf0t;VEV3@gAg7jRtnj%-6O@!Hvg*;XcUAw}!=2*aErvB(eQIm(-UGmq^J=XN zTqJo$Y|WKo^HlBF3BXJrA#}7ZLg=r*w`I*~Ix`o&2k8^(0mt8Rp=A>F`&gehhp@Jy z^e^#B2!~$LvNCKugg)8)-G%&THdk~kfextilegP9?#C#()F59U$&eo(h|5>ceo*Em z{PEE79T$YP|Kr7K`WBHbtQwyxFkCl6xX&+oUf90B5xoi3_5KHHCyEE*oPbOQkfMz& z6^hT8_NXd2iWk{q9IKae1{_7hMPH8I7_BMtVOM4 z6jm?E0QJOn$qrgsJ`9w##GB9?G})-GXSQo6(tYS(Q0-Ct$co?Zzl0?NHsDRron?;_ zZZgQg)%XW>P?8_&zoGuF(>Och2kEJXsu1_X&~w87x!b z>~h!a>e7{`p@+#hXF88wI*JeWRZ;J4ev4<}HWf|Z;(7$E!S5l9wzBHFe>^I{2`a;a)QnAwa2xv1e(bq$<}!8o^ofGvYpk7dBR+`*%iE;hUY5 zaHF}OjGO9r*{%lmcK^uFiTHgoUD`^9Nx@~;Bg!V* zuuJ&ti{DQiq7RyJAR94wem{}cPK1J(Yxnn_{=>?USqz-~&QXRStS^s-7TksZ$AEI! z#og36s3JGtGU{CnDHRFtipFqvrE*gw7_K@NN0h+ItTq@4fqN!HeQU1y7*X?9+IfZT4Vxebpt z%#VzgdDK~-&+=Z*#>=n#XUhNvBZp3=Cr41jMqwJkHLf3L7Vm~V#GgJ(Jpii~PmJ#s zA7Ft!{xD@z>9DUb4JbiUBdNEcU4BO$651iN*mp*f)HbRRM`Cx5cR?5IfEcU{IZWwf zz(M6CDv)>xa3x}K6%tP^i15P1&&DOLK=k~+jNR$UK3frSl+|PjSC-dBItvD~LL! z>_g(YYdO4k(5EbPOw+v+;G7~jYm>F@Ai|o`gs%F)F8tDz$dl7Q%aCe|v|$UkAul_R zNlA-beBX^IJU?kgS`E$it7nF4DaI!SJAGq)2P&Few(-|tp z?K+%D3e4{pfkayrcbm0ftu6Ol2ZzdKM+4i!hNP3NRL`EvvZJ3yvNr2MV%igZ4kj``Qrdb_OI$7jWP z;l0DYf&0(-*QcP5zrP`HVznW+SbH63Qx$7_9~NjRNg7eKqI!UJ=XH`g^=t8GiFTu( z?2L{JKEu%jJx&XjNzU(*!ZNmL1@RlJA0G$2_LrAb_7lmjil(GSlSM zwTes`m+3R;3#N~Xg#9owh3ycXV8@ZlaY_16kpPFA={721b~URO4HD3sp%fmkZM}k) zZB0#)kP=RkNB~R-MCk8aljG_bagt4vIb~8)BV%(b8_;)&Kf9GX+%O_cNG|(D$!3&D zL(I8}*LqN5NntipFlN13=`D>6!{D@CFMBH0kW3=HccJV+xW~|$qeFR5i-2{X+iWMu zI2$gepQ)H_B%ip_BlWOQ*|pErXs|4ir{IHccgaIJ84irE{?+$KDABXr&f`jB^V-c% z$$u`uU1YB^{<+UN2cNg#7&0bz@yF?5>j|;)5&IV3wIQp58X#OE-M^$HdyvL|Um5t? zhZlAG!Mz%XkUe3t471JM*Yur}o30vzu6RN7gJyNcf!IItsDO730mcJ*O!~V``y5=3 zNJGp34DZ}wd1H6V`Uuy%es>BiO_aE-S8jzir#$& zyk)@2a5tP$@g%jW^b^JGdo)X@Q%sE`^lDQmY9m%uDFpPX`w9%=yQ+nneMm#OaXcD` z9}{tn5A2b2z9783vL2_jSao?uxJhWJoq%47*RafM4o0@gY(p)F>qT4^XM5GLzV#6j zC+HoGhAne7o_w{WUo(B++z7lU3Y0k1rYv9|TSv0vR-Du(5=VakbbelgZTeDn+a_Wv zq_j-^+Qz1WAl;Zg>ahX|CERbX1V%B!hTKN?M}fGoA07M(WU&NfT&TmN`P@56U2 z^)vLDs|Ln~0iTtn-?KTeQl@T&bskJFuTUS!m+$CS9vnd}8(UMO|Kv6TCfGN9NUu&4 zL{)GTxPq>fwsJ~aU=4Qhuq8*RzDsP(LZh$BHezq&9gK$IS<|DYbm})$QTGCS6T;Dr zEkLct!b+#<1r9OKG@P!f1wm8>=Nz!7OzJm!g<+`?N3;YaA3(P@EL=(sTaRMDD!c8=-XN^4BXp(eVkj$NmEMYPP>YJ4bJ3yUud z<3BeJAJ$6z^TuywnfH5lv#$lgwraNw{IV=tIznPH1DT`v-5yS=!)J<}xxl}uZf9azA2A97Haf!;<3y01hlw?dWNEv@TLi1s-mO4vmIT%O_42nS z$VRWrs9NngqRRkWAnWkn%`Rw@?wH|)7XL`EL5EZu$qyJW31&CB^T_)qwIv!{;E_6 zo-9XAryQRlk-O0>o#-SZO>|6OYq;}<*>Wu1AsVRiXY4f8qb;+sItv3AyS!4Ry+q}) zA!pAB|BmC;=RIOk^^vlsEH(!Q!7_1FK~ZB2err*o!+b(r=m1b?$6d!%zmN+69LXnT z&gRmM+n_R-F@sT*IYv0_mGPvur!u`iWbQO7SqiGFLeY&yga zf`lM&B74FA2C?N@8_z652fjhBEoDUKbP8hL{0{HAF%qDo7)o3=3rg#6)T7%%5^wl% z9R0*S*<~>nzYOdQk2l`9h#t+gJy_xujw6xjV(8S<_DbVg61&pT%Hi42l%D73G?adn znB%UdNM0p}lEF-P2%TAMam2zpQev71e>a$$%i+r~b+D9G9pF|oY_*(-u*89oKsXLY+UIbqq)MQ%(GYS{(*n_S_*RN$*~`zUtab%0aKwhx znc)Yo?{xq1sJCgQD)TeTci1ucvbez9q=A72H(-SB18Kl&6^vHV8^i!p@>iF!DIw17 z+8Q)TNisB7>pwyww4y)yJx*wX6SJO78eLBC-ar1+k$Z9fy;wBD|3kzI{<+l*>PSY^ z_?nLOZaeWbU@C3hfK?X;Di*8CHCPkx2qco6(ZyJdqSzp^TJ_5Lpa0UP{Gy+!b0Lr% z@xYxSjUKoY6L#>$qx~KD$-0=|OF7zhVP~ntMgEALYPIfhj@+ z!;JJ7te>CcovruwHsJH6Lta$nm|%^C@=V-rmhU{+I~0(|XHQ9jt@L7pb{gx#{4r!) zg($FyFTslcgu(~6lYr$nW?)%*l#VJ=R-jxK(x=t1bWlu(nL66T#qj%3aZ@uVhy}Co zDU_q61DD5FqqJ*#c|(M5tV)XBN?Ac^12*q)VN4yKPJ|#==S_`_QD9|0ls!`2)SwuHDRA_OfXQDq3%qW&MZB}Z!=k-9xqev8jHz(H z{^D@cIB~QiK>~wa)A&^Ll^Wi6QgCzU;iv-BHsLBs zH7=jN%|>0S`SjP%M&AF1PNVDp_FZ?2Bm@7`DC&v(pYrw!!yD#4 z6+<=HS0Ln6MhoKxF<%~H`y20{vf#pxh=;j{zY381gvAFekgG|>G1zo8$&az{V=;JR zy_puF4$L$?EMhT?;TpQoR*j16ll`#AS4e96C}yp_aGKkBe?1H|k_;gG-~Xorc<;lI zkB}fB{$c-D2mGA&{rm<*@F5)c3X+6??g~XoEwuzSuch0D@W~P5(2I8v8F$c2$Vw51 zP#YLSBDqtWW^EYBl^QYHF+MA7am6f4DOhwnJM=W9$uvMOsZ%_~?)2C#wb?CkI$7{K zEi)=#|5pFvg^){zK5kpBLjB2kZ+$ZB|L=W|aNwyyb(gC2l7bcpx{E-H@)q6@D6N^xh`{1E%ItF2$eeB_SjI@b2WgTpS1thwg&n`jiIzw^TtXUyB{00($GIq>vbj|}bav}}Q_~wp3>k8!E@hVC;OMUTu|= zAy#vXH*GrUHu7^cNZWe1>y;2(51js9wbu+R3Aa*(wzH9+X0dIsf&gc_x|_LP z>~CF^?(~U}+l~ehe|i>?4eo!xkq&Lk+RR-1duNP#o~>@1x)s&i&u zRaYL@+D&_M|JLI6fHbEr_`U;HgPTh#E3?sB)A$*gqyBgg*ql|a-m*TX5rACbWKCE6 zdeQ`v8m6>g^ugv`p|HY^#1QZrGGUj0^HVDc@{?Q0yhalbBEV{+|HzC^-{&e{5K%z9 z6Bxtnfu1!@Mp+Q&*&~;FOg&*Vm<@4b;{FG0-!UUXX!|)1w}op!B_|7_s~d(+=9Gba zKp8`LaB4D(H=cGcspJ_TjYaOwMb=sGn^gtUVhK!UI~2KKYEE-NC}F>+BEY7IVvy%KRvm00tg!Q`y=er}wpEetX}K@;}(}{s9AzV#q2@ zBy7}->|N?13POrs`;U?(qAG(I$~Gt+Rgw%aNZ_0fs_utVvRJT-7z4!@x36v@=NBX=IqkK{#Kg0w48de@?#Yb4M(Svj5=T+<ONr8-oh7l?Cji@+erqur zFhZ=9|Lk=$`c}v4u`)-!!UI=!9Jo@h&7p4RlS#u! zZ7-prn75JkV?VjptX;@$#`U`{vB!=Z?V`T*FBF>J?vsML7e6@2GbUteMFfX-TUu{2 zLNIG*;dV)8GV8gAgEf#)X3A>p3^CRka1v?~8x^anBhQ=L=LsOl=&pcOYHo98m##ye z34MtGCDK!`ptl?taGMr5q{!zVc? zG00e){TV?`YA9eB;(lA3lXI?RrB4BYQGk?vOmTIUJED=(`_*gtn2DB-t4WW54as*W zb2kD-lWX>lb$+W!VFakki>B^Vc+u$?NLF>)!U%b@Y}gYJ>m2H=^x0=nsE0TF^Yu0h ztgH8-o1%+jCk(+&`|)tTfEVHq0cMeFa{Uz)X$;fCq%Y=SOWML6bYfeP8j5hktL`KK z(18`XrUn&WN9PtFxh&dX`y~YBsmdhi7Kw%tKzM%^VEhdD<_XkulW-x=JN6OPbFI4@ zzDDRN+f=@{0h*MswwOqG6gJ?{NuHx(y-|FUGsxyZ*x0~$MW(eY>vqq4Fh#t7uzw=- zKB?|!0N~!h^AMdLa)oR!Ca#HZ9&Zf)ghuO<^RN)4twRlygHnQG(BE{cDc5E}OF4;xss6gYyV~EcJvJkX)xNWb=@yw!uq0v-sf^rvkp-;?DPWK@*SEw|V;IH=7 zfQqEV_>DjOPT~8X*J|H8=&RnzK4~S7ML~nLX^%s-Vqc^aWy7N$y57qciZGcqy#=zU zs8hcHiI=D$+RB{|62{ohCTiaML6FI4Uhzo5D{Jik@poCs0w7F)*w}F4r0sJ~#u-72 z5bK=ANt=M$Dh5NKnxGsg9NRR?WD-x|FhTwBjd zD<-K>44DB~i%frJOfnzh1R>PRY34kw!6~p3M$JLaD1r@`=h)~Ngks-(gdXh^Q?BTP zZ^Zj5w1AwtuR2$~E7s9iZdF}z%pv1em^V2rM{1tLUY@-+Sc0(9jA|iZWml1;v13=U zHf?y@#mb--7z6$ue>`qjhE~brk$AY-RG90~5wcBbDReXR2)pKg{L>;H(DI`U!MLNQ zY9rFJP@ZQ}jlcMh%WSCo%vf+nd0Gmd*F%KMIe>slCUh)8Ma|;M_I+v#;|ueg9oLg; zq2HtZX%&#F7vdpNlkX?}(C7dGC^y#NB#m4%69RzTNrk%4ol~hSI%>2r6B|*ZkW(*P z;u#s;+faHo{tfy+1L^RzWDi*^JR0iY(zJDB36y_QJ+|E-2x+cY z!V8uLNktH~q>WQZuY!Ap66WP|E!0PA1jK~)^8oJVGbspJs6QL!!-5Qm7 zHYI|_`Actg?vDzdg5{86w@GS$G6ANzff7->6i5pB$T4O}`fZ_;{217Om0gN5zTr12 z5mW{hCzCE-QubjxN$TAE-XgI-8dTY@OZmq`y+y_>dk*(qXF0{nam|q@~i}Utp*k{yurq(DW54hkDT4bbg z=_etM?Nf5W^o-HEu9_?&xEqPg^P^mTxLH8n%u$!mWvFG|{&)jtnU&6|5-`~eaNz0%D1BDo`{ zS1N5(KW5v^2eLdd_%`uaRndF@h0Uo6=M|8?b~KbOLZk{HXEnGmtgZXf2inI*1r%n! zQ3&%RI4r{f&dwW~HwH0Ked9b!k6{>_19H z_Ai>5IChDMY(FfMyG%;30?SQ{iV9KyGru62+Y)~qSQ91}b~}w<&*}R&1c#$O`H@~c z5)2S_eXx}M#N{MuGeQS9@#UJB@;W_j50b}jIhxMPloEFQZdvwxiU^RYycTzgK)-vl3LT&$L8~@68$C8~5_U{cR$E#w*x65(qw&eoL@>%ZHvj zWnEMlSh*(o&oy|J7eJ5OD`ssy%F?*Vp?`Cq;FShyl{ZoKCG5g{y}>usznni#8ki(i zO{w@n{iAj1_ooX@+s*!uW60WcH~*bNOT6z%0jVML5};wVrQp~`Uss_{cO2oud_nNA8^B$?07fJ6?iI)Q zuo9G)O-z)DqstrBqf>B%S05hf-wep0@$BFHKSrkZ{za3D)yVzRz)2{wf8(Wp+xyAM z$rtyx$gi3A=V~V!`Q3;BM0$>*VVtxEM|xDL^gew7ydy3Q6YzD&THRz*q33Ms_D;M- zbCx1Ft#UNB)V3bf`~{ImI72OTp^|bF8?G8#FRj+Biy8ET5#rA3sd|0FR@U(LAJ%w8 zS1%n8Z=Amhw)92rIsof=YVWF4jw&F*j1LG@-`+cR0-~2LqXRH8(Ccne{y#MCPncF64U`0uO zWmi$dlii~1D0rLR{qc|_2M!C$t8^=G7xQY)9!#Y331A|>N)EhmyVdLWL9I3YLJ`7? zZmpqUJB>Ni9oiL)^1IK1UoMyhWE{$9M2M6Xi zPKk7GpMsA6vjZbU7~i+u|J6Nk|Ci!Y3UMUT2|`M;JsNQACdJ%ooo9Yt{?A+0hMpxi znEa~~sxC>rKrU6bd=WRb;%wsH>A#j4{({&1GYSNR57Gama(3)2A;SM>qop}l>Jk2* zn1+C$fIxuwzg3mCU#SOqb-wOCb6mBcYlA5+mt<&_J~sBxc(GQtBFINUO~Mr7<-uu($>P HJ4oML2Lo<@i8BwbL^1~GkG`E7C$SEa_ zF^}Ea+#Je`Xy6;#D0FPnSrR%Y!QGA~NA^{oWmW8C<3dr{x6wWQ{4+bzemqV5W$i5~ z=J0jXZ>uZb>DT@0Ks?4QJ{`z?8JWl3$y;2pj#$XP*pv$>$g(z43{YH9KmmR6<#sIn zA`#=0#sgycaBQ^&}Xba!|KaZ8~b30v~nLt z9%#gz_*=~KD{3t^X~l>480*}PhKN=??g`RV|4Ud{Gyyl187MJ}r(#e+H$GEdI+p1s zq_25h;fV)$EPK%Dw-(G=f`yHB-_tttsC!?k7*#!|4a>`Ahj8nm?&n>NRs%jkZW^3-0P_yMP5&*6a26{MRj1&TPF zyE#|c)5uUHzMWx=rMKpuPih*V=S;W3MzIZTw2uTbr}8`p2bm+Z6Sa%vvWAWSf4H)p(+ zSQ8;EvUa#wqWV+9vmIio(%7wukK2SwjUS8Yl%Rq%=~PU)2$Tvm6`1!r3H@U#_|bB0 zmlT1PS3wPB(b&^+@YY7Y$n4l3mV3-X0$>z|gZp6O*Lhzn&?Gad2ZCF;+#95-Y?#y+ z?*l@Yf=a4w{Px=o!N|3~_XKfk&G;fN>Ps&dp2FpA~qD=0~=!NOS@B#XAKKkND>Y{4>rqxrViKD7;?>j8`R` z&G)3FN|dfsxnaI^!d1G%=>AbTTxZWo;n-DLrQ!sj=f~VAOe5zhGS(dgx|!ls62fbX zV@<7Ck^!}R=`Swr?(7w1rY6Nmq~sfXJ?TiKJLn=&SQdEt9$@0 zA+h1Wbwbri0s-stc8yVq;mRa6@kEf8^KXUz&jcic!+avDvvJFa>k0ioWug=T3oPw; zyj4it&0@>_*uI@2=^+T7sL1_!^aJW@Xfo8aC#3^WtQC7fET8b9C} z*u^ue6Ojn z7@(eskJ2+cNnH9~VyfIh<-|7!je~vGy*odz(sk-u$~SrYF3glruZ*W`{sqnS+9=;Z zh{D@MSG91%lr&ua8%$sJF%y1I<|e;EdfJykY8#D$Hc_81n5`$7;1N|b0tvvPLzSg& zn7!5x?T*@rQUKcUhTIjV(rw*5oQYlm5DbEO?60#mohHfbR$3_x#+PZoYi@Vd4`#YgKyTd^!4n{fN~WZDY61sAOm6 zl!d^i*a01QxpWM9Pcl?&{RgO}uq%ErOk5WpECvnfEh!*YP&1Sl)uTN4hg??Vqs~i5 zYsfufz3?{TtwuBN=`0~Qg1PlWH#OGG$ zLLWU17$v``)CE1cds_7kj8mJ{-+l8{DS|zAQ&3|qpOY=!J|kXUhXue9|H>4gqk|n) z-i34GmxLFj8asb3D#D&=ya*a5`C<=o?G;Ev^LV%;l#nH#O=7Nh@z1Do>j6Q;I5S2P zhg|AZbC&|c7}uSJt57s2IK#rSWuararn-02dkptTjo*R{c5o(bWV}_k3BBnKcE|6l zrHl&ezUyw^DmaMdDFVn<8ZY=7_{u{uW&*F<7Al6};lD(u;SB=RpIwI)PTyL=e25h* zGi{lRT}snjbMK~IUx|EGonH+w;iC2Ws)x>=5_{5$m?K z5(*1jMn%u0V1Y%m@`YS3kskt~`1p(rA4uk;Cs!w^KL$w>MH)+cP6|XKr4FfHIATJH z!EGAK4N>1yFR`-zW|w%ByRe#=&kA&#WyUldDGpt!wf-8SFWiSi!5QZL+l7*CE?u!NW1T$<1rdLJ9y3u{_zvHaM?#Rm4 zFk}^1!ffcrB|XK3gsO-s=wr*sUe&^$yN|KxrA)uW00Gu60%pw_+DcUjW`oW<35OC8 zq2{j8SgC}W$?10pvFU83(SL$%C?Kctu3*cs0aa%q!fjn1%xD*Jrm!F3HGR9-C{b?- zHp(cL;ezXMpL@0-1v0DMWddSDNZ5h?q50cOZyVi#bU3&PWE=(hpVn|M4_KYG5h9LffKNRsfhr^=SYiKg?#r&HNMi2@cd4aYL9lw(5_IvQJ zcB*DD()hUSAD^PdA0y|QrVnqwgI@pUXZXjHq3lG2OU&7sPOxxU$Y3&ytj6Qb=2#cC z;{d-{k|xI*bu+Vy&N+}{i(+1me!M;nshY_*&ZQLTGG*xNw#{RpI`3^eGfHck+*38NRgiGahkFethtVY=czJs#)VVc{T65rhU#3Vf?X)8f0)X{w!J3J{z|Sq|%?)nA+zo?$>L9@o`Kc|*7sJo4UjIqu0Ir~S5k^vEH};6K?-dZ0h*m%-1L zf!VC%YbM1~sZOG5zu&Sh>R;(md*_)kGHP)<;OA44W?y53PI%{&@MEN}9TOiqu+1a3AGetBr$c)Ao3OX>iGxmA;^^_alwS818r4Pn&uYe^;z6dh z)68T|AN=hjNdGpF7n>y+RTAZc9&opTXf zqWfK_dUv=mW{p_vN>|(cIkd(+Jy}qnK{IW%X*3!l`^H~FbAHwof+vLZ0C2ZXN1$v7 zgN&R9c8IO`fkR{6U%ERq8FN<1DQYbAN0-pH7EfcA{A&nhT!Be>jj>J!bNRw4NF|}! z1c70_#fkk!VQ!q1h2ff@`yDyrI1`np>*e#D4-Z~*!T^8#o*$V~!8bWQaie?P@KGBb z8rXc!YDL!$3ZgZZ%;-%~0Kn<+d+{xJ$stQbtN8GWV?MCJvzPU|(E(1z;rFw{&6vy) z3*@y%7Tx8rH-p$boS>bLyod?OKRE8v`QSBvGfY6f}_{Zo1q85xoyOF16n~yHx2W ziydUoYLkJmzq|n&2S(O!ZmLdP1(o1Jsq88cX)x3V-BK5eF&0e_0G!5?U7&3KN0`mc zH&Lt)q8!d_VgzxyL^(@xrbp2y)Hmr^V48));RSfE=*Ly0uh9!$3dv-vMZr2URf@l5zdwLjGZB zugY>7_fd_vbV*Qv1?H~>Z%RD%nEeFSI$n$$Lrpc6g>i4+XdBB!%zM$Bhrz5Swzyg? z$~I~n@~-wTBY3-T&pr+|gC+OHDoR?I(eLWa{Z#Rsh>lc~%u0!&R|s0pA*w<7QZ}{i z*AFr~0F3y~f$MGh_HDL7J_1?SxKL}fWIk!$G}`^{)xh*dZ5kK>xGL9>V`WZZg_ z)^Vm)EQK`yfh5KiR(vb&aHvhich z_5o+{d~0+4BEBqYJXyXBIEb1UgVDs;a!N2$9WA>CbfrWryqT25)S4E4)QXBd*3jN} z?phkAt`1rKW?xoLzEm!*IfkH|P>BtECVr0l8-IGk_`UjE#IWkUGqvyS+dMrCnFl<7RCgSMX^qn|Ld_4iYRldO zY&cHhv)GDo8nKvKwAbfyLR%t?9gG?R7~PSD#4D-;?F&!kV59O}neYut5AGbKwy-(U zqyBi=&Mgj|VIo>$u!DHM`R7O?W8-idbePuxiJMH``6c_5L-chKd}=rGC5Gfrc{f!* zWFEBm?l@_b7kzY7%1RQQbG5V<4=ZlkZ%sF74Q|mKOc7Ak7dP2#quiGcZ0_J%7Q?j{ zv9{WFw;n5G-Mn%r#0R;{jLt{yy}9J6rQ(>X9pJ`7Xy?Zv z=lNit#qXaq?CnElK^zF~sG}U5oCpR0T>FH=ZX}Prju$);?;VOhFH8L3I><9P_A|C+ z{;>~dk%9rrq(snjsEm}oUz2FQ21MCG*e?g)?{!&|eg7PX@I+Q0!hL6C7ZVY|g2E>i zr!Ri2@OfEu$)d52+>+cpgh6Z;cLYCZ&EMR0i<^~4&wEu_bdo;y^6}+U2GIQgW$|Od z_jg{O=pU>0-H$P-EOlWyQy#W0r@@_uT}Lg+!d5NxMii7aT1=|qm6BRaWOf{Pws54v zTu=}LR!V(JzI07>QR;;px0+zq=(s+XH-0~rVbmGp8<)7G+Jf)UYs<$Dd>-K+4}CsD zS}KYLmkbRvjwBO3PB%2@j(vOpm)!JABH_E7X^f#V-bzifSaKtE)|QrczC1$sC<<*Y z$hY*3E10fYk`2W09gM_U<2>+r^+ro$Bqh-O7uSa)cfPE_<#^O) zF+5V;-8LaCLKdIh3UB@idQZL`0Vx8`OE#6*1<;8(zi&E7MWB1S%~HAm%axyIHN2vd zA(pJGm_PraB0Aat3~?obWBs?iSc*NhM!{-l_WNCx4@F7I?)5&oI|z{o@JKd1HZ}zf*#}JjK3$ z-;3V*WJZvUcKvSOBH4c7C{fl8oRw8-vfgKQjNiR|KhQ%k6hWNEke(k8w-Ro| z7Y3)FsY-?7%;VT64vRM)l0%&HI~BXkSAOV#F3Bf#|3QLZM%6C{paqLTb3MU-_)`{R zRdfVQ)uX90VCa3ja$8m;cdtxQ*(tNjIfVb%#TCJWeH?o4RY#LWpyZBJHR| z6G-!4W5O^Z8U}e5GfZ!_M{B``ve{r0Z#CXV0x@~X#Pc;}{{ClY_uw^=wWurj0RKnoFzeY` z;gS!PCLCo*c}-hLc?C&wv&>P1hH75=p#;D3{Q8UZ0ctX!b)_@Ur=WCMEuz>pTs$@s z#7bIutL9Pm2FDb~d+H}uBI#pu6R}T{nzpz9U0XLb9lu@=9bTY&PEyFwhHHtXFX~6C zrcg|qqTk(|MIM%KQ<@j=DOjt|V)+8K26wE_CBNnZTg+Z+s}AU|jp6CFoIptG1{J*# z7Ne~l;ba*=bSwAMQ|Vq#fW~+je4PXA91YFzBubNF?ovIOw-$C-8=Ehed{lGD0}(Id zRe4sh8L>&T%{>8o))he}eE;5_ zxoXk3wX?MyNl-xF!q1d$G?=wp^`@09(jU&X zOqZIBI#dN`2PJNdATR3ivtub|nO$dulSaP|e4)WXF1YAGN1pDQIbIjXFG!oC85Mt; zW$eteoL{y^5t4TMRwP$jNPjZFpGsWnGe=jMMqKtcZm9Y9PFZLi*1p@qoKKub^T@2+ zk$@*KYdQ?Z`}<%4ALwk*Yc{(WTf@#u;as(fvE^9{Gk)lWbJP*SjttWofV0s?AB({~l zZI1hZVWFT~W-T?nfMMcnCS4-#6H-MU7H$KxD;yaM46K4Kc@~Q>xzB+QnD_I`b_l3m zo9pRx46b!p?a^&zCDwygqqV3epjs(s0NQI6ARA1n!Yy-qduipxQ& zUAlqRpNjBS+y-ZheD(!R;F}&^V_}b_gqH%tVZ5%%ziO7k^w=es+wZtK^i*vmrWNLMs{oWu_CIov|s1raZiS)>38>pYu;i+-t zI_DiNe6aA4KTZ2P09qPj(0~K4nUq^0+f(2$g`229zkG4jLzRvJUWE0oF1XHL4t3UN zDH466G56sy9hTZoAJB!C3;@F;ONxEk5u6Mv%zdo}Rq`=* zw1n7MOhfNSV48TS989ArIcj`C%Gk8~93~u>)!Yt2b4ZriKj9x2d`H2HQNJ=I>hkDlcZn zqRj>!;oRMTIOu zx|Zfsu~v76T{z7AC(jxj^c@tnJHZtGPsq$DE!8kqvkDx5W?KUJPL+!Ffpwfa+|5z5 zKPCiOPqZZrAG;2%OH0T$W|`C@C*!Z`@Wkop{CTjB&Tk`+{XPnt`ND`Haz;xV`H^RS zyXYtw@WlqTvToi;=mq1<-|IQ(gcOpU%)b#_46|IuWL#4$oYLbqwuk6=Q@xZaJSKVF zZcHs~ZBl;&lF3=+nK; zF`4gSCeZXlwmC_t4I`#PUNQ*)Uv&oGxMALip|sxv^lyVV73tKI7)+QY5=tEMas{vTD-BaTJ^*Y6gq~PU;F5X!sxqiq$iFCo+Uv7m%1w((=e}Vf*=dtds|6 zbX}91!G?C*KG03eHoN}RZS9DJxa&8YwNCT8?JxMXyZqZr13NA|GB{+vG`08C{V(yy zf*Lw$+tYSU_+dI`3n{bMrPdDb`A=Mkg!O=k>1|*3MC8j~- zXL79J4E=U^H=iBLTeHE_OKzE&dws8RNynsSJ!d;`zK?P92U{f)xvD7VQVosrXZrL+ z6lMVdD1YgL;%(1cq{#bS6yXmp|DS@nax#AqqlZhtUQdh<^2vr5`EpAO

LGYq)sa(w9^3-f}NHy=GR4v%t2YZly3m1G@5y`xBh_HGrD%f z>;|Ty?9FiJAc&UVD(StT4I` zfVQwxhE9bXE6r2mKO8Ag7{L^jCyqQb0QqKDPE=RAgqn8q1O^>(z7h5kE(6va%QqRZ zkIOmp(})rLSS(2{=C12e&@!W2=Jel-^_R``0xHO^+t!(oXbcv5yhD4g*$t_F)_5Dl zSVCgesW%;DtYPCFs{G;GX_o?1J3;QQPPv)rWw;>} zJ&KwnUqwNXloNXlK_+pNDfI~hON#SokVJb&ilg8d7^NWo2ZQymCqQMnjfi>ePibjr z-Z@q!?RGN$Mj}Nk){X_vaj6?Mj$>ACR*z|6MsXy3VZ^PFn@yHkPo(>m(iWepn8SC@ z>D2;R4m+gDRZ=SIX!b+CP(qE=JDIUkn=D$aUu+Ihn9-+k1LS3PreQg0N5eWIG@x${nC3v^7caS>1!PKNAY9J z#}E}Q9w#SP>(GY7Hbj&z4$Li6o5taBO|4+F`yS9zq*LJ<38wy4I>HA9(&GYrk4dLajKGww))BWli6Ln1A^Lda@N~p+snkb9C z@OthI+<##vp8!HVQT4Wk(=@zQ{OvZ$EKWS73+JHb)eYLGD-cqi6^|vd$<+IHuc?Nq zW7JertT~3))4?J|28n$I@nAD0c1%9C&IVhEZX~mUsf{efyS(XNG%ch;!N~d7S(Ri7 zb&=BuON95aVA&kLn6&MVU|x}xPMp7xwWxNU1wS+F6#y}1@^wQZB*(&ecT?RnQcI}Y z2*z!^!D?gDUhc@;M^OpLs4mq>C&p{}OWVv<)S9KMars@0JQ{c_ScGsFo3BJ)Irg++ zAWwypJdTO-_{Uh8m(Z!3KL7K{ZZzKHj;{M8I$mV>k znTM?sa0);^=X^cglL`uC+^J)M7nEa$w=VwFULg~%DJllw+7dJAj3{qnP5i3@wr7%y zjXp?Wl2%Th=my&3u?Q$RV6N5tzKMSPTsc#J+-cDDp~qFB6bL2C8AS7Y3PKtVhdhl) zIaLqH5+OnWPWSt(lQCgkN8lczc-V%_iZ{>#1%Z$N*>lu#S;0MZ$T2Y8Kg!U;hAZj> z6S#%$DQ_`Ic%Zr@?}GgjRXg@qTj^17n`65oJ@Wj0u1X8&+UVd|Xs?J+i_^GZ94m6= zUc96~Q`OJvlKB_Lr15*Yw_PUPEr?f?H&00b^-W%26mD)(n(rGGNfK9~2h=C>p-7BZ zFd&*&Msdu{w~(eyFOglwCPH^Rb}O(N7LtS+nnEwDx*pGD?|&9Si~M43a+*L(b0$5A zv`T`(G3xO;I_sx;FwTP21ZlfDpz zOo?}Vlgf~fo{YWm@n_JyD*frOg{XsvBA~|Tn4V6hu>Gd>89-rblfVJUaGvj6X%NZ} z$tFF9sx=4_$*c~G`9iPLGh@=sV+O{D2-t*K@J7H=`V+oVt}8?04WwU3h1BgS!f%1P zFak-T#7`TtLcR=Yz>g0R!ZQrH!YiZOQN=_V-UyncN1Rc18?KY?#O`v#JK+pq0K$~H z3D@v9DZF42R)b9#BBX{^$DOMlJ!g)Gc za{o-1e%F6NvgKq9tC8pV+9S$;9*zNv{J*)n&dmf~anP1)4~N%~h#c(=B#3*KgzhCKhFdgDoWi2IDog{RVyzK|Y`rCUs3T~pJMmdZJy4?b z&s5G=zhf**(t7Y^oC_mcTsE-{^}wiaoUu&?kojLKs>SJPxjcP>{a5CbXCx92AcBE) zHtqP}LjZ{W>PH?Tu(E0X=%{PBMW@F_?#7b&#!^q`<-5$ur+-q6 z{dn=(^UZw6*3-XM_(=@<1_*i&XM4=0t5u!gm6 z{UlmNGPKgO_;e;q9|#esq~Sq`<}%d{+sRmhvsA{5i*91=tub>OZZ%)xUA#4q$dDyy z1`w4%?OPLg3JeZb#cqSMO?*Xn%|-FCcuH2i2fn_{IFusub6;NQdN|7TD1N?%E8*g? z$apAt@cEe!I%jB=*q$p_3=t_5R0ph%{qaq+QDg!c99Y!Xa!&oDZOeis_ot)gNXr{l zdY$|So2Qed2Y7KMNBrS^E169kG%h<+z{Z_p_;shB!uY)>yAVcK=&!bg`lVg)4T1|7 z0}7FpfydVH4F87K@c!nEG+WGKm{Ouo)Slpl;#qcEIQ0zdMfLA#;dBxYw;p;KoVv6| z3_D5&7rJdG12CnDSvZUW?$UC6^UVSW^|vw|o-_4bz)(w5(3AiVhpeT(|=f#x_}E?s#qHZF#xA6AF_ujl$G z-jHD%q(d2}v2PhXx&6YWps~m(^+RXl91Q#xRRJBhjKl$FG4bk);|ag;ieUZ&!Ii3$ z(iGz1+0m7#g5>ASldBbNZL=ZHh=tmmJt$!71; zIML2GhEz1pg@1rQN(M^_691wAGkJ@Pga_05WuQ6! zG5RkGY2^`@(H~pp7&Ga+Pwh3L!Njj!-rc;^bTIfo5hP@H##1X8xUZJckrx>id`bAd3QUx9GuomqBYZ!uN1-&o zvTxC?;p8vL67&fW8fw(YOqt>L@bdLrEF*3OgYe$4n4{ zEB40LiU#6-0@5jdN`0w}N0qi@c0~oT2FP z)LNk&a82my?jv(tQpiMi$TK_L@lub#lsM$R{Dk?Ya@%%%huZkct~tSWM714c!45k}-ZLVA-bVM`>|_ZBbW_m-7| z3U%xrAhi}n?T(2F{_n4EZ10inkIFl#y09?7$uwBoJgqY8vylwev)fDOn;>0R!aEnV zBz%j0Mqpx~EZU3q@%+oV7;}|vt7$~ou@faEIq{p?FY$XXg&6*K)b_LP=}gi9`Bij3 zN`zEo|B6*|-;>S`rNa^BKRDbDAk>X#MsR`EvL>6bqU@SaDDs z8>bu@3YdRaWs*Te@G-UHjU%F~kTHw5(0PVJ+pwh#ha2u;DB+UMo@A5UYIl#5rtBV- zGX_hIpw}3C@H*Us(Cc-d#-gNrG#w$(9+S=GxO>3SR`SE2fHZ2KrDc#_C^$jI>Y}#; zMwY=R6@+dWi~0RXw(c@3GZ&%~9K(q&ee0Zw;pwL`E_tZak-#8^_b)Dpyi73^he?xV zXJ08&wh5-M&}qy4f7!D&=E)puDD(Nmg1d_(j`4LvxM5x_huNg-pGG%9rYqO6mImyJ@}*3Y>^3OvcnTG%EV1) zq_Ap?Z!Iw__7#D=pOWnQN$gB!Mr0!9yx|g<4icJh{cFOu3B8}&RiYm+Mb;VEK``LK zL(NcpcTiGieOIssSjr?ob}^``nNf&UcJhXyncO9m{6gD$kqSD`S69(aF8dkWz5>!9 zBLe4Sib7Hs2x_L2Ls6Ish$MGVKrGt5+_2zCyP1byaCg3upo+-I}R4&$m)8 zQ7|jc1Z^VWggpuQj*cP;>Zo9LS!VSzrqmZczaf;u`d0J(f%Z9r%An@s!e>n9%y=n!IZ_tVGu{Jmsbp}Fk%HJIU?a+-~bjfLTuH|JExA8EROowzr zqW9{YyZhR0a4clRK>1I4Ncx&WER~{iE;F^$T7K%X@3PGOA%6#Z%p3TS^&M;Dnjw@i z^o!$9nhcsmcHcY4?4j9+ofL_CWsZ4Hcch(rjsGfGD(nsH>w}^ERqGnz%iGj0j{g}h z7wMkJ-2Z2~eS>2!i}0~B63i;>SyFJU2+>VCS^AxaDOx%g6-t0eM^P<3+*z`ztvOqrG3)&#$K?& z_Y0wbWID47@cU`E1A6A&!`aZk0ZE@z-h#l1NqX2#`$Uev2gepW`rf8*!=rD5&;Jb{ zl08rU>dPo=K%-1Ao1~G-@4ve~y5#9E8x;TE0k5d^TC(=Zc>mwjW^c=+U-<9}b0ku~}gj z3sbW>R2M6DR!g#NUP;nxo>)@7*=RP{U18SDop6b2&PHce^&h97@xx3t+VK+!keE#} z;(Uf&89as9k8{$nkLbuB!-d7TP`_VJpL^Xs8OKB~ri$YUbW8fch64}7|0EWoT(TRj{ z*GT<7Y<7DsrCi79ZsM)z#c(!nNOGySOCkY1fAuQOq12&iUVC!a`#O;dBLf=d?&4*B zI~LgAO7E0qxK(uRTM;IgJ}+z^gD+bi-6I!3x{r9`l~%8TRP%UE0V8E*Sz>Nl1NVG<<7(wDHZ+HcOkQm$O&k+vyx)y)x{Pz!U8hS$*m zByc0h6BUI*BOpuL==P+H|Hx%`>7!W+1H!l9vi&)`V zyn2o9{z=lc+VX*!Vh~SF=)L}Z40XeG>LF6cP^b+R$NxSeUqbK^Q*UTalKzP8X%{9@RSCXm_NhF>{=S2 zi}ezam_^P`S!!-cyEW9y7DBbK93roz@Raccy*v}?mKXScU9E_4g;hBU7}zSofAFda zKYEe?{{I54 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23a..cea7a793 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a42..f3b75f3b 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/gradlew.bat b/gradlew.bat index 25da30db..9d21a218 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt index 6369d219..9138e7c9 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt @@ -11,6 +11,7 @@ import com.openlayer.api.core.http.QueryParams import java.net.Proxy import java.time.Clock import java.time.Duration +import java.util.Optional class OpenlayerOkHttpClient private constructor() { @@ -130,6 +131,8 @@ class OpenlayerOkHttpClient private constructor() { fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) } + fun apiKey(apiKey: Optional) = apiKey(apiKey.orElse(null)) + fun fromEnv() = apply { clientOptions.fromEnv() } fun build(): OpenlayerClient = diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt index 3bd8ace4..10399f40 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt @@ -11,6 +11,7 @@ import com.openlayer.api.core.http.QueryParams import java.net.Proxy import java.time.Clock import java.time.Duration +import java.util.Optional class OpenlayerOkHttpClientAsync private constructor() { @@ -130,6 +131,8 @@ class OpenlayerOkHttpClientAsync private constructor() { fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) } + fun apiKey(apiKey: Optional) = apiKey(apiKey.orElse(null)) + fun fromEnv() = apply { clientOptions.fromEnv() } fun build(): OpenlayerClientAsync = diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt new file mode 100644 index 00000000..90c3d44f --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt @@ -0,0 +1,30 @@ +@file:JvmName("Check") + +package com.openlayer.api.core + +@JvmSynthetic +internal fun checkRequired(name: String, value: T?): T = + checkNotNull(value) { "`$name` is required, but was not set" } + +@JvmSynthetic +internal fun checkLength(name: String, value: String, length: Int): String = + value.also { + check(it.length == length) { "`$name` must have length $length, but was ${it.length}" } + } + +@JvmSynthetic +internal fun checkMinLength(name: String, value: String, minLength: Int): String = + value.also { + check(it.length >= minLength) { + if (minLength == 1) "`$name` must be non-empty, but was empty" + else "`$name` must have at least length $minLength, but was ${it.length}" + } + } + +@JvmSynthetic +internal fun checkMaxLength(name: String, value: String, maxLength: Int): String = + value.also { + check(it.length <= maxLength) { + "`$name` must have at most length $maxLength, but was ${it.length}" + } + } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt index 9dbd51c6..c06e289a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt @@ -9,6 +9,7 @@ import com.openlayer.api.core.http.PhantomReachableClosingHttpClient import com.openlayer.api.core.http.QueryParams import com.openlayer.api.core.http.RetryingHttpClient import java.time.Clock +import java.util.Optional class ClientOptions private constructor( @@ -68,6 +69,16 @@ private constructor( fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl } + fun responseValidation(responseValidation: Boolean) = apply { + this.responseValidation = responseValidation + } + + fun maxRetries(maxRetries: Int) = apply { this.maxRetries = maxRetries } + + fun apiKey(apiKey: String?) = apply { this.apiKey = apiKey } + + fun apiKey(apiKey: Optional) = apiKey(apiKey.orElse(null)) + fun headers(headers: Headers) = apply { this.headers.clear() putAllHeaders(headers) @@ -148,18 +159,10 @@ private constructor( fun removeAllQueryParams(keys: Set) = apply { queryParams.removeAll(keys) } - fun responseValidation(responseValidation: Boolean) = apply { - this.responseValidation = responseValidation - } - - fun maxRetries(maxRetries: Int) = apply { this.maxRetries = maxRetries } - - fun apiKey(apiKey: String?) = apply { this.apiKey = apiKey } - fun fromEnv() = apply { System.getenv("OPENLAYER_API_KEY")?.let { apiKey(it) } } fun build(): ClientOptions { - checkNotNull(httpClient) { "`httpClient` is required but was not set" } + val httpClient = checkRequired("httpClient", httpClient) val headers = Headers.builder() val queryParams = QueryParams.builder() @@ -179,10 +182,10 @@ private constructor( queryParams.replaceAll(this.queryParams.build()) return ClientOptions( - httpClient!!, + httpClient, PhantomReachableClosingHttpClient( RetryingHttpClient.builder() - .httpClient(httpClient!!) + .httpClient(httpClient) .clock(clock) .maxRetries(maxRetries) .build() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt index 7c5ab9d7..898b7a66 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt @@ -16,7 +16,9 @@ internal fun List.toImmutable(): List = @JvmSynthetic internal fun Map.toImmutable(): Map = - if (isEmpty()) Collections.emptyMap() else Collections.unmodifiableMap(toMap()) + if (isEmpty()) immutableEmptyMap() else Collections.unmodifiableMap(toMap()) + +@JvmSynthetic internal fun immutableEmptyMap(): Map = Collections.emptyMap() @JvmSynthetic internal fun , V> SortedMap.toImmutable(): SortedMap = diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt index fc2653eb..fa3f9378 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt @@ -117,6 +117,8 @@ sealed class JsonField { is JsonValue -> this } + @JvmSynthetic fun accept(consume: (T) -> Unit) = asKnown().ifPresent(consume) + fun accept(visitor: Visitor): R = when (this) { is KnownValue -> visitor.visitKnown(value) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt index 0376b43e..1ab31a45 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt @@ -4,19 +4,23 @@ package com.openlayer.api.errors import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.annotation.JsonCreator +import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import java.util.Objects -@JsonDeserialize(builder = OpenlayerError.Builder::class) @NoAutoDetect class OpenlayerError +@JsonCreator private constructor( @JsonAnyGetter + @ExcludeMissing + @JsonAnySetter @get:JvmName("additionalProperties") - val additionalProperties: Map, + val additionalProperties: Map = immutableEmptyMap(), ) { fun toBuilder() = Builder().from(this) @@ -40,7 +44,6 @@ private constructor( putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { additionalProperties.put(key, value) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt index 483a9ee2..b78e4045 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt @@ -6,12 +6,14 @@ import com.fasterxml.jackson.annotation.JsonCreator import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects import java.util.Optional +/** List the test results for a project commit (project version). */ class CommitTestResultListParams constructor( private val projectVersionId: String, @@ -26,14 +28,25 @@ constructor( fun projectVersionId(): String = projectVersionId + /** Include archived goals. */ fun includeArchived(): Optional = Optional.ofNullable(includeArchived) + /** The page to return in a paginated query. */ fun page(): Optional = Optional.ofNullable(page) + /** Maximum number of items to return per page. */ fun perPage(): Optional = Optional.ofNullable(perPage) + /** + * Filter list of test results by status. Available statuses are `running`, `passing`, + * `failing`, `skipped`, and `error`. + */ fun status(): Optional = Optional.ofNullable(status) + /** + * Filter objects by test type. Available types are `integrity`, `consistency`, `performance`, + * `fairness`, and `robustness`. + */ fun type(): Optional = Optional.ofNullable(type) fun _additionalHeaders(): Headers = additionalHeaders @@ -97,27 +110,61 @@ constructor( } /** Include archived goals. */ - fun includeArchived(includeArchived: Boolean) = apply { + fun includeArchived(includeArchived: Boolean?) = apply { this.includeArchived = includeArchived } + /** Include archived goals. */ + fun includeArchived(includeArchived: Boolean) = includeArchived(includeArchived as Boolean?) + + /** Include archived goals. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun includeArchived(includeArchived: Optional) = + includeArchived(includeArchived.orElse(null) as Boolean?) + + /** The page to return in a paginated query. */ + fun page(page: Long?) = apply { this.page = page } + /** The page to return in a paginated query. */ - fun page(page: Long) = apply { this.page = page } + fun page(page: Long) = page(page as Long?) + + /** The page to return in a paginated query. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun page(page: Optional) = page(page.orElse(null) as Long?) + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long?) = apply { this.perPage = perPage } + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long) = perPage(perPage as Long?) /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { this.perPage = perPage } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun perPage(perPage: Optional) = perPage(perPage.orElse(null) as Long?) + + /** + * Filter list of test results by status. Available statuses are `running`, `passing`, + * `failing`, `skipped`, and `error`. + */ + fun status(status: Status?) = apply { this.status = status } /** * Filter list of test results by status. Available statuses are `running`, `passing`, * `failing`, `skipped`, and `error`. */ - fun status(status: Status) = apply { this.status = status } + fun status(status: Optional) = status(status.orElse(null)) + + /** + * Filter objects by test type. Available types are `integrity`, `consistency`, + * `performance`, `fairness`, and `robustness`. + */ + fun type(type: Type?) = apply { this.type = type } /** * Filter objects by test type. Available types are `integrity`, `consistency`, * `performance`, `fairness`, and `robustness`. */ - fun type(type: Type) = apply { this.type = type } + fun type(type: Optional) = type(type.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -219,7 +266,7 @@ constructor( fun build(): CommitTestResultListParams = CommitTestResultListParams( - checkNotNull(projectVersionId) { "`projectVersionId` is required but was not set" }, + checkRequired("projectVersionId", projectVersionId), includeArchived, page, perPage, @@ -230,6 +277,10 @@ constructor( ) } + /** + * Filter list of test results by status. Available statuses are `running`, `passing`, + * `failing`, `skipped`, and `error`. + */ class Status @JsonCreator private constructor( @@ -305,6 +356,10 @@ constructor( override fun toString() = value.toString() } + /** + * Filter objects by test type. Available types are `integrity`, `consistency`, `performance`, + * `fairness`, and `robustness`. + */ class Type @JsonCreator private constructor( diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt index 35873592..afc2c48d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt @@ -21,36 +21,42 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.getOrThrow +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = CommitTestResultListResponse.Builder::class) @NoAutoDetect class CommitTestResultListResponse +@JsonCreator private constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") + @ExcludeMissing + private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun items(): List = items.getRequired("items") - @JsonProperty("items") @ExcludeMissing fun _items() = items + @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): CommitTestResultListResponse = apply { - if (!validated) { - items().forEach { it.validate() } - validated = true + if (validated) { + return@apply } + + items().forEach { it.validate() } + validated = true } fun toBuilder() = Builder().from(this) @@ -62,91 +68,121 @@ private constructor( class Builder { - private var items: JsonField> = JsonMissing.of() + private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(commitTestResultListResponse: CommitTestResultListResponse) = apply { - this.items = commitTestResultListResponse.items - additionalProperties(commitTestResultListResponse.additionalProperties) + items = commitTestResultListResponse.items.map { it.toMutableList() } + additionalProperties = commitTestResultListResponse.additionalProperties.toMutableMap() } fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") - @ExcludeMissing - fun items(items: JsonField>) = apply { this.items = items } + fun items(items: JsonField>) = apply { + this.items = items.map { it.toMutableList() } + } + + fun addItem(item: Item) = apply { + items = + (items ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(item) + } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): CommitTestResultListResponse = CommitTestResultListResponse( - items.map { it.toImmutable() }, + checkRequired("items", items).map { it.toImmutable() }, additionalProperties.toImmutable() ) } - @JsonDeserialize(builder = Item.Builder::class) @NoAutoDetect class Item + @JsonCreator private constructor( - private val id: JsonField, - private val goal: JsonField, - private val goalId: JsonField, - private val projectVersionId: JsonField, - private val inferencePipelineId: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val dateDataStarts: JsonField, - private val dateDataEnds: JsonField, - private val status: JsonField, - private val statusMessage: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateDataEnds") + @ExcludeMissing + private val dateDataEnds: JsonField = JsonMissing.of(), + @JsonProperty("dateDataStarts") + @ExcludeMissing + private val dateDataStarts: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineId") + @ExcludeMissing + private val inferencePipelineId: JsonField = JsonMissing.of(), + @JsonProperty("projectVersionId") + @ExcludeMissing + private val projectVersionId: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + private val statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("goal") @ExcludeMissing private val goal: JsonField = JsonMissing.of(), + @JsonProperty("goalId") + @ExcludeMissing + private val goalId: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** Project version (commit) id. */ fun id(): String = id.getRequired("id") - fun goal(): Optional = Optional.ofNullable(goal.getNullable("goal")) - - /** The test id. */ - fun goalId(): Optional = Optional.ofNullable(goalId.getNullable("goalId")) - - /** The project version (commit) id. */ - fun projectVersionId(): Optional = - Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) - - /** The inference pipeline id. */ - fun inferencePipelineId(): Optional = - Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) - /** The creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The last updated date. */ - fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** The data end date. */ + fun dateDataEnds(): Optional = + Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) /** The data start date. */ fun dateDataStarts(): Optional = Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) - /** The data end date. */ - fun dateDataEnds(): Optional = - Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) + /** The last updated date. */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** The inference pipeline id. */ + fun inferencePipelineId(): Optional = + Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) + + /** The project version (commit) id. */ + fun projectVersionId(): Optional = + Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) /** The status of the test. */ fun status(): Status = status.getRequired("status") @@ -155,59 +191,80 @@ private constructor( fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) - /** Project version (commit) id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id - - @JsonProperty("goal") @ExcludeMissing fun _goal() = goal + fun goal(): Optional = Optional.ofNullable(goal.getNullable("goal")) /** The test id. */ - @JsonProperty("goalId") @ExcludeMissing fun _goalId() = goalId + fun goalId(): Optional = Optional.ofNullable(goalId.getNullable("goalId")) - /** The project version (commit) id. */ - @JsonProperty("projectVersionId") @ExcludeMissing fun _projectVersionId() = projectVersionId + /** Project version (commit) id. */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The inference pipeline id. */ - @JsonProperty("inferencePipelineId") + /** The creation date. */ + @JsonProperty("dateCreated") @ExcludeMissing - fun _inferencePipelineId() = inferencePipelineId + fun _dateCreated(): JsonField = dateCreated - /** The creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + /** The data end date. */ + @JsonProperty("dateDataEnds") + @ExcludeMissing + fun _dateDataEnds(): JsonField = dateDataEnds + + /** The data start date. */ + @JsonProperty("dateDataStarts") + @ExcludeMissing + fun _dateDataStarts(): JsonField = dateDataStarts /** The last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - /** The data start date. */ - @JsonProperty("dateDataStarts") @ExcludeMissing fun _dateDataStarts() = dateDataStarts + /** The inference pipeline id. */ + @JsonProperty("inferencePipelineId") + @ExcludeMissing + fun _inferencePipelineId(): JsonField = inferencePipelineId - /** The data end date. */ - @JsonProperty("dateDataEnds") @ExcludeMissing fun _dateDataEnds() = dateDataEnds + /** The project version (commit) id. */ + @JsonProperty("projectVersionId") + @ExcludeMissing + fun _projectVersionId(): JsonField = projectVersionId /** The status of the test. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status /** The status message. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + + @JsonProperty("goal") @ExcludeMissing fun _goal(): JsonField = goal + + /** The test id. */ + @JsonProperty("goalId") @ExcludeMissing fun _goalId(): JsonField = goalId @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Item = apply { - if (!validated) { - id() - goal().map { it.validate() } - goalId() - projectVersionId() - inferencePipelineId() - dateCreated() - dateUpdated() - dateDataStarts() - dateDataEnds() - status() - statusMessage() - validated = true + if (validated) { + return@apply } + + id() + dateCreated() + dateDataEnds() + dateDataStarts() + dateUpdated() + inferencePipelineId() + projectVersionId() + status() + statusMessage() + goal().ifPresent { it.validate() } + goalId() + validated = true } fun toBuilder() = Builder().from(this) @@ -219,170 +276,178 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateDataEnds: JsonField? = null + private var dateDataStarts: JsonField? = null + private var dateUpdated: JsonField? = null + private var inferencePipelineId: JsonField? = null + private var projectVersionId: JsonField? = null + private var status: JsonField? = null + private var statusMessage: JsonField? = null private var goal: JsonField = JsonMissing.of() private var goalId: JsonField = JsonMissing.of() - private var projectVersionId: JsonField = JsonMissing.of() - private var inferencePipelineId: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() - private var dateDataStarts: JsonField = JsonMissing.of() - private var dateDataEnds: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var statusMessage: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(item: Item) = apply { - this.id = item.id - this.goal = item.goal - this.goalId = item.goalId - this.projectVersionId = item.projectVersionId - this.inferencePipelineId = item.inferencePipelineId - this.dateCreated = item.dateCreated - this.dateUpdated = item.dateUpdated - this.dateDataStarts = item.dateDataStarts - this.dateDataEnds = item.dateDataEnds - this.status = item.status - this.statusMessage = item.statusMessage - additionalProperties(item.additionalProperties) + id = item.id + dateCreated = item.dateCreated + dateDataEnds = item.dateDataEnds + dateDataStarts = item.dateDataStarts + dateUpdated = item.dateUpdated + inferencePipelineId = item.inferencePipelineId + projectVersionId = item.projectVersionId + status = item.status + statusMessage = item.statusMessage + goal = item.goal + goalId = item.goalId + additionalProperties = item.additionalProperties.toMutableMap() } /** Project version (commit) id. */ fun id(id: String) = id(JsonField.of(id)) /** Project version (commit) id. */ - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - fun goal(goal: Goal) = goal(JsonField.of(goal)) - - @JsonProperty("goal") - @ExcludeMissing - fun goal(goal: JsonField) = apply { this.goal = goal } + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The test id. */ - fun goalId(goalId: String) = goalId(JsonField.of(goalId)) + /** The creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } - /** The test id. */ - @JsonProperty("goalId") - @ExcludeMissing - fun goalId(goalId: JsonField) = apply { this.goalId = goalId } + /** The data end date. */ + fun dateDataEnds(dateDataEnds: OffsetDateTime?) = + dateDataEnds(JsonField.ofNullable(dateDataEnds)) - /** The project version (commit) id. */ - fun projectVersionId(projectVersionId: String) = - projectVersionId(JsonField.of(projectVersionId)) + /** The data end date. */ + fun dateDataEnds(dateDataEnds: Optional) = + dateDataEnds(dateDataEnds.orElse(null)) - /** The project version (commit) id. */ - @JsonProperty("projectVersionId") - @ExcludeMissing - fun projectVersionId(projectVersionId: JsonField) = apply { - this.projectVersionId = projectVersionId + /** The data end date. */ + fun dateDataEnds(dateDataEnds: JsonField) = apply { + this.dateDataEnds = dateDataEnds } - /** The inference pipeline id. */ - fun inferencePipelineId(inferencePipelineId: String) = - inferencePipelineId(JsonField.of(inferencePipelineId)) - - /** The inference pipeline id. */ - @JsonProperty("inferencePipelineId") - @ExcludeMissing - fun inferencePipelineId(inferencePipelineId: JsonField) = apply { - this.inferencePipelineId = inferencePipelineId - } + /** The data start date. */ + fun dateDataStarts(dateDataStarts: OffsetDateTime?) = + dateDataStarts(JsonField.ofNullable(dateDataStarts)) - /** The creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + /** The data start date. */ + fun dateDataStarts(dateDataStarts: Optional) = + dateDataStarts(dateDataStarts.orElse(null)) - /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun dateCreated(dateCreated: JsonField) = apply { - this.dateCreated = dateCreated + /** The data start date. */ + fun dateDataStarts(dateDataStarts: JsonField) = apply { + this.dateDataStarts = dateDataStarts } /** The last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - /** The data start date. */ - fun dateDataStarts(dateDataStarts: OffsetDateTime) = - dateDataStarts(JsonField.of(dateDataStarts)) + /** The inference pipeline id. */ + fun inferencePipelineId(inferencePipelineId: String?) = + inferencePipelineId(JsonField.ofNullable(inferencePipelineId)) - /** The data start date. */ - @JsonProperty("dateDataStarts") - @ExcludeMissing - fun dateDataStarts(dateDataStarts: JsonField) = apply { - this.dateDataStarts = dateDataStarts + /** The inference pipeline id. */ + fun inferencePipelineId(inferencePipelineId: Optional) = + inferencePipelineId(inferencePipelineId.orElse(null)) + + /** The inference pipeline id. */ + fun inferencePipelineId(inferencePipelineId: JsonField) = apply { + this.inferencePipelineId = inferencePipelineId } - /** The data end date. */ - fun dateDataEnds(dateDataEnds: OffsetDateTime) = - dateDataEnds(JsonField.of(dateDataEnds)) + /** The project version (commit) id. */ + fun projectVersionId(projectVersionId: String?) = + projectVersionId(JsonField.ofNullable(projectVersionId)) - /** The data end date. */ - @JsonProperty("dateDataEnds") - @ExcludeMissing - fun dateDataEnds(dateDataEnds: JsonField) = apply { - this.dateDataEnds = dateDataEnds + /** The project version (commit) id. */ + fun projectVersionId(projectVersionId: Optional) = + projectVersionId(projectVersionId.orElse(null)) + + /** The project version (commit) id. */ + fun projectVersionId(projectVersionId: JsonField) = apply { + this.projectVersionId = projectVersionId } /** The status of the test. */ fun status(status: Status) = status(JsonField.of(status)) /** The status of the test. */ - @JsonProperty("status") - @ExcludeMissing fun status(status: JsonField) = apply { this.status = status } /** The status message. */ - fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** The status message. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.orElse(null)) /** The status message. */ - @JsonProperty("statusMessage") - @ExcludeMissing fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } + fun goal(goal: Goal) = goal(JsonField.of(goal)) + + fun goal(goal: JsonField) = apply { this.goal = goal } + + /** The test id. */ + fun goalId(goalId: String?) = goalId(JsonField.ofNullable(goalId)) + + /** The test id. */ + fun goalId(goalId: Optional) = goalId(goalId.orElse(null)) + + /** The test id. */ + fun goalId(goalId: JsonField) = apply { this.goalId = goalId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Item = Item( - id, + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateDataEnds", dateDataEnds), + checkRequired("dateDataStarts", dateDataStarts), + checkRequired("dateUpdated", dateUpdated), + checkRequired("inferencePipelineId", inferencePipelineId), + checkRequired("projectVersionId", projectVersionId), + checkRequired("status", status), + checkRequired("statusMessage", statusMessage), goal, goalId, - projectVersionId, - inferencePipelineId, - dateCreated, - dateUpdated, - dateDataStarts, - dateDataEnds, - status, - statusMessage, additionalProperties.toImmutable(), ) } + /** The status of the test. */ class Status @JsonCreator private constructor( @@ -458,45 +523,93 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = Goal.Builder::class) @NoAutoDetect class Goal + @JsonCreator private constructor( - private val id: JsonField, - private val number: JsonField, - private val name: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val description: JsonValue, - private val evaluationWindow: JsonField, - private val delayWindow: JsonField, - private val type: JsonField, - private val subtype: JsonField, - private val creatorId: JsonField, - private val originProjectVersionId: JsonField, - private val thresholds: JsonField>, - private val archived: JsonField, - private val dateArchived: JsonField, - private val suggested: JsonField, - private val commentCount: JsonField, - private val usesMlModel: JsonField, - private val usesValidationDataset: JsonField, - private val usesTrainingDataset: JsonField, - private val usesReferenceDataset: JsonField, - private val usesProductionData: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("commentCount") + @ExcludeMissing + private val commentCount: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + private val creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateArchived") + @ExcludeMissing + private val dateArchived: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonValue = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("number") + @ExcludeMissing + private val number: JsonField = JsonMissing.of(), + @JsonProperty("originProjectVersionId") + @ExcludeMissing + private val originProjectVersionId: JsonField = JsonMissing.of(), + @JsonProperty("subtype") + @ExcludeMissing + private val subtype: JsonField = JsonMissing.of(), + @JsonProperty("suggested") + @ExcludeMissing + private val suggested: JsonField = JsonMissing.of(), + @JsonProperty("thresholds") + @ExcludeMissing + private val thresholds: JsonField> = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonProperty("archived") + @ExcludeMissing + private val archived: JsonField = JsonMissing.of(), + @JsonProperty("delayWindow") + @ExcludeMissing + private val delayWindow: JsonField = JsonMissing.of(), + @JsonProperty("evaluationWindow") + @ExcludeMissing + private val evaluationWindow: JsonField = JsonMissing.of(), + @JsonProperty("usesMlModel") + @ExcludeMissing + private val usesMlModel: JsonField = JsonMissing.of(), + @JsonProperty("usesProductionData") + @ExcludeMissing + private val usesProductionData: JsonField = JsonMissing.of(), + @JsonProperty("usesReferenceDataset") + @ExcludeMissing + private val usesReferenceDataset: JsonField = JsonMissing.of(), + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + private val usesTrainingDataset: JsonField = JsonMissing.of(), + @JsonProperty("usesValidationDataset") + @ExcludeMissing + private val usesValidationDataset: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The test id. */ fun id(): String = id.getRequired("id") - /** The test number. */ - fun number(): Long = number.getRequired("number") + /** The number of comments on the test. */ + fun commentCount(): Long = commentCount.getRequired("commentCount") - /** The test name. */ - fun name(): String = name.getRequired("name") + /** The test creator id. */ + fun creatorId(): Optional = + Optional.ofNullable(creatorId.getNullable("creatorId")) + + /** The date the test was archived. */ + fun dateArchived(): Optional = + Optional.ofNullable(dateArchived.getNullable("dateArchived")) /** The creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") @@ -504,170 +617,187 @@ private constructor( /** The last updated date. */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The evaluation window in seconds. Only applies to tests that use production data. */ - fun evaluationWindow(): Optional = - Optional.ofNullable(evaluationWindow.getNullable("evaluationWindow")) - - /** The delay window in seconds. Only applies to tests that use production data. */ - fun delayWindow(): Optional = - Optional.ofNullable(delayWindow.getNullable("delayWindow")) - - /** The test type. */ - fun type(): String = type.getRequired("type") + /** The test description. */ + @JsonProperty("description") @ExcludeMissing fun _description(): JsonValue = description - /** The test subtype. */ - fun subtype(): String = subtype.getRequired("subtype") + /** The test name. */ + fun name(): String = name.getRequired("name") - /** The test creator id. */ - fun creatorId(): Optional = - Optional.ofNullable(creatorId.getNullable("creatorId")) + /** The test number. */ + fun number(): Long = number.getRequired("number") /** The project version (commit) id where the test was created. */ fun originProjectVersionId(): Optional = Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) - fun thresholds(): List = thresholds.getRequired("thresholds") + /** The test subtype. */ + fun subtype(): String = subtype.getRequired("subtype") + + /** Whether the test is suggested or user-created. */ + fun suggested(): Boolean = suggested.getRequired("suggested") + + fun thresholds(): List = thresholds.getRequired("thresholds") + + /** The test type. */ + fun type(): String = type.getRequired("type") /** Whether the test is archived. */ fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) - /** The date the test was archived. */ - fun dateArchived(): Optional = - Optional.ofNullable(dateArchived.getNullable("dateArchived")) - - /** Whether the test is suggested or user-created. */ - fun suggested(): Boolean = suggested.getRequired("suggested") + /** The delay window in seconds. Only applies to tests that use production data. */ + fun delayWindow(): Optional = + Optional.ofNullable(delayWindow.getNullable("delayWindow")) - /** The number of comments on the test. */ - fun commentCount(): Long = commentCount.getRequired("commentCount") + /** The evaluation window in seconds. Only applies to tests that use production data. */ + fun evaluationWindow(): Optional = + Optional.ofNullable(evaluationWindow.getNullable("evaluationWindow")) /** Whether the test uses an ML model. */ fun usesMlModel(): Optional = Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) - /** Whether the test uses a validation dataset. */ - fun usesValidationDataset(): Optional = - Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) - - /** Whether the test uses a training dataset. */ - fun usesTrainingDataset(): Optional = - Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) + /** Whether the test uses production data (monitoring mode only). */ + fun usesProductionData(): Optional = + Optional.ofNullable(usesProductionData.getNullable("usesProductionData")) /** Whether the test uses a reference dataset (monitoring mode only). */ fun usesReferenceDataset(): Optional = Optional.ofNullable(usesReferenceDataset.getNullable("usesReferenceDataset")) - /** Whether the test uses production data (monitoring mode only). */ - fun usesProductionData(): Optional = - Optional.ofNullable(usesProductionData.getNullable("usesProductionData")) + /** Whether the test uses a training dataset. */ + fun usesTrainingDataset(): Optional = + Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) + + /** Whether the test uses a validation dataset. */ + fun usesValidationDataset(): Optional = + Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) /** The test id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The test number. */ - @JsonProperty("number") @ExcludeMissing fun _number() = number + /** The number of comments on the test. */ + @JsonProperty("commentCount") + @ExcludeMissing + fun _commentCount(): JsonField = commentCount - /** The test name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + /** The test creator id. */ + @JsonProperty("creatorId") + @ExcludeMissing + fun _creatorId(): JsonField = creatorId + + /** The date the test was archived. */ + @JsonProperty("dateArchived") + @ExcludeMissing + fun _dateArchived(): JsonField = dateArchived /** The creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated - - /** The test description. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description - - /** The evaluation window in seconds. Only applies to tests that use production data. */ - @JsonProperty("evaluationWindow") + @JsonProperty("dateUpdated") @ExcludeMissing - fun _evaluationWindow() = evaluationWindow + fun _dateUpdated(): JsonField = dateUpdated - /** The delay window in seconds. Only applies to tests that use production data. */ - @JsonProperty("delayWindow") @ExcludeMissing fun _delayWindow() = delayWindow + /** The test name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The test type. */ - @JsonProperty("type") @ExcludeMissing fun _type() = type + /** The test number. */ + @JsonProperty("number") @ExcludeMissing fun _number(): JsonField = number + + /** The project version (commit) id where the test was created. */ + @JsonProperty("originProjectVersionId") + @ExcludeMissing + fun _originProjectVersionId(): JsonField = originProjectVersionId /** The test subtype. */ - @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype + @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype - /** The test creator id. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + /** Whether the test is suggested or user-created. */ + @JsonProperty("suggested") + @ExcludeMissing + fun _suggested(): JsonField = suggested - /** The project version (commit) id where the test was created. */ - @JsonProperty("originProjectVersionId") + @JsonProperty("thresholds") @ExcludeMissing - fun _originProjectVersionId() = originProjectVersionId + fun _thresholds(): JsonField> = thresholds - @JsonProperty("thresholds") @ExcludeMissing fun _thresholds() = thresholds + /** The test type. */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type /** Whether the test is archived. */ - @JsonProperty("archived") @ExcludeMissing fun _archived() = archived + @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived - /** The date the test was archived. */ - @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived() = dateArchived - - /** Whether the test is suggested or user-created. */ - @JsonProperty("suggested") @ExcludeMissing fun _suggested() = suggested + /** The delay window in seconds. Only applies to tests that use production data. */ + @JsonProperty("delayWindow") + @ExcludeMissing + fun _delayWindow(): JsonField = delayWindow - /** The number of comments on the test. */ - @JsonProperty("commentCount") @ExcludeMissing fun _commentCount() = commentCount + /** The evaluation window in seconds. Only applies to tests that use production data. */ + @JsonProperty("evaluationWindow") + @ExcludeMissing + fun _evaluationWindow(): JsonField = evaluationWindow /** Whether the test uses an ML model. */ - @JsonProperty("usesMlModel") @ExcludeMissing fun _usesMlModel() = usesMlModel - - /** Whether the test uses a validation dataset. */ - @JsonProperty("usesValidationDataset") + @JsonProperty("usesMlModel") @ExcludeMissing - fun _usesValidationDataset() = usesValidationDataset + fun _usesMlModel(): JsonField = usesMlModel - /** Whether the test uses a training dataset. */ - @JsonProperty("usesTrainingDataset") + /** Whether the test uses production data (monitoring mode only). */ + @JsonProperty("usesProductionData") @ExcludeMissing - fun _usesTrainingDataset() = usesTrainingDataset + fun _usesProductionData(): JsonField = usesProductionData /** Whether the test uses a reference dataset (monitoring mode only). */ @JsonProperty("usesReferenceDataset") @ExcludeMissing - fun _usesReferenceDataset() = usesReferenceDataset + fun _usesReferenceDataset(): JsonField = usesReferenceDataset - /** Whether the test uses production data (monitoring mode only). */ - @JsonProperty("usesProductionData") + /** Whether the test uses a training dataset. */ + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + fun _usesTrainingDataset(): JsonField = usesTrainingDataset + + /** Whether the test uses a validation dataset. */ + @JsonProperty("usesValidationDataset") @ExcludeMissing - fun _usesProductionData() = usesProductionData + fun _usesValidationDataset(): JsonField = usesValidationDataset @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Goal = apply { - if (!validated) { - id() - number() - name() - dateCreated() - dateUpdated() - evaluationWindow() - delayWindow() - type() - subtype() - creatorId() - originProjectVersionId() - thresholds().forEach { it.validate() } - archived() - dateArchived() - suggested() - commentCount() - usesMlModel() - usesValidationDataset() - usesTrainingDataset() - usesReferenceDataset() - usesProductionData() - validated = true + if (validated) { + return@apply } + + id() + commentCount() + creatorId() + dateArchived() + dateCreated() + dateUpdated() + name() + number() + originProjectVersionId() + subtype() + suggested() + thresholds().forEach { it.validate() } + type() + archived() + delayWindow() + evaluationWindow() + usesMlModel() + usesProductionData() + usesReferenceDataset() + usesTrainingDataset() + usesValidationDataset() + validated = true } fun toBuilder() = Builder().from(this) @@ -679,88 +809,98 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var number: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() - private var description: JsonValue = JsonMissing.of() - private var evaluationWindow: JsonField = JsonMissing.of() - private var delayWindow: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() - private var subtype: JsonField = JsonMissing.of() - private var creatorId: JsonField = JsonMissing.of() - private var originProjectVersionId: JsonField = JsonMissing.of() - private var thresholds: JsonField> = JsonMissing.of() + private var id: JsonField? = null + private var commentCount: JsonField? = null + private var creatorId: JsonField? = null + private var dateArchived: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var description: JsonValue? = null + private var name: JsonField? = null + private var number: JsonField? = null + private var originProjectVersionId: JsonField? = null + private var subtype: JsonField? = null + private var suggested: JsonField? = null + private var thresholds: JsonField>? = null + private var type: JsonField? = null private var archived: JsonField = JsonMissing.of() - private var dateArchived: JsonField = JsonMissing.of() - private var suggested: JsonField = JsonMissing.of() - private var commentCount: JsonField = JsonMissing.of() + private var delayWindow: JsonField = JsonMissing.of() + private var evaluationWindow: JsonField = JsonMissing.of() private var usesMlModel: JsonField = JsonMissing.of() - private var usesValidationDataset: JsonField = JsonMissing.of() - private var usesTrainingDataset: JsonField = JsonMissing.of() - private var usesReferenceDataset: JsonField = JsonMissing.of() private var usesProductionData: JsonField = JsonMissing.of() + private var usesReferenceDataset: JsonField = JsonMissing.of() + private var usesTrainingDataset: JsonField = JsonMissing.of() + private var usesValidationDataset: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(goal: Goal) = apply { - this.id = goal.id - this.number = goal.number - this.name = goal.name - this.dateCreated = goal.dateCreated - this.dateUpdated = goal.dateUpdated - this.description = goal.description - this.evaluationWindow = goal.evaluationWindow - this.delayWindow = goal.delayWindow - this.type = goal.type - this.subtype = goal.subtype - this.creatorId = goal.creatorId - this.originProjectVersionId = goal.originProjectVersionId - this.thresholds = goal.thresholds - this.archived = goal.archived - this.dateArchived = goal.dateArchived - this.suggested = goal.suggested - this.commentCount = goal.commentCount - this.usesMlModel = goal.usesMlModel - this.usesValidationDataset = goal.usesValidationDataset - this.usesTrainingDataset = goal.usesTrainingDataset - this.usesReferenceDataset = goal.usesReferenceDataset - this.usesProductionData = goal.usesProductionData - additionalProperties(goal.additionalProperties) + id = goal.id + commentCount = goal.commentCount + creatorId = goal.creatorId + dateArchived = goal.dateArchived + dateCreated = goal.dateCreated + dateUpdated = goal.dateUpdated + description = goal.description + name = goal.name + number = goal.number + originProjectVersionId = goal.originProjectVersionId + subtype = goal.subtype + suggested = goal.suggested + thresholds = goal.thresholds.map { it.toMutableList() } + type = goal.type + archived = goal.archived + delayWindow = goal.delayWindow + evaluationWindow = goal.evaluationWindow + usesMlModel = goal.usesMlModel + usesProductionData = goal.usesProductionData + usesReferenceDataset = goal.usesReferenceDataset + usesTrainingDataset = goal.usesTrainingDataset + usesValidationDataset = goal.usesValidationDataset + additionalProperties = goal.additionalProperties.toMutableMap() } /** The test id. */ fun id(id: String) = id(JsonField.of(id)) /** The test id. */ - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - /** The test number. */ - fun number(number: Long) = number(JsonField.of(number)) + /** The number of comments on the test. */ + fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) - /** The test number. */ - @JsonProperty("number") - @ExcludeMissing - fun number(number: JsonField) = apply { this.number = number } + /** The number of comments on the test. */ + fun commentCount(commentCount: JsonField) = apply { + this.commentCount = commentCount + } - /** The test name. */ - fun name(name: String) = name(JsonField.of(name)) + /** The test creator id. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The test name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + /** The test creator id. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + + /** The test creator id. */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The date the test was archived. */ + fun dateArchived(dateArchived: OffsetDateTime?) = + dateArchived(JsonField.ofNullable(dateArchived)) + + /** The date the test was archived. */ + fun dateArchived(dateArchived: Optional) = + dateArchived(dateArchived.orElse(null)) + + /** The date the test was archived. */ + fun dateArchived(dateArchived: JsonField) = apply { + this.dateArchived = dateArchived + } /** The creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -770,152 +910,139 @@ private constructor( dateUpdated(JsonField.of(dateUpdated)) /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } /** The test description. */ - @JsonProperty("description") - @ExcludeMissing fun description(description: JsonValue) = apply { this.description = description } - /** - * The evaluation window in seconds. Only applies to tests that use production data. - */ - fun evaluationWindow(evaluationWindow: Double) = - evaluationWindow(JsonField.of(evaluationWindow)) + /** The test name. */ + fun name(name: String) = name(JsonField.of(name)) - /** - * The evaluation window in seconds. Only applies to tests that use production data. - */ - @JsonProperty("evaluationWindow") - @ExcludeMissing - fun evaluationWindow(evaluationWindow: JsonField) = apply { - this.evaluationWindow = evaluationWindow - } + /** The test name. */ + fun name(name: JsonField) = apply { this.name = name } - /** The delay window in seconds. Only applies to tests that use production data. */ - fun delayWindow(delayWindow: Double) = delayWindow(JsonField.of(delayWindow)) + /** The test number. */ + fun number(number: Long) = number(JsonField.of(number)) - /** The delay window in seconds. Only applies to tests that use production data. */ - @JsonProperty("delayWindow") - @ExcludeMissing - fun delayWindow(delayWindow: JsonField) = apply { - this.delayWindow = delayWindow - } + /** The test number. */ + fun number(number: JsonField) = apply { this.number = number } - /** The test type. */ - fun type(type: String) = type(JsonField.of(type)) + /** The project version (commit) id where the test was created. */ + fun originProjectVersionId(originProjectVersionId: String?) = + originProjectVersionId(JsonField.ofNullable(originProjectVersionId)) - /** The test type. */ - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } + /** The project version (commit) id where the test was created. */ + fun originProjectVersionId(originProjectVersionId: Optional) = + originProjectVersionId(originProjectVersionId.orElse(null)) + + /** The project version (commit) id where the test was created. */ + fun originProjectVersionId(originProjectVersionId: JsonField) = apply { + this.originProjectVersionId = originProjectVersionId + } /** The test subtype. */ fun subtype(subtype: String) = subtype(JsonField.of(subtype)) /** The test subtype. */ - @JsonProperty("subtype") - @ExcludeMissing fun subtype(subtype: JsonField) = apply { this.subtype = subtype } - /** The test creator id. */ - fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) - - /** The test creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } - - /** The project version (commit) id where the test was created. */ - fun originProjectVersionId(originProjectVersionId: String) = - originProjectVersionId(JsonField.of(originProjectVersionId)) + /** Whether the test is suggested or user-created. */ + fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) - /** The project version (commit) id where the test was created. */ - @JsonProperty("originProjectVersionId") - @ExcludeMissing - fun originProjectVersionId(originProjectVersionId: JsonField) = apply { - this.originProjectVersionId = originProjectVersionId - } + /** Whether the test is suggested or user-created. */ + fun suggested(suggested: JsonField) = apply { this.suggested = suggested } fun thresholds(thresholds: List) = thresholds(JsonField.of(thresholds)) - @JsonProperty("thresholds") - @ExcludeMissing fun thresholds(thresholds: JsonField>) = apply { - this.thresholds = thresholds + this.thresholds = thresholds.map { it.toMutableList() } + } + + fun addThreshold(threshold: Threshold) = apply { + thresholds = + (thresholds ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(threshold) + } } + /** The test type. */ + fun type(type: String) = type(JsonField.of(type)) + + /** The test type. */ + fun type(type: JsonField) = apply { this.type = type } + /** Whether the test is archived. */ fun archived(archived: Boolean) = archived(JsonField.of(archived)) /** Whether the test is archived. */ - @JsonProperty("archived") - @ExcludeMissing fun archived(archived: JsonField) = apply { this.archived = archived } - /** The date the test was archived. */ - fun dateArchived(dateArchived: OffsetDateTime) = - dateArchived(JsonField.of(dateArchived)) + /** The delay window in seconds. Only applies to tests that use production data. */ + fun delayWindow(delayWindow: Double?) = + delayWindow(JsonField.ofNullable(delayWindow)) - /** The date the test was archived. */ - @JsonProperty("dateArchived") - @ExcludeMissing - fun dateArchived(dateArchived: JsonField) = apply { - this.dateArchived = dateArchived + /** The delay window in seconds. Only applies to tests that use production data. */ + fun delayWindow(delayWindow: Double) = delayWindow(delayWindow as Double?) + + /** The delay window in seconds. Only applies to tests that use production data. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun delayWindow(delayWindow: Optional) = + delayWindow(delayWindow.orElse(null) as Double?) + + /** The delay window in seconds. Only applies to tests that use production data. */ + fun delayWindow(delayWindow: JsonField) = apply { + this.delayWindow = delayWindow } - /** Whether the test is suggested or user-created. */ - fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) + /** + * The evaluation window in seconds. Only applies to tests that use production data. + */ + fun evaluationWindow(evaluationWindow: Double?) = + evaluationWindow(JsonField.ofNullable(evaluationWindow)) - /** Whether the test is suggested or user-created. */ - @JsonProperty("suggested") - @ExcludeMissing - fun suggested(suggested: JsonField) = apply { this.suggested = suggested } + /** + * The evaluation window in seconds. Only applies to tests that use production data. + */ + fun evaluationWindow(evaluationWindow: Double) = + evaluationWindow(evaluationWindow as Double?) - /** The number of comments on the test. */ - fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) + /** + * The evaluation window in seconds. Only applies to tests that use production data. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun evaluationWindow(evaluationWindow: Optional) = + evaluationWindow(evaluationWindow.orElse(null) as Double?) - /** The number of comments on the test. */ - @JsonProperty("commentCount") - @ExcludeMissing - fun commentCount(commentCount: JsonField) = apply { - this.commentCount = commentCount + /** + * The evaluation window in seconds. Only applies to tests that use production data. + */ + fun evaluationWindow(evaluationWindow: JsonField) = apply { + this.evaluationWindow = evaluationWindow } /** Whether the test uses an ML model. */ fun usesMlModel(usesMlModel: Boolean) = usesMlModel(JsonField.of(usesMlModel)) /** Whether the test uses an ML model. */ - @JsonProperty("usesMlModel") - @ExcludeMissing fun usesMlModel(usesMlModel: JsonField) = apply { this.usesMlModel = usesMlModel } - /** Whether the test uses a validation dataset. */ - fun usesValidationDataset(usesValidationDataset: Boolean) = - usesValidationDataset(JsonField.of(usesValidationDataset)) - - /** Whether the test uses a validation dataset. */ - @JsonProperty("usesValidationDataset") - @ExcludeMissing - fun usesValidationDataset(usesValidationDataset: JsonField) = apply { - this.usesValidationDataset = usesValidationDataset - } - - /** Whether the test uses a training dataset. */ - fun usesTrainingDataset(usesTrainingDataset: Boolean) = - usesTrainingDataset(JsonField.of(usesTrainingDataset)) + /** Whether the test uses production data (monitoring mode only). */ + fun usesProductionData(usesProductionData: Boolean) = + usesProductionData(JsonField.of(usesProductionData)) - /** Whether the test uses a training dataset. */ - @JsonProperty("usesTrainingDataset") - @ExcludeMissing - fun usesTrainingDataset(usesTrainingDataset: JsonField) = apply { - this.usesTrainingDataset = usesTrainingDataset + /** Whether the test uses production data (monitoring mode only). */ + fun usesProductionData(usesProductionData: JsonField) = apply { + this.usesProductionData = usesProductionData } /** Whether the test uses a reference dataset (monitoring mode only). */ @@ -923,31 +1050,35 @@ private constructor( usesReferenceDataset(JsonField.of(usesReferenceDataset)) /** Whether the test uses a reference dataset (monitoring mode only). */ - @JsonProperty("usesReferenceDataset") - @ExcludeMissing fun usesReferenceDataset(usesReferenceDataset: JsonField) = apply { this.usesReferenceDataset = usesReferenceDataset } - /** Whether the test uses production data (monitoring mode only). */ - fun usesProductionData(usesProductionData: Boolean) = - usesProductionData(JsonField.of(usesProductionData)) + /** Whether the test uses a training dataset. */ + fun usesTrainingDataset(usesTrainingDataset: Boolean) = + usesTrainingDataset(JsonField.of(usesTrainingDataset)) - /** Whether the test uses production data (monitoring mode only). */ - @JsonProperty("usesProductionData") - @ExcludeMissing - fun usesProductionData(usesProductionData: JsonField) = apply { - this.usesProductionData = usesProductionData + /** Whether the test uses a training dataset. */ + fun usesTrainingDataset(usesTrainingDataset: JsonField) = apply { + this.usesTrainingDataset = usesTrainingDataset + } + + /** Whether the test uses a validation dataset. */ + fun usesValidationDataset(usesValidationDataset: Boolean) = + usesValidationDataset(JsonField.of(usesValidationDataset)) + + /** Whether the test uses a validation dataset. */ + fun usesValidationDataset(usesValidationDataset: JsonField) = apply { + this.usesValidationDataset = usesValidationDataset } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -955,52 +1086,65 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Goal = Goal( - id, - number, - name, - dateCreated, - dateUpdated, - description, - evaluationWindow, - delayWindow, - type, - subtype, - creatorId, - originProjectVersionId, - thresholds.map { it.toImmutable() }, + checkRequired("id", id), + checkRequired("commentCount", commentCount), + checkRequired("creatorId", creatorId), + checkRequired("dateArchived", dateArchived), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("description", description), + checkRequired("name", name), + checkRequired("number", number), + checkRequired("originProjectVersionId", originProjectVersionId), + checkRequired("subtype", subtype), + checkRequired("suggested", suggested), + checkRequired("thresholds", thresholds).map { it.toImmutable() }, + checkRequired("type", type), archived, - dateArchived, - suggested, - commentCount, + delayWindow, + evaluationWindow, usesMlModel, - usesValidationDataset, - usesTrainingDataset, - usesReferenceDataset, usesProductionData, + usesReferenceDataset, + usesTrainingDataset, + usesValidationDataset, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Threshold.Builder::class) @NoAutoDetect class Threshold + @JsonCreator private constructor( - private val measurement: JsonField, - private val insightName: JsonField, - private val insightParameters: JsonField>, - private val operator: JsonField, - private val value: JsonField, - private val additionalProperties: Map, + @JsonProperty("insightName") + @ExcludeMissing + private val insightName: JsonField = JsonMissing.of(), + @JsonProperty("insightParameters") + @ExcludeMissing + private val insightParameters: JsonField> = JsonMissing.of(), + @JsonProperty("measurement") + @ExcludeMissing + private val measurement: JsonField = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + private val operator: JsonField = JsonMissing.of(), + @JsonProperty("value") + @ExcludeMissing + private val value: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** The measurement to be evaluated. */ - fun measurement(): Optional = - Optional.ofNullable(measurement.getNullable("measurement")) - /** The insight name to be evaluated. */ fun insightName(): Optional = Optional.ofNullable(insightName.getNullable("insightName")) @@ -1008,6 +1152,10 @@ private constructor( fun insightParameters(): Optional> = Optional.ofNullable(insightParameters.getNullable("insightParameters")) + /** The measurement to be evaluated. */ + fun measurement(): Optional = + Optional.ofNullable(measurement.getNullable("measurement")) + /** The operator to be used for the evaluation. */ fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) @@ -1015,35 +1163,45 @@ private constructor( /** The value to be compared. */ fun value(): Optional = Optional.ofNullable(value.getNullable("value")) - /** The measurement to be evaluated. */ - @JsonProperty("measurement") @ExcludeMissing fun _measurement() = measurement - /** The insight name to be evaluated. */ - @JsonProperty("insightName") @ExcludeMissing fun _insightName() = insightName + @JsonProperty("insightName") + @ExcludeMissing + fun _insightName(): JsonField = insightName @JsonProperty("insightParameters") @ExcludeMissing - fun _insightParameters() = insightParameters + fun _insightParameters(): JsonField> = insightParameters + + /** The measurement to be evaluated. */ + @JsonProperty("measurement") + @ExcludeMissing + fun _measurement(): JsonField = measurement /** The operator to be used for the evaluation. */ - @JsonProperty("operator") @ExcludeMissing fun _operator() = operator + @JsonProperty("operator") + @ExcludeMissing + fun _operator(): JsonField = operator /** The value to be compared. */ - @JsonProperty("value") @ExcludeMissing fun _value() = value + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Threshold = apply { - if (!validated) { - measurement() - insightName() - insightParameters() - operator() - value() - validated = true + if (validated) { + return@apply } + + insightName() + insightParameters() + measurement() + operator() + value().ifPresent { it.validate() } + validated = true } fun toBuilder() = Builder().from(this) @@ -1055,39 +1213,27 @@ private constructor( class Builder { - private var measurement: JsonField = JsonMissing.of() private var insightName: JsonField = JsonMissing.of() - private var insightParameters: JsonField> = JsonMissing.of() + private var insightParameters: JsonField>? = null + private var measurement: JsonField = JsonMissing.of() private var operator: JsonField = JsonMissing.of() private var value: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(threshold: Threshold) = apply { - this.measurement = threshold.measurement - this.insightName = threshold.insightName - this.insightParameters = threshold.insightParameters - this.operator = threshold.operator - this.value = threshold.value - additionalProperties(threshold.additionalProperties) - } - - /** The measurement to be evaluated. */ - fun measurement(measurement: String) = measurement(JsonField.of(measurement)) - - /** The measurement to be evaluated. */ - @JsonProperty("measurement") - @ExcludeMissing - fun measurement(measurement: JsonField) = apply { - this.measurement = measurement + insightName = threshold.insightName + insightParameters = threshold.insightParameters.map { it.toMutableList() } + measurement = threshold.measurement + operator = threshold.operator + value = threshold.value + additionalProperties = threshold.additionalProperties.toMutableMap() } /** The insight name to be evaluated. */ fun insightName(insightName: String) = insightName(JsonField.of(insightName)) /** The insight name to be evaluated. */ - @JsonProperty("insightName") - @ExcludeMissing fun insightName(insightName: JsonField) = apply { this.insightName = insightName } @@ -1095,36 +1241,62 @@ private constructor( fun insightParameters(insightParameters: List) = insightParameters(JsonField.of(insightParameters)) - @JsonProperty("insightParameters") - @ExcludeMissing fun insightParameters(insightParameters: JsonField>) = apply { - this.insightParameters = insightParameters + this.insightParameters = insightParameters.map { it.toMutableList() } + } + + fun addInsightParameter(insightParameter: JsonValue) = apply { + insightParameters = + (insightParameters ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(insightParameter) + } + } + + /** The measurement to be evaluated. */ + fun measurement(measurement: String) = measurement(JsonField.of(measurement)) + + /** The measurement to be evaluated. */ + fun measurement(measurement: JsonField) = apply { + this.measurement = measurement } /** The operator to be used for the evaluation. */ fun operator(operator: String) = operator(JsonField.of(operator)) /** The operator to be used for the evaluation. */ - @JsonProperty("operator") - @ExcludeMissing fun operator(operator: JsonField) = apply { this.operator = operator } /** The value to be compared. */ fun value(value: Value) = value(JsonField.of(value)) /** The value to be compared. */ - @JsonProperty("value") - @ExcludeMissing fun value(value: JsonField) = apply { this.value = value } + /** The value to be compared. */ + fun value(number: Double) = value(Value.ofNumber(number)) + + /** The value to be compared. */ + fun value(bool: Boolean) = value(Value.ofBool(bool)) + + /** The value to be compared. */ + fun value(string: String) = value(Value.ofString(string)) + + /** The value to be compared. */ + fun valueOfStrings(strings: List) = value(Value.ofStrings(strings)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1132,17 +1304,26 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Threshold = Threshold( - measurement, insightName, - insightParameters.map { it.toImmutable() }, + (insightParameters ?: JsonMissing.of()).map { it.toImmutable() }, + measurement, operator, value, additionalProperties.toImmutable(), ) } + /** The value to be compared. */ @JsonDeserialize(using = Value.Deserializer::class) @JsonSerialize(using = Value.Serializer::class) class Value @@ -1154,8 +1335,6 @@ private constructor( private val _json: JsonValue? = null, ) { - private var validated: Boolean = false - fun number(): Optional = Optional.ofNullable(number) fun bool(): Optional = Optional.ofNullable(bool) @@ -1192,15 +1371,25 @@ private constructor( } } + private var validated: Boolean = false + fun validate(): Value = apply { - if (!validated) { - if ( - number == null && bool == null && string == null && strings == null - ) { - throw OpenlayerInvalidDataException("Unknown Value: $_json") - } - validated = true + if (validated) { + return@apply } + + accept( + object : Visitor { + override fun visitNumber(number: Double) {} + + override fun visitBool(bool: Boolean) {} + + override fun visitString(string: String) {} + + override fun visitStrings(strings: List) {} + } + ) + validated = true } override fun equals(other: Any?): Boolean { @@ -1295,17 +1484,17 @@ private constructor( return true } - return /* spotless:off */ other is Threshold && measurement == other.measurement && insightName == other.insightName && insightParameters == other.insightParameters && operator == other.operator && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Threshold && insightName == other.insightName && insightParameters == other.insightParameters && measurement == other.measurement && operator == other.operator && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(measurement, insightName, insightParameters, operator, value, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(insightName, insightParameters, measurement, operator, value, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + "Threshold{insightName=$insightName, insightParameters=$insightParameters, measurement=$measurement, operator=$operator, value=$value, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1313,17 +1502,17 @@ private constructor( return true } - return /* spotless:off */ other is Goal && id == other.id && number == other.number && name == other.name && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && description == other.description && evaluationWindow == other.evaluationWindow && delayWindow == other.delayWindow && type == other.type && subtype == other.subtype && creatorId == other.creatorId && originProjectVersionId == other.originProjectVersionId && thresholds == other.thresholds && archived == other.archived && dateArchived == other.dateArchived && suggested == other.suggested && commentCount == other.commentCount && usesMlModel == other.usesMlModel && usesValidationDataset == other.usesValidationDataset && usesTrainingDataset == other.usesTrainingDataset && usesReferenceDataset == other.usesReferenceDataset && usesProductionData == other.usesProductionData && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Goal && id == other.id && commentCount == other.commentCount && creatorId == other.creatorId && dateArchived == other.dateArchived && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && description == other.description && name == other.name && number == other.number && originProjectVersionId == other.originProjectVersionId && subtype == other.subtype && suggested == other.suggested && thresholds == other.thresholds && type == other.type && archived == other.archived && delayWindow == other.delayWindow && evaluationWindow == other.evaluationWindow && usesMlModel == other.usesMlModel && usesProductionData == other.usesProductionData && usesReferenceDataset == other.usesReferenceDataset && usesTrainingDataset == other.usesTrainingDataset && usesValidationDataset == other.usesValidationDataset && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, number, name, dateCreated, dateUpdated, description, evaluationWindow, delayWindow, type, subtype, creatorId, originProjectVersionId, thresholds, archived, dateArchived, suggested, commentCount, usesMlModel, usesValidationDataset, usesTrainingDataset, usesReferenceDataset, usesProductionData, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, commentCount, creatorId, dateArchived, dateCreated, dateUpdated, description, name, number, originProjectVersionId, subtype, suggested, thresholds, type, archived, delayWindow, evaluationWindow, usesMlModel, usesProductionData, usesReferenceDataset, usesTrainingDataset, usesValidationDataset, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Goal{id=$id, number=$number, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, evaluationWindow=$evaluationWindow, delayWindow=$delayWindow, type=$type, subtype=$subtype, creatorId=$creatorId, originProjectVersionId=$originProjectVersionId, thresholds=$thresholds, archived=$archived, dateArchived=$dateArchived, suggested=$suggested, commentCount=$commentCount, usesMlModel=$usesMlModel, usesValidationDataset=$usesValidationDataset, usesTrainingDataset=$usesTrainingDataset, usesReferenceDataset=$usesReferenceDataset, usesProductionData=$usesProductionData, additionalProperties=$additionalProperties}" + "Goal{id=$id, commentCount=$commentCount, creatorId=$creatorId, dateArchived=$dateArchived, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, name=$name, number=$number, originProjectVersionId=$originProjectVersionId, subtype=$subtype, suggested=$suggested, thresholds=$thresholds, type=$type, archived=$archived, delayWindow=$delayWindow, evaluationWindow=$evaluationWindow, usesMlModel=$usesMlModel, usesProductionData=$usesProductionData, usesReferenceDataset=$usesReferenceDataset, usesTrainingDataset=$usesTrainingDataset, usesValidationDataset=$usesValidationDataset, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1331,17 +1520,17 @@ private constructor( return true } - return /* spotless:off */ other is Item && id == other.id && goal == other.goal && goalId == other.goalId && projectVersionId == other.projectVersionId && inferencePipelineId == other.inferencePipelineId && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && dateDataStarts == other.dateDataStarts && dateDataEnds == other.dateDataEnds && status == other.status && statusMessage == other.statusMessage && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Item && id == other.id && dateCreated == other.dateCreated && dateDataEnds == other.dateDataEnds && dateDataStarts == other.dateDataStarts && dateUpdated == other.dateUpdated && inferencePipelineId == other.inferencePipelineId && projectVersionId == other.projectVersionId && status == other.status && statusMessage == other.statusMessage && goal == other.goal && goalId == other.goalId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, goal, goalId, projectVersionId, inferencePipelineId, dateCreated, dateUpdated, dateDataStarts, dateDataEnds, status, statusMessage, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dateCreated, dateDataEnds, dateDataStarts, dateUpdated, inferencePipelineId, projectVersionId, status, statusMessage, goal, goalId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Item{id=$id, goal=$goal, goalId=$goalId, projectVersionId=$projectVersionId, inferencePipelineId=$inferencePipelineId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, dateDataStarts=$dateDataStarts, dateDataEnds=$dateDataEnds, status=$status, statusMessage=$statusMessage, additionalProperties=$additionalProperties}" + "Item{id=$id, dateCreated=$dateCreated, dateDataEnds=$dateDataEnds, dateDataStarts=$dateDataStarts, dateUpdated=$dateUpdated, inferencePipelineId=$inferencePipelineId, projectVersionId=$projectVersionId, status=$status, statusMessage=$statusMessage, goal=$goal, goalId=$goalId, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt index a24bf98f..d1920ba8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt @@ -4,6 +4,7 @@ package com.openlayer.api.models import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.core.JsonGenerator import com.fasterxml.jackson.core.ObjectCodec @@ -19,44 +20,46 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.getOrThrow import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects import java.util.Optional +/** Publish an inference data point to an inference pipeline. */ class InferencePipelineDataStreamParams constructor( private val inferencePipelineId: String, - private val config: Config, - private val rows: List, + private val body: InferencePipelineDataStreamBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun inferencePipelineId(): String = inferencePipelineId - fun config(): Config = config + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + fun config(): Config = body.config() - fun rows(): List = rows + /** A list of inference data points with inputs and outputs */ + fun rows(): List = body.rows() + + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + fun _config(): JsonField = body._config() + + /** A list of inference data points with inputs and outputs */ + fun _rows(): JsonField> = body._rows() + + fun _additionalBodyProperties(): Map = body._additionalProperties() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): InferencePipelineDataStreamBody { - return InferencePipelineDataStreamBody( - config, - rows, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): InferencePipelineDataStreamBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -69,25 +72,48 @@ constructor( } } - @JsonDeserialize(builder = InferencePipelineDataStreamBody.Builder::class) @NoAutoDetect class InferencePipelineDataStreamBody + @JsonCreator internal constructor( - private val config: Config?, - private val rows: List?, - private val additionalProperties: Map, + @JsonProperty("config") + @ExcludeMissing + private val config: JsonField = JsonMissing.of(), + @JsonProperty("rows") + @ExcludeMissing + private val rows: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ - @JsonProperty("config") fun config(): Config? = config + fun config(): Config = config.getRequired("config") /** A list of inference data points with inputs and outputs */ - @JsonProperty("rows") fun rows(): List? = rows + fun rows(): List = rows.getRequired("rows") + + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + @JsonProperty("config") @ExcludeMissing fun _config(): JsonField = config + + /** A list of inference data points with inputs and outputs */ + @JsonProperty("rows") @ExcludeMissing fun _rows(): JsonField> = rows @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + + fun validate(): InferencePipelineDataStreamBody = apply { + if (validated) { + return@apply + } + + config().validate() + rows().forEach { it.validate() } + validated = true + } + fun toBuilder() = Builder().from(this) companion object { @@ -97,44 +123,97 @@ constructor( class Builder { - private var config: Config? = null - private var rows: List? = null + private var config: JsonField? = null + private var rows: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(inferencePipelineDataStreamBody: InferencePipelineDataStreamBody) = apply { - this.config = inferencePipelineDataStreamBody.config - this.rows = inferencePipelineDataStreamBody.rows - additionalProperties(inferencePipelineDataStreamBody.additionalProperties) + config = inferencePipelineDataStreamBody.config + rows = inferencePipelineDataStreamBody.rows.map { it.toMutableList() } + additionalProperties = + inferencePipelineDataStreamBody.additionalProperties.toMutableMap() } /** * Configuration for the data stream. Depends on your **Openlayer project task type**. */ - @JsonProperty("config") fun config(config: Config) = apply { this.config = config } + fun config(config: Config) = config(JsonField.of(config)) + + /** + * Configuration for the data stream. Depends on your **Openlayer project task type**. + */ + fun config(config: JsonField) = apply { this.config = config } + + /** + * Configuration for the data stream. Depends on your **Openlayer project task type**. + */ + fun config(llmData: Config.LlmData) = config(Config.ofLlmData(llmData)) + + /** + * Configuration for the data stream. Depends on your **Openlayer project task type**. + */ + fun config(tabularClassificationData: Config.TabularClassificationData) = + config(Config.ofTabularClassificationData(tabularClassificationData)) + + /** + * Configuration for the data stream. Depends on your **Openlayer project task type**. + */ + fun config(tabularRegressionData: Config.TabularRegressionData) = + config(Config.ofTabularRegressionData(tabularRegressionData)) + + /** + * Configuration for the data stream. Depends on your **Openlayer project task type**. + */ + fun config(textClassificationData: Config.TextClassificationData) = + config(Config.ofTextClassificationData(textClassificationData)) + + /** A list of inference data points with inputs and outputs */ + fun rows(rows: List) = rows(JsonField.of(rows)) /** A list of inference data points with inputs and outputs */ - @JsonProperty("rows") fun rows(rows: List) = apply { this.rows = rows } + fun rows(rows: JsonField>) = apply { + this.rows = rows.map { it.toMutableList() } + } + + /** A list of inference data points with inputs and outputs */ + fun addRow(row: Row) = apply { + rows = + (rows ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(row) + } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): InferencePipelineDataStreamBody = InferencePipelineDataStreamBody( - checkNotNull(config) { "`config` is required but was not set" }, - checkNotNull(rows) { "`rows` is required but was not set" }.toImmutable(), + checkRequired("config", config), + checkRequired("rows", rows).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -168,23 +247,19 @@ constructor( class Builder { private var inferencePipelineId: String? = null - private var config: Config? = null - private var rows: MutableList = mutableListOf() + private var body: InferencePipelineDataStreamBody.Builder = + InferencePipelineDataStreamBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(inferencePipelineDataStreamParams: InferencePipelineDataStreamParams) = apply { inferencePipelineId = inferencePipelineDataStreamParams.inferencePipelineId - config = inferencePipelineDataStreamParams.config - rows = inferencePipelineDataStreamParams.rows.toMutableList() + body = inferencePipelineDataStreamParams.body.toBuilder() additionalHeaders = inferencePipelineDataStreamParams.additionalHeaders.toBuilder() additionalQueryParams = inferencePipelineDataStreamParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - inferencePipelineDataStreamParams.additionalBodyProperties.toMutableMap() } fun inferencePipelineId(inferencePipelineId: String) = apply { @@ -192,34 +267,56 @@ constructor( } /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ - fun config(config: Config) = apply { this.config = config } + fun config(config: Config) = apply { body.config(config) } + + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + fun config(config: JsonField) = apply { body.config(config) } /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ - fun config(llmData: Config.LlmData) = apply { this.config = Config.ofLlmData(llmData) } + fun config(llmData: Config.LlmData) = apply { body.config(llmData) } /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ fun config(tabularClassificationData: Config.TabularClassificationData) = apply { - this.config = Config.ofTabularClassificationData(tabularClassificationData) + body.config(tabularClassificationData) } /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ fun config(tabularRegressionData: Config.TabularRegressionData) = apply { - this.config = Config.ofTabularRegressionData(tabularRegressionData) + body.config(tabularRegressionData) } /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ fun config(textClassificationData: Config.TextClassificationData) = apply { - this.config = Config.ofTextClassificationData(textClassificationData) + body.config(textClassificationData) } /** A list of inference data points with inputs and outputs */ - fun rows(rows: List) = apply { - this.rows.clear() - this.rows.addAll(rows) - } + fun rows(rows: List) = apply { body.rows(rows) } + + /** A list of inference data points with inputs and outputs */ + fun rows(rows: JsonField>) = apply { body.rows(rows) } /** A list of inference data points with inputs and outputs */ - fun addRow(row: Row) = apply { this.rows.add(row) } + fun addRow(row: Row) = apply { body.addRow(row) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -319,41 +416,16 @@ constructor( additionalQueryParams.removeAll(keys) } - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) - } - fun build(): InferencePipelineDataStreamParams = InferencePipelineDataStreamParams( - checkNotNull(inferencePipelineId) { - "`inferencePipelineId` is required but was not set" - }, - checkNotNull(config) { "`config` is required but was not set" }, - rows.toImmutable(), + checkRequired("inferencePipelineId", inferencePipelineId), + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ @JsonDeserialize(using = Config.Deserializer::class) @JsonSerialize(using = Config.Serializer::class) class Config @@ -365,8 +437,6 @@ constructor( private val _json: JsonValue? = null, ) { - private var validated: Boolean = false - fun llmData(): Optional = Optional.ofNullable(llmData) fun tabularClassificationData(): Optional = @@ -412,22 +482,39 @@ constructor( } } + private var validated: Boolean = false + fun validate(): Config = apply { - if (!validated) { - if ( - llmData == null && - tabularClassificationData == null && - tabularRegressionData == null && - textClassificationData == null - ) { - throw OpenlayerInvalidDataException("Unknown Config: $_json") - } - llmData?.validate() - tabularClassificationData?.validate() - tabularRegressionData?.validate() - textClassificationData?.validate() - validated = true + if (validated) { + return@apply } + + accept( + object : Visitor { + override fun visitLlmData(llmData: LlmData) { + llmData.validate() + } + + override fun visitTabularClassificationData( + tabularClassificationData: TabularClassificationData + ) { + tabularClassificationData.validate() + } + + override fun visitTabularRegressionData( + tabularRegressionData: TabularRegressionData + ) { + tabularRegressionData.validate() + } + + override fun visitTextClassificationData( + textClassificationData: TextClassificationData + ) { + textClassificationData.validate() + } + } + ) + validated = true } override fun equals(other: Any?): Boolean { @@ -534,30 +621,52 @@ constructor( } } - @JsonDeserialize(builder = LlmData.Builder::class) @NoAutoDetect class LlmData + @JsonCreator private constructor( - private val numOfTokenColumnName: JsonField, - private val contextColumnName: JsonField, - private val costColumnName: JsonField, - private val groundTruthColumnName: JsonField, - private val inferenceIdColumnName: JsonField, - private val inputVariableNames: JsonField>, - private val latencyColumnName: JsonField, - private val metadata: JsonValue, - private val outputColumnName: JsonField, - private val prompt: JsonField>, - private val questionColumnName: JsonField, - private val timestampColumnName: JsonField, - private val additionalProperties: Map, + @JsonProperty("outputColumnName") + @ExcludeMissing + private val outputColumnName: JsonField = JsonMissing.of(), + @JsonProperty("contextColumnName") + @ExcludeMissing + private val contextColumnName: JsonField = JsonMissing.of(), + @JsonProperty("costColumnName") + @ExcludeMissing + private val costColumnName: JsonField = JsonMissing.of(), + @JsonProperty("groundTruthColumnName") + @ExcludeMissing + private val groundTruthColumnName: JsonField = JsonMissing.of(), + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + private val inferenceIdColumnName: JsonField = JsonMissing.of(), + @JsonProperty("inputVariableNames") + @ExcludeMissing + private val inputVariableNames: JsonField> = JsonMissing.of(), + @JsonProperty("latencyColumnName") + @ExcludeMissing + private val latencyColumnName: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonValue = JsonMissing.of(), + @JsonProperty("numOfTokenColumnName") + @ExcludeMissing + private val numOfTokenColumnName: JsonField = JsonMissing.of(), + @JsonProperty("prompt") + @ExcludeMissing + private val prompt: JsonField> = JsonMissing.of(), + @JsonProperty("questionColumnName") + @ExcludeMissing + private val questionColumnName: JsonField = JsonMissing.of(), + @JsonProperty("timestampColumnName") + @ExcludeMissing + private val timestampColumnName: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** Name of the column with the total number of tokens. */ - fun numOfTokenColumnName(): Optional = - Optional.ofNullable(numOfTokenColumnName.getNullable("numOfTokenColumnName")) + /** Name of the column with the model outputs. */ + fun outputColumnName(): String = outputColumnName.getRequired("outputColumnName") /** * Name of the column with the context retrieved. Applies to RAG use cases. Providing @@ -589,8 +698,12 @@ constructor( fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) - /** Name of the column with the model outputs. */ - fun outputColumnName(): String = outputColumnName.getRequired("outputColumnName") + /** Object with metadata. */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata + + /** Name of the column with the total number of tokens. */ + fun numOfTokenColumnName(): Optional = + Optional.ofNullable(numOfTokenColumnName.getNullable("numOfTokenColumnName")) /** Prompt for the LLM. */ fun prompt(): Optional> = Optional.ofNullable(prompt.getNullable("prompt")) @@ -609,10 +722,10 @@ constructor( fun timestampColumnName(): Optional = Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) - /** Name of the column with the total number of tokens. */ - @JsonProperty("numOfTokenColumnName") + /** Name of the column with the model outputs. */ + @JsonProperty("outputColumnName") @ExcludeMissing - fun _numOfTokenColumnName() = numOfTokenColumnName + fun _outputColumnName(): JsonField = outputColumnName /** * Name of the column with the context retrieved. Applies to RAG use cases. Providing @@ -620,15 +733,17 @@ constructor( */ @JsonProperty("contextColumnName") @ExcludeMissing - fun _contextColumnName() = contextColumnName + fun _contextColumnName(): JsonField = contextColumnName /** Name of the column with the cost associated with each row. */ - @JsonProperty("costColumnName") @ExcludeMissing fun _costColumnName() = costColumnName + @JsonProperty("costColumnName") + @ExcludeMissing + fun _costColumnName(): JsonField = costColumnName /** Name of the column with the ground truths. */ @JsonProperty("groundTruthColumnName") @ExcludeMissing - fun _groundTruthColumnName() = groundTruthColumnName + fun _groundTruthColumnName(): JsonField = groundTruthColumnName /** * Name of the column with the inference ids. This is useful if you want to update rows @@ -636,28 +751,25 @@ constructor( */ @JsonProperty("inferenceIdColumnName") @ExcludeMissing - fun _inferenceIdColumnName() = inferenceIdColumnName + fun _inferenceIdColumnName(): JsonField = inferenceIdColumnName /** Array of input variable names. Each input variable should be a dataset column. */ @JsonProperty("inputVariableNames") @ExcludeMissing - fun _inputVariableNames() = inputVariableNames + fun _inputVariableNames(): JsonField> = inputVariableNames /** Name of the column with the latencies. */ @JsonProperty("latencyColumnName") @ExcludeMissing - fun _latencyColumnName() = latencyColumnName + fun _latencyColumnName(): JsonField = latencyColumnName - /** Object with metadata. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata - - /** Name of the column with the model outputs. */ - @JsonProperty("outputColumnName") + /** Name of the column with the total number of tokens. */ + @JsonProperty("numOfTokenColumnName") @ExcludeMissing - fun _outputColumnName() = outputColumnName + fun _numOfTokenColumnName(): JsonField = numOfTokenColumnName /** Prompt for the LLM. */ - @JsonProperty("prompt") @ExcludeMissing fun _prompt() = prompt + @JsonProperty("prompt") @ExcludeMissing fun _prompt(): JsonField> = prompt /** * Name of the column with the questions. Applies to RAG use cases. Providing the @@ -665,7 +777,7 @@ constructor( */ @JsonProperty("questionColumnName") @ExcludeMissing - fun _questionColumnName() = questionColumnName + fun _questionColumnName(): JsonField = questionColumnName /** * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not @@ -673,27 +785,31 @@ constructor( */ @JsonProperty("timestampColumnName") @ExcludeMissing - fun _timestampColumnName() = timestampColumnName + fun _timestampColumnName(): JsonField = timestampColumnName @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): LlmData = apply { - if (!validated) { - numOfTokenColumnName() - contextColumnName() - costColumnName() - groundTruthColumnName() - inferenceIdColumnName() - inputVariableNames() - latencyColumnName() - outputColumnName() - prompt().map { it.forEach { it.validate() } } - questionColumnName() - timestampColumnName() - validated = true + if (validated) { + return@apply } + + outputColumnName() + contextColumnName() + costColumnName() + groundTruthColumnName() + inferenceIdColumnName() + inputVariableNames() + latencyColumnName() + numOfTokenColumnName() + prompt().ifPresent { it.forEach { it.validate() } } + questionColumnName() + timestampColumnName() + validated = true } fun toBuilder() = Builder().from(this) @@ -705,46 +821,44 @@ constructor( class Builder { - private var numOfTokenColumnName: JsonField = JsonMissing.of() + private var outputColumnName: JsonField? = null private var contextColumnName: JsonField = JsonMissing.of() private var costColumnName: JsonField = JsonMissing.of() private var groundTruthColumnName: JsonField = JsonMissing.of() private var inferenceIdColumnName: JsonField = JsonMissing.of() - private var inputVariableNames: JsonField> = JsonMissing.of() + private var inputVariableNames: JsonField>? = null private var latencyColumnName: JsonField = JsonMissing.of() private var metadata: JsonValue = JsonMissing.of() - private var outputColumnName: JsonField = JsonMissing.of() - private var prompt: JsonField> = JsonMissing.of() + private var numOfTokenColumnName: JsonField = JsonMissing.of() + private var prompt: JsonField>? = null private var questionColumnName: JsonField = JsonMissing.of() private var timestampColumnName: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(llmData: LlmData) = apply { - this.numOfTokenColumnName = llmData.numOfTokenColumnName - this.contextColumnName = llmData.contextColumnName - this.costColumnName = llmData.costColumnName - this.groundTruthColumnName = llmData.groundTruthColumnName - this.inferenceIdColumnName = llmData.inferenceIdColumnName - this.inputVariableNames = llmData.inputVariableNames - this.latencyColumnName = llmData.latencyColumnName - this.metadata = llmData.metadata - this.outputColumnName = llmData.outputColumnName - this.prompt = llmData.prompt - this.questionColumnName = llmData.questionColumnName - this.timestampColumnName = llmData.timestampColumnName - additionalProperties(llmData.additionalProperties) + outputColumnName = llmData.outputColumnName + contextColumnName = llmData.contextColumnName + costColumnName = llmData.costColumnName + groundTruthColumnName = llmData.groundTruthColumnName + inferenceIdColumnName = llmData.inferenceIdColumnName + inputVariableNames = llmData.inputVariableNames.map { it.toMutableList() } + latencyColumnName = llmData.latencyColumnName + metadata = llmData.metadata + numOfTokenColumnName = llmData.numOfTokenColumnName + prompt = llmData.prompt.map { it.toMutableList() } + questionColumnName = llmData.questionColumnName + timestampColumnName = llmData.timestampColumnName + additionalProperties = llmData.additionalProperties.toMutableMap() } - /** Name of the column with the total number of tokens. */ - fun numOfTokenColumnName(numOfTokenColumnName: String) = - numOfTokenColumnName(JsonField.of(numOfTokenColumnName)) + /** Name of the column with the model outputs. */ + fun outputColumnName(outputColumnName: String) = + outputColumnName(JsonField.of(outputColumnName)) - /** Name of the column with the total number of tokens. */ - @JsonProperty("numOfTokenColumnName") - @ExcludeMissing - fun numOfTokenColumnName(numOfTokenColumnName: JsonField) = apply { - this.numOfTokenColumnName = numOfTokenColumnName + /** Name of the column with the model outputs. */ + fun outputColumnName(outputColumnName: JsonField) = apply { + this.outputColumnName = outputColumnName } /** @@ -758,8 +872,6 @@ constructor( * Name of the column with the context retrieved. Applies to RAG use cases. * Providing the context enables RAG-specific metrics. */ - @JsonProperty("contextColumnName") - @ExcludeMissing fun contextColumnName(contextColumnName: JsonField) = apply { this.contextColumnName = contextColumnName } @@ -769,8 +881,6 @@ constructor( costColumnName(JsonField.of(costColumnName)) /** Name of the column with the cost associated with each row. */ - @JsonProperty("costColumnName") - @ExcludeMissing fun costColumnName(costColumnName: JsonField) = apply { this.costColumnName = costColumnName } @@ -780,8 +890,6 @@ constructor( groundTruthColumnName(JsonField.of(groundTruthColumnName)) /** Name of the column with the ground truths. */ - @JsonProperty("groundTruthColumnName") - @ExcludeMissing fun groundTruthColumnName(groundTruthColumnName: JsonField) = apply { this.groundTruthColumnName = groundTruthColumnName } @@ -799,8 +907,6 @@ constructor( * rows at a later point in time. If not provided, a unique id is generated by * Openlayer. */ - @JsonProperty("inferenceIdColumnName") - @ExcludeMissing fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { this.inferenceIdColumnName = inferenceIdColumnName } @@ -814,10 +920,24 @@ constructor( /** * Array of input variable names. Each input variable should be a dataset column. */ - @JsonProperty("inputVariableNames") - @ExcludeMissing fun inputVariableNames(inputVariableNames: JsonField>) = apply { - this.inputVariableNames = inputVariableNames + this.inputVariableNames = inputVariableNames.map { it.toMutableList() } + } + + /** + * Array of input variable names. Each input variable should be a dataset column. + */ + fun addInputVariableName(inputVariableName: String) = apply { + inputVariableNames = + (inputVariableNames ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(inputVariableName) + } } /** Name of the column with the latencies. */ @@ -825,35 +945,47 @@ constructor( latencyColumnName(JsonField.of(latencyColumnName)) /** Name of the column with the latencies. */ - @JsonProperty("latencyColumnName") - @ExcludeMissing fun latencyColumnName(latencyColumnName: JsonField) = apply { this.latencyColumnName = latencyColumnName } /** Object with metadata. */ - @JsonProperty("metadata") - @ExcludeMissing fun metadata(metadata: JsonValue) = apply { this.metadata = metadata } - /** Name of the column with the model outputs. */ - fun outputColumnName(outputColumnName: String) = - outputColumnName(JsonField.of(outputColumnName)) + /** Name of the column with the total number of tokens. */ + fun numOfTokenColumnName(numOfTokenColumnName: String?) = + numOfTokenColumnName(JsonField.ofNullable(numOfTokenColumnName)) - /** Name of the column with the model outputs. */ - @JsonProperty("outputColumnName") - @ExcludeMissing - fun outputColumnName(outputColumnName: JsonField) = apply { - this.outputColumnName = outputColumnName + /** Name of the column with the total number of tokens. */ + fun numOfTokenColumnName(numOfTokenColumnName: Optional) = + numOfTokenColumnName(numOfTokenColumnName.orElse(null)) + + /** Name of the column with the total number of tokens. */ + fun numOfTokenColumnName(numOfTokenColumnName: JsonField) = apply { + this.numOfTokenColumnName = numOfTokenColumnName } /** Prompt for the LLM. */ fun prompt(prompt: List) = prompt(JsonField.of(prompt)) /** Prompt for the LLM. */ - @JsonProperty("prompt") - @ExcludeMissing - fun prompt(prompt: JsonField>) = apply { this.prompt = prompt } + fun prompt(prompt: JsonField>) = apply { + this.prompt = prompt.map { it.toMutableList() } + } + + /** Prompt for the LLM. */ + fun addPrompt(prompt: Prompt) = apply { + this.prompt = + (this.prompt ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(prompt) + } + } /** * Name of the column with the questions. Applies to RAG use cases. Providing the @@ -866,8 +998,6 @@ constructor( * Name of the column with the questions. Applies to RAG use cases. Providing the * question enables RAG-specific metrics. */ - @JsonProperty("questionColumnName") - @ExcludeMissing fun questionColumnName(questionColumnName: JsonField) = apply { this.questionColumnName = questionColumnName } @@ -883,20 +1013,17 @@ constructor( * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If * not provided, the upload timestamp is used. */ - @JsonProperty("timestampColumnName") - @ExcludeMissing fun timestampColumnName(timestampColumnName: JsonField) = apply { this.timestampColumnName = timestampColumnName } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -904,58 +1031,73 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): LlmData = LlmData( - numOfTokenColumnName, + checkRequired("outputColumnName", outputColumnName), contextColumnName, costColumnName, groundTruthColumnName, inferenceIdColumnName, - inputVariableNames.map { it.toImmutable() }, + (inputVariableNames ?: JsonMissing.of()).map { it.toImmutable() }, latencyColumnName, metadata, - outputColumnName, - prompt.map { it.toImmutable() }, + numOfTokenColumnName, + (prompt ?: JsonMissing.of()).map { it.toImmutable() }, questionColumnName, timestampColumnName, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Prompt.Builder::class) @NoAutoDetect class Prompt + @JsonCreator private constructor( - private val role: JsonField, - private val content: JsonField, - private val additionalProperties: Map, + @JsonProperty("content") + @ExcludeMissing + private val content: JsonField = JsonMissing.of(), + @JsonProperty("role") + @ExcludeMissing + private val role: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** Role of the prompt. */ - fun role(): Optional = Optional.ofNullable(role.getNullable("role")) - /** Content of the prompt. */ fun content(): Optional = Optional.ofNullable(content.getNullable("content")) /** Role of the prompt. */ - @JsonProperty("role") @ExcludeMissing fun _role() = role + fun role(): Optional = Optional.ofNullable(role.getNullable("role")) /** Content of the prompt. */ - @JsonProperty("content") @ExcludeMissing fun _content() = content + @JsonProperty("content") @ExcludeMissing fun _content(): JsonField = content + + /** Role of the prompt. */ + @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Prompt = apply { - if (!validated) { - role() - content() - validated = true + if (validated) { + return@apply } + + content() + role() + validated = true } fun toBuilder() = Builder().from(this) @@ -967,41 +1109,36 @@ constructor( class Builder { - private var role: JsonField = JsonMissing.of() private var content: JsonField = JsonMissing.of() + private var role: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(prompt: Prompt) = apply { - this.role = prompt.role - this.content = prompt.content - additionalProperties(prompt.additionalProperties) + content = prompt.content + role = prompt.role + additionalProperties = prompt.additionalProperties.toMutableMap() } - /** Role of the prompt. */ - fun role(role: String) = role(JsonField.of(role)) - - /** Role of the prompt. */ - @JsonProperty("role") - @ExcludeMissing - fun role(role: JsonField) = apply { this.role = role } - /** Content of the prompt. */ fun content(content: String) = content(JsonField.of(content)) /** Content of the prompt. */ - @JsonProperty("content") - @ExcludeMissing fun content(content: JsonField) = apply { this.content = content } + /** Role of the prompt. */ + fun role(role: String) = role(JsonField.of(role)) + + /** Role of the prompt. */ + fun role(role: JsonField) = apply { this.role = role } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1009,10 +1146,18 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Prompt = Prompt( - role, content, + role, additionalProperties.toImmutable(), ) } @@ -1022,17 +1167,17 @@ constructor( return true } - return /* spotless:off */ other is Prompt && role == other.role && content == other.content && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Prompt && content == other.content && role == other.role && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(role, content, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(content, role, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Prompt{role=$role, content=$content, additionalProperties=$additionalProperties}" + "Prompt{content=$content, role=$role, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1040,37 +1185,62 @@ constructor( return true } - return /* spotless:off */ other is LlmData && numOfTokenColumnName == other.numOfTokenColumnName && contextColumnName == other.contextColumnName && costColumnName == other.costColumnName && groundTruthColumnName == other.groundTruthColumnName && inferenceIdColumnName == other.inferenceIdColumnName && inputVariableNames == other.inputVariableNames && latencyColumnName == other.latencyColumnName && metadata == other.metadata && outputColumnName == other.outputColumnName && prompt == other.prompt && questionColumnName == other.questionColumnName && timestampColumnName == other.timestampColumnName && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is LlmData && outputColumnName == other.outputColumnName && contextColumnName == other.contextColumnName && costColumnName == other.costColumnName && groundTruthColumnName == other.groundTruthColumnName && inferenceIdColumnName == other.inferenceIdColumnName && inputVariableNames == other.inputVariableNames && latencyColumnName == other.latencyColumnName && metadata == other.metadata && numOfTokenColumnName == other.numOfTokenColumnName && prompt == other.prompt && questionColumnName == other.questionColumnName && timestampColumnName == other.timestampColumnName && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(numOfTokenColumnName, contextColumnName, costColumnName, groundTruthColumnName, inferenceIdColumnName, inputVariableNames, latencyColumnName, metadata, outputColumnName, prompt, questionColumnName, timestampColumnName, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(outputColumnName, contextColumnName, costColumnName, groundTruthColumnName, inferenceIdColumnName, inputVariableNames, latencyColumnName, metadata, numOfTokenColumnName, prompt, questionColumnName, timestampColumnName, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "LlmData{numOfTokenColumnName=$numOfTokenColumnName, contextColumnName=$contextColumnName, costColumnName=$costColumnName, groundTruthColumnName=$groundTruthColumnName, inferenceIdColumnName=$inferenceIdColumnName, inputVariableNames=$inputVariableNames, latencyColumnName=$latencyColumnName, metadata=$metadata, outputColumnName=$outputColumnName, prompt=$prompt, questionColumnName=$questionColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" + "LlmData{outputColumnName=$outputColumnName, contextColumnName=$contextColumnName, costColumnName=$costColumnName, groundTruthColumnName=$groundTruthColumnName, inferenceIdColumnName=$inferenceIdColumnName, inputVariableNames=$inputVariableNames, latencyColumnName=$latencyColumnName, metadata=$metadata, numOfTokenColumnName=$numOfTokenColumnName, prompt=$prompt, questionColumnName=$questionColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = TabularClassificationData.Builder::class) @NoAutoDetect class TabularClassificationData + @JsonCreator private constructor( - private val categoricalFeatureNames: JsonField>, - private val classNames: JsonField>, - private val featureNames: JsonField>, - private val inferenceIdColumnName: JsonField, - private val labelColumnName: JsonField, - private val latencyColumnName: JsonField, - private val metadata: JsonValue, - private val predictionsColumnName: JsonField, - private val predictionScoresColumnName: JsonField, - private val timestampColumnName: JsonField, - private val additionalProperties: Map, + @JsonProperty("classNames") + @ExcludeMissing + private val classNames: JsonField> = JsonMissing.of(), + @JsonProperty("categoricalFeatureNames") + @ExcludeMissing + private val categoricalFeatureNames: JsonField> = JsonMissing.of(), + @JsonProperty("featureNames") + @ExcludeMissing + private val featureNames: JsonField> = JsonMissing.of(), + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + private val inferenceIdColumnName: JsonField = JsonMissing.of(), + @JsonProperty("labelColumnName") + @ExcludeMissing + private val labelColumnName: JsonField = JsonMissing.of(), + @JsonProperty("latencyColumnName") + @ExcludeMissing + private val latencyColumnName: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonValue = JsonMissing.of(), + @JsonProperty("predictionsColumnName") + @ExcludeMissing + private val predictionsColumnName: JsonField = JsonMissing.of(), + @JsonProperty("predictionScoresColumnName") + @ExcludeMissing + private val predictionScoresColumnName: JsonField = JsonMissing.of(), + @JsonProperty("timestampColumnName") + @ExcludeMissing + private val timestampColumnName: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + /** + * List of class names indexed by label integer in the dataset. E.g. + * ["Retained", "Exited"] when 0, 1 are in your label column. + */ + fun classNames(): List = classNames.getRequired("classNames") /** * Array with the names of all categorical features in the dataset. E.g. @@ -1079,12 +1249,6 @@ constructor( fun categoricalFeatureNames(): Optional> = Optional.ofNullable(categoricalFeatureNames.getNullable("categoricalFeatureNames")) - /** - * List of class names indexed by label integer in the dataset. E.g. - * ["Retained", "Exited"] when 0, 1 are in your label column. - */ - fun classNames(): List = classNames.getRequired("classNames") - /** Array with all input feature names. */ fun featureNames(): Optional> = Optional.ofNullable(featureNames.getNullable("featureNames")) @@ -1107,6 +1271,9 @@ constructor( fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + /** Object with metadata. */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata + /** Name of the column with the model's predictions as **zero-indexed integers**. */ fun predictionsColumnName(): Optional = Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) @@ -1127,21 +1294,25 @@ constructor( Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Age", "Geography"]. + * List of class names indexed by label integer in the dataset. E.g. + * ["Retained", "Exited"] when 0, 1 are in your label column. */ - @JsonProperty("categoricalFeatureNames") + @JsonProperty("classNames") @ExcludeMissing - fun _categoricalFeatureNames() = categoricalFeatureNames + fun _classNames(): JsonField> = classNames /** - * List of class names indexed by label integer in the dataset. E.g. - * ["Retained", "Exited"] when 0, 1 are in your label column. + * Array with the names of all categorical features in the dataset. E.g. + * ["Age", "Geography"]. */ - @JsonProperty("classNames") @ExcludeMissing fun _classNames() = classNames + @JsonProperty("categoricalFeatureNames") + @ExcludeMissing + fun _categoricalFeatureNames(): JsonField> = categoricalFeatureNames /** Array with all input feature names. */ - @JsonProperty("featureNames") @ExcludeMissing fun _featureNames() = featureNames + @JsonProperty("featureNames") + @ExcludeMissing + fun _featureNames(): JsonField> = featureNames /** * Name of the column with the inference ids. This is useful if you want to update rows @@ -1149,7 +1320,7 @@ constructor( */ @JsonProperty("inferenceIdColumnName") @ExcludeMissing - fun _inferenceIdColumnName() = inferenceIdColumnName + fun _inferenceIdColumnName(): JsonField = inferenceIdColumnName /** * Name of the column with the labels. The data in this column must be **zero-indexed @@ -1157,27 +1328,24 @@ constructor( */ @JsonProperty("labelColumnName") @ExcludeMissing - fun _labelColumnName() = labelColumnName + fun _labelColumnName(): JsonField = labelColumnName /** Name of the column with the latencies. */ @JsonProperty("latencyColumnName") @ExcludeMissing - fun _latencyColumnName() = latencyColumnName - - /** Object with metadata. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + fun _latencyColumnName(): JsonField = latencyColumnName /** Name of the column with the model's predictions as **zero-indexed integers**. */ @JsonProperty("predictionsColumnName") @ExcludeMissing - fun _predictionsColumnName() = predictionsColumnName + fun _predictionsColumnName(): JsonField = predictionsColumnName /** * Name of the column with the model's predictions as **lists of class probabilities**. */ @JsonProperty("predictionScoresColumnName") @ExcludeMissing - fun _predictionScoresColumnName() = predictionScoresColumnName + fun _predictionScoresColumnName(): JsonField = predictionScoresColumnName /** * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not @@ -1185,25 +1353,29 @@ constructor( */ @JsonProperty("timestampColumnName") @ExcludeMissing - fun _timestampColumnName() = timestampColumnName + fun _timestampColumnName(): JsonField = timestampColumnName @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): TabularClassificationData = apply { - if (!validated) { - categoricalFeatureNames() - classNames() - featureNames() - inferenceIdColumnName() - labelColumnName() - latencyColumnName() - predictionsColumnName() - predictionScoresColumnName() - timestampColumnName() - validated = true + if (validated) { + return@apply } + + classNames() + categoricalFeatureNames() + featureNames() + inferenceIdColumnName() + labelColumnName() + latencyColumnName() + predictionsColumnName() + predictionScoresColumnName() + timestampColumnName() + validated = true } fun toBuilder() = Builder().from(this) @@ -1215,9 +1387,9 @@ constructor( class Builder { - private var categoricalFeatureNames: JsonField> = JsonMissing.of() - private var classNames: JsonField> = JsonMissing.of() - private var featureNames: JsonField> = JsonMissing.of() + private var classNames: JsonField>? = null + private var categoricalFeatureNames: JsonField>? = null + private var featureNames: JsonField>? = null private var inferenceIdColumnName: JsonField = JsonMissing.of() private var labelColumnName: JsonField = JsonMissing.of() private var latencyColumnName: JsonField = JsonMissing.of() @@ -1229,18 +1401,51 @@ constructor( @JvmSynthetic internal fun from(tabularClassificationData: TabularClassificationData) = apply { - this.categoricalFeatureNames = tabularClassificationData.categoricalFeatureNames - this.classNames = tabularClassificationData.classNames - this.featureNames = tabularClassificationData.featureNames - this.inferenceIdColumnName = tabularClassificationData.inferenceIdColumnName - this.labelColumnName = tabularClassificationData.labelColumnName - this.latencyColumnName = tabularClassificationData.latencyColumnName - this.metadata = tabularClassificationData.metadata - this.predictionsColumnName = tabularClassificationData.predictionsColumnName - this.predictionScoresColumnName = + classNames = tabularClassificationData.classNames.map { it.toMutableList() } + categoricalFeatureNames = + tabularClassificationData.categoricalFeatureNames.map { it.toMutableList() } + featureNames = tabularClassificationData.featureNames.map { it.toMutableList() } + inferenceIdColumnName = tabularClassificationData.inferenceIdColumnName + labelColumnName = tabularClassificationData.labelColumnName + latencyColumnName = tabularClassificationData.latencyColumnName + metadata = tabularClassificationData.metadata + predictionsColumnName = tabularClassificationData.predictionsColumnName + predictionScoresColumnName = tabularClassificationData.predictionScoresColumnName - this.timestampColumnName = tabularClassificationData.timestampColumnName - additionalProperties(tabularClassificationData.additionalProperties) + timestampColumnName = tabularClassificationData.timestampColumnName + additionalProperties = + tabularClassificationData.additionalProperties.toMutableMap() + } + + /** + * List of class names indexed by label integer in the dataset. E.g. + * ["Retained", "Exited"] when 0, 1 are in your label column. + */ + fun classNames(classNames: List) = classNames(JsonField.of(classNames)) + + /** + * List of class names indexed by label integer in the dataset. E.g. + * ["Retained", "Exited"] when 0, 1 are in your label column. + */ + fun classNames(classNames: JsonField>) = apply { + this.classNames = classNames.map { it.toMutableList() } + } + + /** + * List of class names indexed by label integer in the dataset. E.g. + * ["Retained", "Exited"] when 0, 1 are in your label column. + */ + fun addClassName(className: String) = apply { + classNames = + (classNames ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(className) + } } /** @@ -1254,27 +1459,27 @@ constructor( * Array with the names of all categorical features in the dataset. E.g. * ["Age", "Geography"]. */ - @JsonProperty("categoricalFeatureNames") - @ExcludeMissing fun categoricalFeatureNames(categoricalFeatureNames: JsonField>) = apply { - this.categoricalFeatureNames = categoricalFeatureNames + this.categoricalFeatureNames = + categoricalFeatureNames.map { it.toMutableList() } } /** - * List of class names indexed by label integer in the dataset. E.g. - * ["Retained", "Exited"] when 0, 1 are in your label column. - */ - fun classNames(classNames: List) = classNames(JsonField.of(classNames)) - - /** - * List of class names indexed by label integer in the dataset. E.g. - * ["Retained", "Exited"] when 0, 1 are in your label column. + * Array with the names of all categorical features in the dataset. E.g. + * ["Age", "Geography"]. */ - @JsonProperty("classNames") - @ExcludeMissing - fun classNames(classNames: JsonField>) = apply { - this.classNames = classNames + fun addCategoricalFeatureName(categoricalFeatureName: String) = apply { + categoricalFeatureNames = + (categoricalFeatureNames ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(categoricalFeatureName) + } } /** Array with all input feature names. */ @@ -1282,10 +1487,22 @@ constructor( featureNames(JsonField.of(featureNames)) /** Array with all input feature names. */ - @JsonProperty("featureNames") - @ExcludeMissing fun featureNames(featureNames: JsonField>) = apply { - this.featureNames = featureNames + this.featureNames = featureNames.map { it.toMutableList() } + } + + /** Array with all input feature names. */ + fun addFeatureName(featureName: String) = apply { + featureNames = + (featureNames ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(featureName) + } } /** @@ -1301,8 +1518,6 @@ constructor( * rows at a later point in time. If not provided, a unique id is generated by * Openlayer. */ - @JsonProperty("inferenceIdColumnName") - @ExcludeMissing fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { this.inferenceIdColumnName = inferenceIdColumnName } @@ -1318,8 +1533,6 @@ constructor( * Name of the column with the labels. The data in this column must be * **zero-indexed integers**, matching the list provided in `classNames`. */ - @JsonProperty("labelColumnName") - @ExcludeMissing fun labelColumnName(labelColumnName: JsonField) = apply { this.labelColumnName = labelColumnName } @@ -1329,15 +1542,11 @@ constructor( latencyColumnName(JsonField.of(latencyColumnName)) /** Name of the column with the latencies. */ - @JsonProperty("latencyColumnName") - @ExcludeMissing fun latencyColumnName(latencyColumnName: JsonField) = apply { this.latencyColumnName = latencyColumnName } /** Object with metadata. */ - @JsonProperty("metadata") - @ExcludeMissing fun metadata(metadata: JsonValue) = apply { this.metadata = metadata } /** Name of the column with the model's predictions as **zero-indexed integers**. */ @@ -1345,8 +1554,6 @@ constructor( predictionsColumnName(JsonField.of(predictionsColumnName)) /** Name of the column with the model's predictions as **zero-indexed integers**. */ - @JsonProperty("predictionsColumnName") - @ExcludeMissing fun predictionsColumnName(predictionsColumnName: JsonField) = apply { this.predictionsColumnName = predictionsColumnName } @@ -1362,8 +1569,6 @@ constructor( * Name of the column with the model's predictions as **lists of class * probabilities**. */ - @JsonProperty("predictionScoresColumnName") - @ExcludeMissing fun predictionScoresColumnName(predictionScoresColumnName: JsonField) = apply { this.predictionScoresColumnName = predictionScoresColumnName @@ -1380,20 +1585,17 @@ constructor( * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If * not provided, the upload timestamp is used. */ - @JsonProperty("timestampColumnName") - @ExcludeMissing fun timestampColumnName(timestampColumnName: JsonField) = apply { this.timestampColumnName = timestampColumnName } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1401,11 +1603,19 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): TabularClassificationData = TabularClassificationData( - categoricalFeatureNames.map { it.toImmutable() }, - classNames.map { it.toImmutable() }, - featureNames.map { it.toImmutable() }, + checkRequired("classNames", classNames).map { it.toImmutable() }, + (categoricalFeatureNames ?: JsonMissing.of()).map { it.toImmutable() }, + (featureNames ?: JsonMissing.of()).map { it.toImmutable() }, inferenceIdColumnName, labelColumnName, latencyColumnName, @@ -1422,36 +1632,51 @@ constructor( return true } - return /* spotless:off */ other is TabularClassificationData && categoricalFeatureNames == other.categoricalFeatureNames && classNames == other.classNames && featureNames == other.featureNames && inferenceIdColumnName == other.inferenceIdColumnName && labelColumnName == other.labelColumnName && latencyColumnName == other.latencyColumnName && metadata == other.metadata && predictionsColumnName == other.predictionsColumnName && predictionScoresColumnName == other.predictionScoresColumnName && timestampColumnName == other.timestampColumnName && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TabularClassificationData && classNames == other.classNames && categoricalFeatureNames == other.categoricalFeatureNames && featureNames == other.featureNames && inferenceIdColumnName == other.inferenceIdColumnName && labelColumnName == other.labelColumnName && latencyColumnName == other.latencyColumnName && metadata == other.metadata && predictionsColumnName == other.predictionsColumnName && predictionScoresColumnName == other.predictionScoresColumnName && timestampColumnName == other.timestampColumnName && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(categoricalFeatureNames, classNames, featureNames, inferenceIdColumnName, labelColumnName, latencyColumnName, metadata, predictionsColumnName, predictionScoresColumnName, timestampColumnName, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(classNames, categoricalFeatureNames, featureNames, inferenceIdColumnName, labelColumnName, latencyColumnName, metadata, predictionsColumnName, predictionScoresColumnName, timestampColumnName, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TabularClassificationData{categoricalFeatureNames=$categoricalFeatureNames, classNames=$classNames, featureNames=$featureNames, inferenceIdColumnName=$inferenceIdColumnName, labelColumnName=$labelColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, predictionScoresColumnName=$predictionScoresColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" + "TabularClassificationData{classNames=$classNames, categoricalFeatureNames=$categoricalFeatureNames, featureNames=$featureNames, inferenceIdColumnName=$inferenceIdColumnName, labelColumnName=$labelColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, predictionScoresColumnName=$predictionScoresColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = TabularRegressionData.Builder::class) @NoAutoDetect class TabularRegressionData + @JsonCreator private constructor( - private val categoricalFeatureNames: JsonField>, - private val featureNames: JsonField>, - private val inferenceIdColumnName: JsonField, - private val latencyColumnName: JsonField, - private val metadata: JsonValue, - private val predictionsColumnName: JsonField, - private val targetColumnName: JsonField, - private val timestampColumnName: JsonField, - private val additionalProperties: Map, + @JsonProperty("categoricalFeatureNames") + @ExcludeMissing + private val categoricalFeatureNames: JsonField> = JsonMissing.of(), + @JsonProperty("featureNames") + @ExcludeMissing + private val featureNames: JsonField> = JsonMissing.of(), + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + private val inferenceIdColumnName: JsonField = JsonMissing.of(), + @JsonProperty("latencyColumnName") + @ExcludeMissing + private val latencyColumnName: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonValue = JsonMissing.of(), + @JsonProperty("predictionsColumnName") + @ExcludeMissing + private val predictionsColumnName: JsonField = JsonMissing.of(), + @JsonProperty("targetColumnName") + @ExcludeMissing + private val targetColumnName: JsonField = JsonMissing.of(), + @JsonProperty("timestampColumnName") + @ExcludeMissing + private val timestampColumnName: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** * Array with the names of all categorical features in the dataset. E.g. * ["Gender", "Geography"]. @@ -1474,6 +1699,9 @@ constructor( fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + /** Object with metadata. */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata + /** Name of the column with the model's predictions. */ fun predictionsColumnName(): Optional = Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) @@ -1495,10 +1723,12 @@ constructor( */ @JsonProperty("categoricalFeatureNames") @ExcludeMissing - fun _categoricalFeatureNames() = categoricalFeatureNames + fun _categoricalFeatureNames(): JsonField> = categoricalFeatureNames /** Array with all input feature names. */ - @JsonProperty("featureNames") @ExcludeMissing fun _featureNames() = featureNames + @JsonProperty("featureNames") + @ExcludeMissing + fun _featureNames(): JsonField> = featureNames /** * Name of the column with the inference ids. This is useful if you want to update rows @@ -1506,25 +1736,22 @@ constructor( */ @JsonProperty("inferenceIdColumnName") @ExcludeMissing - fun _inferenceIdColumnName() = inferenceIdColumnName + fun _inferenceIdColumnName(): JsonField = inferenceIdColumnName /** Name of the column with the latencies. */ @JsonProperty("latencyColumnName") @ExcludeMissing - fun _latencyColumnName() = latencyColumnName - - /** Object with metadata. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + fun _latencyColumnName(): JsonField = latencyColumnName /** Name of the column with the model's predictions. */ @JsonProperty("predictionsColumnName") @ExcludeMissing - fun _predictionsColumnName() = predictionsColumnName + fun _predictionsColumnName(): JsonField = predictionsColumnName /** Name of the column with the targets (ground truth values). */ @JsonProperty("targetColumnName") @ExcludeMissing - fun _targetColumnName() = targetColumnName + fun _targetColumnName(): JsonField = targetColumnName /** * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not @@ -1532,23 +1759,27 @@ constructor( */ @JsonProperty("timestampColumnName") @ExcludeMissing - fun _timestampColumnName() = timestampColumnName + fun _timestampColumnName(): JsonField = timestampColumnName @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): TabularRegressionData = apply { - if (!validated) { - categoricalFeatureNames() - featureNames() - inferenceIdColumnName() - latencyColumnName() - predictionsColumnName() - targetColumnName() - timestampColumnName() - validated = true + if (validated) { + return@apply } + + categoricalFeatureNames() + featureNames() + inferenceIdColumnName() + latencyColumnName() + predictionsColumnName() + targetColumnName() + timestampColumnName() + validated = true } fun toBuilder() = Builder().from(this) @@ -1560,8 +1791,8 @@ constructor( class Builder { - private var categoricalFeatureNames: JsonField> = JsonMissing.of() - private var featureNames: JsonField> = JsonMissing.of() + private var categoricalFeatureNames: JsonField>? = null + private var featureNames: JsonField>? = null private var inferenceIdColumnName: JsonField = JsonMissing.of() private var latencyColumnName: JsonField = JsonMissing.of() private var metadata: JsonValue = JsonMissing.of() @@ -1572,15 +1803,16 @@ constructor( @JvmSynthetic internal fun from(tabularRegressionData: TabularRegressionData) = apply { - this.categoricalFeatureNames = tabularRegressionData.categoricalFeatureNames - this.featureNames = tabularRegressionData.featureNames - this.inferenceIdColumnName = tabularRegressionData.inferenceIdColumnName - this.latencyColumnName = tabularRegressionData.latencyColumnName - this.metadata = tabularRegressionData.metadata - this.predictionsColumnName = tabularRegressionData.predictionsColumnName - this.targetColumnName = tabularRegressionData.targetColumnName - this.timestampColumnName = tabularRegressionData.timestampColumnName - additionalProperties(tabularRegressionData.additionalProperties) + categoricalFeatureNames = + tabularRegressionData.categoricalFeatureNames.map { it.toMutableList() } + featureNames = tabularRegressionData.featureNames.map { it.toMutableList() } + inferenceIdColumnName = tabularRegressionData.inferenceIdColumnName + latencyColumnName = tabularRegressionData.latencyColumnName + metadata = tabularRegressionData.metadata + predictionsColumnName = tabularRegressionData.predictionsColumnName + targetColumnName = tabularRegressionData.targetColumnName + timestampColumnName = tabularRegressionData.timestampColumnName + additionalProperties = tabularRegressionData.additionalProperties.toMutableMap() } /** @@ -1594,22 +1826,50 @@ constructor( * Array with the names of all categorical features in the dataset. E.g. * ["Gender", "Geography"]. */ - @JsonProperty("categoricalFeatureNames") - @ExcludeMissing fun categoricalFeatureNames(categoricalFeatureNames: JsonField>) = apply { - this.categoricalFeatureNames = categoricalFeatureNames + this.categoricalFeatureNames = + categoricalFeatureNames.map { it.toMutableList() } } + /** + * Array with the names of all categorical features in the dataset. E.g. + * ["Gender", "Geography"]. + */ + fun addCategoricalFeatureName(categoricalFeatureName: String) = apply { + categoricalFeatureNames = + (categoricalFeatureNames ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(categoricalFeatureName) + } + } + /** Array with all input feature names. */ fun featureNames(featureNames: List) = featureNames(JsonField.of(featureNames)) /** Array with all input feature names. */ - @JsonProperty("featureNames") - @ExcludeMissing fun featureNames(featureNames: JsonField>) = apply { - this.featureNames = featureNames + this.featureNames = featureNames.map { it.toMutableList() } + } + + /** Array with all input feature names. */ + fun addFeatureName(featureName: String) = apply { + featureNames = + (featureNames ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(featureName) + } } /** @@ -1625,8 +1885,6 @@ constructor( * rows at a later point in time. If not provided, a unique id is generated by * Openlayer. */ - @JsonProperty("inferenceIdColumnName") - @ExcludeMissing fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { this.inferenceIdColumnName = inferenceIdColumnName } @@ -1636,15 +1894,11 @@ constructor( latencyColumnName(JsonField.of(latencyColumnName)) /** Name of the column with the latencies. */ - @JsonProperty("latencyColumnName") - @ExcludeMissing fun latencyColumnName(latencyColumnName: JsonField) = apply { this.latencyColumnName = latencyColumnName } /** Object with metadata. */ - @JsonProperty("metadata") - @ExcludeMissing fun metadata(metadata: JsonValue) = apply { this.metadata = metadata } /** Name of the column with the model's predictions. */ @@ -1652,8 +1906,6 @@ constructor( predictionsColumnName(JsonField.of(predictionsColumnName)) /** Name of the column with the model's predictions. */ - @JsonProperty("predictionsColumnName") - @ExcludeMissing fun predictionsColumnName(predictionsColumnName: JsonField) = apply { this.predictionsColumnName = predictionsColumnName } @@ -1663,8 +1915,6 @@ constructor( targetColumnName(JsonField.of(targetColumnName)) /** Name of the column with the targets (ground truth values). */ - @JsonProperty("targetColumnName") - @ExcludeMissing fun targetColumnName(targetColumnName: JsonField) = apply { this.targetColumnName = targetColumnName } @@ -1680,20 +1930,17 @@ constructor( * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If * not provided, the upload timestamp is used. */ - @JsonProperty("timestampColumnName") - @ExcludeMissing fun timestampColumnName(timestampColumnName: JsonField) = apply { this.timestampColumnName = timestampColumnName } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1701,10 +1948,18 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): TabularRegressionData = TabularRegressionData( - categoricalFeatureNames.map { it.toImmutable() }, - featureNames.map { it.toImmutable() }, + (categoricalFeatureNames ?: JsonMissing.of()).map { it.toImmutable() }, + (featureNames ?: JsonMissing.of()).map { it.toImmutable() }, inferenceIdColumnName, latencyColumnName, metadata, @@ -1733,24 +1988,41 @@ constructor( "TabularRegressionData{categoricalFeatureNames=$categoricalFeatureNames, featureNames=$featureNames, inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, targetColumnName=$targetColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = TextClassificationData.Builder::class) @NoAutoDetect class TextClassificationData + @JsonCreator private constructor( - private val classNames: JsonField>, - private val inferenceIdColumnName: JsonField, - private val labelColumnName: JsonField, - private val latencyColumnName: JsonField, - private val metadata: JsonValue, - private val predictionsColumnName: JsonField, - private val predictionScoresColumnName: JsonField, - private val textColumnName: JsonField, - private val timestampColumnName: JsonField, - private val additionalProperties: Map, + @JsonProperty("classNames") + @ExcludeMissing + private val classNames: JsonField> = JsonMissing.of(), + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + private val inferenceIdColumnName: JsonField = JsonMissing.of(), + @JsonProperty("labelColumnName") + @ExcludeMissing + private val labelColumnName: JsonField = JsonMissing.of(), + @JsonProperty("latencyColumnName") + @ExcludeMissing + private val latencyColumnName: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonValue = JsonMissing.of(), + @JsonProperty("predictionsColumnName") + @ExcludeMissing + private val predictionsColumnName: JsonField = JsonMissing.of(), + @JsonProperty("predictionScoresColumnName") + @ExcludeMissing + private val predictionScoresColumnName: JsonField = JsonMissing.of(), + @JsonProperty("textColumnName") + @ExcludeMissing + private val textColumnName: JsonField = JsonMissing.of(), + @JsonProperty("timestampColumnName") + @ExcludeMissing + private val timestampColumnName: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** * List of class names indexed by label integer in the dataset. E.g. * ["Retained", "Exited"] when 0, 1 are in your label column. @@ -1775,6 +2047,9 @@ constructor( fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + /** Object with metadata. */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata + /** Name of the column with the model's predictions as **zero-indexed integers**. */ fun predictionsColumnName(): Optional = Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) @@ -1802,7 +2077,9 @@ constructor( * List of class names indexed by label integer in the dataset. E.g. * ["Retained", "Exited"] when 0, 1 are in your label column. */ - @JsonProperty("classNames") @ExcludeMissing fun _classNames() = classNames + @JsonProperty("classNames") + @ExcludeMissing + fun _classNames(): JsonField> = classNames /** * Name of the column with the inference ids. This is useful if you want to update rows @@ -1810,7 +2087,7 @@ constructor( */ @JsonProperty("inferenceIdColumnName") @ExcludeMissing - fun _inferenceIdColumnName() = inferenceIdColumnName + fun _inferenceIdColumnName(): JsonField = inferenceIdColumnName /** * Name of the column with the labels. The data in this column must be **zero-indexed @@ -1818,30 +2095,29 @@ constructor( */ @JsonProperty("labelColumnName") @ExcludeMissing - fun _labelColumnName() = labelColumnName + fun _labelColumnName(): JsonField = labelColumnName /** Name of the column with the latencies. */ @JsonProperty("latencyColumnName") @ExcludeMissing - fun _latencyColumnName() = latencyColumnName - - /** Object with metadata. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + fun _latencyColumnName(): JsonField = latencyColumnName /** Name of the column with the model's predictions as **zero-indexed integers**. */ @JsonProperty("predictionsColumnName") @ExcludeMissing - fun _predictionsColumnName() = predictionsColumnName + fun _predictionsColumnName(): JsonField = predictionsColumnName /** * Name of the column with the model's predictions as **lists of class probabilities**. */ @JsonProperty("predictionScoresColumnName") @ExcludeMissing - fun _predictionScoresColumnName() = predictionScoresColumnName + fun _predictionScoresColumnName(): JsonField = predictionScoresColumnName /** Name of the column with the text data. */ - @JsonProperty("textColumnName") @ExcludeMissing fun _textColumnName() = textColumnName + @JsonProperty("textColumnName") + @ExcludeMissing + fun _textColumnName(): JsonField = textColumnName /** * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not @@ -1849,24 +2125,28 @@ constructor( */ @JsonProperty("timestampColumnName") @ExcludeMissing - fun _timestampColumnName() = timestampColumnName + fun _timestampColumnName(): JsonField = timestampColumnName @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): TextClassificationData = apply { - if (!validated) { - classNames() - inferenceIdColumnName() - labelColumnName() - latencyColumnName() - predictionsColumnName() - predictionScoresColumnName() - textColumnName() - timestampColumnName() - validated = true + if (validated) { + return@apply } + + classNames() + inferenceIdColumnName() + labelColumnName() + latencyColumnName() + predictionsColumnName() + predictionScoresColumnName() + textColumnName() + timestampColumnName() + validated = true } fun toBuilder() = Builder().from(this) @@ -1878,7 +2158,7 @@ constructor( class Builder { - private var classNames: JsonField> = JsonMissing.of() + private var classNames: JsonField>? = null private var inferenceIdColumnName: JsonField = JsonMissing.of() private var labelColumnName: JsonField = JsonMissing.of() private var latencyColumnName: JsonField = JsonMissing.of() @@ -1891,17 +2171,17 @@ constructor( @JvmSynthetic internal fun from(textClassificationData: TextClassificationData) = apply { - this.classNames = textClassificationData.classNames - this.inferenceIdColumnName = textClassificationData.inferenceIdColumnName - this.labelColumnName = textClassificationData.labelColumnName - this.latencyColumnName = textClassificationData.latencyColumnName - this.metadata = textClassificationData.metadata - this.predictionsColumnName = textClassificationData.predictionsColumnName - this.predictionScoresColumnName = - textClassificationData.predictionScoresColumnName - this.textColumnName = textClassificationData.textColumnName - this.timestampColumnName = textClassificationData.timestampColumnName - additionalProperties(textClassificationData.additionalProperties) + classNames = textClassificationData.classNames.map { it.toMutableList() } + inferenceIdColumnName = textClassificationData.inferenceIdColumnName + labelColumnName = textClassificationData.labelColumnName + latencyColumnName = textClassificationData.latencyColumnName + metadata = textClassificationData.metadata + predictionsColumnName = textClassificationData.predictionsColumnName + predictionScoresColumnName = textClassificationData.predictionScoresColumnName + textColumnName = textClassificationData.textColumnName + timestampColumnName = textClassificationData.timestampColumnName + additionalProperties = + textClassificationData.additionalProperties.toMutableMap() } /** @@ -1914,10 +2194,25 @@ constructor( * List of class names indexed by label integer in the dataset. E.g. * ["Retained", "Exited"] when 0, 1 are in your label column. */ - @JsonProperty("classNames") - @ExcludeMissing fun classNames(classNames: JsonField>) = apply { - this.classNames = classNames + this.classNames = classNames.map { it.toMutableList() } + } + + /** + * List of class names indexed by label integer in the dataset. E.g. + * ["Retained", "Exited"] when 0, 1 are in your label column. + */ + fun addClassName(className: String) = apply { + classNames = + (classNames ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(className) + } } /** @@ -1933,8 +2228,6 @@ constructor( * rows at a later point in time. If not provided, a unique id is generated by * Openlayer. */ - @JsonProperty("inferenceIdColumnName") - @ExcludeMissing fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { this.inferenceIdColumnName = inferenceIdColumnName } @@ -1950,8 +2243,6 @@ constructor( * Name of the column with the labels. The data in this column must be * **zero-indexed integers**, matching the list provided in `classNames`. */ - @JsonProperty("labelColumnName") - @ExcludeMissing fun labelColumnName(labelColumnName: JsonField) = apply { this.labelColumnName = labelColumnName } @@ -1961,15 +2252,11 @@ constructor( latencyColumnName(JsonField.of(latencyColumnName)) /** Name of the column with the latencies. */ - @JsonProperty("latencyColumnName") - @ExcludeMissing fun latencyColumnName(latencyColumnName: JsonField) = apply { this.latencyColumnName = latencyColumnName } /** Object with metadata. */ - @JsonProperty("metadata") - @ExcludeMissing fun metadata(metadata: JsonValue) = apply { this.metadata = metadata } /** Name of the column with the model's predictions as **zero-indexed integers**. */ @@ -1977,8 +2264,6 @@ constructor( predictionsColumnName(JsonField.of(predictionsColumnName)) /** Name of the column with the model's predictions as **zero-indexed integers**. */ - @JsonProperty("predictionsColumnName") - @ExcludeMissing fun predictionsColumnName(predictionsColumnName: JsonField) = apply { this.predictionsColumnName = predictionsColumnName } @@ -1994,8 +2279,6 @@ constructor( * Name of the column with the model's predictions as **lists of class * probabilities**. */ - @JsonProperty("predictionScoresColumnName") - @ExcludeMissing fun predictionScoresColumnName(predictionScoresColumnName: JsonField) = apply { this.predictionScoresColumnName = predictionScoresColumnName @@ -2006,8 +2289,6 @@ constructor( textColumnName(JsonField.of(textColumnName)) /** Name of the column with the text data. */ - @JsonProperty("textColumnName") - @ExcludeMissing fun textColumnName(textColumnName: JsonField) = apply { this.textColumnName = textColumnName } @@ -2023,20 +2304,17 @@ constructor( * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If * not provided, the upload timestamp is used. */ - @JsonProperty("timestampColumnName") - @ExcludeMissing fun timestampColumnName(timestampColumnName: JsonField) = apply { this.timestampColumnName = timestampColumnName } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -2044,9 +2322,17 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): TextClassificationData = TextClassificationData( - classNames.map { it.toImmutable() }, + checkRequired("classNames", classNames).map { it.toImmutable() }, inferenceIdColumnName, labelColumnName, latencyColumnName, @@ -2078,17 +2364,28 @@ constructor( } } - @JsonDeserialize(builder = Row.Builder::class) @NoAutoDetect class Row + @JsonCreator private constructor( - private val additionalProperties: Map, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + + fun validate(): Row = apply { + if (validated) { + return@apply + } + + validated = true + } + fun toBuilder() = Builder().from(this) companion object { @@ -2101,22 +2398,29 @@ constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(row: Row) = apply { additionalProperties(row.additionalProperties) } + internal fun from(row: Row) = apply { + additionalProperties = row.additionalProperties.toMutableMap() + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Row = Row(additionalProperties.toImmutable()) } @@ -2142,11 +2446,11 @@ constructor( return true } - return /* spotless:off */ other is InferencePipelineDataStreamParams && inferencePipelineId == other.inferencePipelineId && config == other.config && rows == other.rows && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is InferencePipelineDataStreamParams && inferencePipelineId == other.inferencePipelineId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(inferencePipelineId, config, rows, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(inferencePipelineId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "InferencePipelineDataStreamParams{inferencePipelineId=$inferencePipelineId, config=$config, rows=$rows, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "InferencePipelineDataStreamParams{inferencePipelineId=$inferencePipelineId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt index 4f6cbe7b..68ad1416 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt @@ -6,40 +6,45 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.Enum import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects -@JsonDeserialize(builder = InferencePipelineDataStreamResponse.Builder::class) @NoAutoDetect class InferencePipelineDataStreamResponse +@JsonCreator private constructor( - private val success: JsonField, - private val additionalProperties: Map, + @JsonProperty("success") + @ExcludeMissing + private val success: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun success(): Success = success.getRequired("success") - @JsonProperty("success") @ExcludeMissing fun _success() = success + @JsonProperty("success") @ExcludeMissing fun _success(): JsonField = success @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): InferencePipelineDataStreamResponse = apply { - if (!validated) { - success() - validated = true + if (validated) { + return@apply } + + success() + validated = true } fun toBuilder() = Builder().from(this) @@ -51,39 +56,46 @@ private constructor( class Builder { - private var success: JsonField = JsonMissing.of() + private var success: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( inferencePipelineDataStreamResponse: InferencePipelineDataStreamResponse ) = apply { - this.success = inferencePipelineDataStreamResponse.success - additionalProperties(inferencePipelineDataStreamResponse.additionalProperties) + success = inferencePipelineDataStreamResponse.success + additionalProperties = + inferencePipelineDataStreamResponse.additionalProperties.toMutableMap() } fun success(success: Success) = success(JsonField.of(success)) - @JsonProperty("success") - @ExcludeMissing fun success(success: JsonField) = apply { this.success = success } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): InferencePipelineDataStreamResponse = - InferencePipelineDataStreamResponse(success, additionalProperties.toImmutable()) + InferencePipelineDataStreamResponse( + checkRequired("success", success), + additionalProperties.toImmutable() + ) } class Success diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt index 8046a965..5fa52bd8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt @@ -4,12 +4,14 @@ package com.openlayer.api.models import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams import com.openlayer.api.core.toImmutable import java.util.Objects import java.util.Optional +/** Delete inference pipeline. */ class InferencePipelineDeleteParams constructor( private val inferencePipelineId: String, @@ -27,9 +29,8 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties @JvmSynthetic - internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - } + internal fun getBody(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -192,9 +193,7 @@ constructor( fun build(): InferencePipelineDeleteParams = InferencePipelineDeleteParams( - checkNotNull(inferencePipelineId) { - "`inferencePipelineId` is required but was not set" - }, + checkRequired("inferencePipelineId", inferencePipelineId), additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt index b5e6d1cd..a0580c01 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonCreator import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams import com.openlayer.api.core.toImmutable @@ -13,6 +14,7 @@ import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects import java.util.Optional +/** Retrieve inference pipeline. */ class InferencePipelineRetrieveParams constructor( private val inferencePipelineId: String, @@ -23,6 +25,7 @@ constructor( fun inferencePipelineId(): String = inferencePipelineId + /** Expand specific nested objects. */ fun expand(): Optional> = Optional.ofNullable(expand) fun _additionalHeaders(): Headers = additionalHeaders @@ -57,7 +60,7 @@ constructor( class Builder { private var inferencePipelineId: String? = null - private var expand: MutableList = mutableListOf() + private var expand: MutableList? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -65,7 +68,7 @@ constructor( internal fun from(inferencePipelineRetrieveParams: InferencePipelineRetrieveParams) = apply { inferencePipelineId = inferencePipelineRetrieveParams.inferencePipelineId - expand = inferencePipelineRetrieveParams.expand?.toMutableList() ?: mutableListOf() + expand = inferencePipelineRetrieveParams.expand?.toMutableList() additionalHeaders = inferencePipelineRetrieveParams.additionalHeaders.toBuilder() additionalQueryParams = inferencePipelineRetrieveParams.additionalQueryParams.toBuilder() @@ -76,13 +79,15 @@ constructor( } /** Expand specific nested objects. */ - fun expand(expand: List) = apply { - this.expand.clear() - this.expand.addAll(expand) - } + fun expand(expand: List?) = apply { this.expand = expand?.toMutableList() } + + /** Expand specific nested objects. */ + fun expand(expand: Optional>) = expand(expand.orElse(null)) /** Expand specific nested objects. */ - fun addExpand(expand: Expand) = apply { this.expand.add(expand) } + fun addExpand(expand: Expand) = apply { + this.expand = (this.expand ?: mutableListOf()).apply { add(expand) } + } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -184,10 +189,8 @@ constructor( fun build(): InferencePipelineRetrieveParams = InferencePipelineRetrieveParams( - checkNotNull(inferencePipelineId) { - "`inferencePipelineId` is required but was not set" - }, - expand.toImmutable().ifEmpty { null }, + checkRequired("inferencePipelineId", inferencePipelineId), + expand?.toImmutable(), additionalHeaders.build(), additionalQueryParams.build(), ) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt index 0022e99c..ea9f73fa 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt @@ -6,13 +6,14 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.Enum import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.LocalDate @@ -20,80 +21,99 @@ import java.time.OffsetDateTime import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = InferencePipelineRetrieveResponse.Builder::class) @NoAutoDetect class InferencePipelineRetrieveResponse +@JsonCreator private constructor( - private val id: JsonField, - private val projectId: JsonField, - private val workspaceId: JsonField, - private val project: JsonField, - private val workspace: JsonField, - private val name: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val dateLastSampleReceived: JsonField, - private val description: JsonField, - private val dateLastEvaluated: JsonField, - private val dateOfNextEvaluation: JsonField, - private val passingGoalCount: JsonField, - private val failingGoalCount: JsonField, - private val totalGoalCount: JsonField, - private val status: JsonField, - private val statusMessage: JsonField, - private val links: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + private val dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastSampleReceived") + @ExcludeMissing + private val dateLastSampleReceived: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + private val dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("failingGoalCount") + @ExcludeMissing + private val failingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing private val links: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), + @JsonProperty("passingGoalCount") + @ExcludeMissing + private val passingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + private val projectId: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + private val statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("totalGoalCount") + @ExcludeMissing + private val totalGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("project") + @ExcludeMissing + private val project: JsonField = JsonMissing.of(), + @JsonProperty("workspace") + @ExcludeMissing + private val workspace: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + private val workspaceId: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The inference pipeline id. */ fun id(): String = id.getRequired("id") - /** The project id. */ - fun projectId(): String = projectId.getRequired("projectId") - - /** The workspace id. */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) - - fun project(): Optional = Optional.ofNullable(project.getNullable("project")) - - fun workspace(): Optional = Optional.ofNullable(workspace.getNullable("workspace")) - - /** The inference pipeline name. */ - fun name(): String = name.getRequired("name") - /** The creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The last updated date. */ - fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** The last test evaluation date. */ + fun dateLastEvaluated(): Optional = + Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) /** The last data sample received date. */ fun dateLastSampleReceived(): Optional = Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + /** The next test evaluation date. */ + fun dateOfNextEvaluation(): Optional = + Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + + /** The last updated date. */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** The inference pipeline description. */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** The last test evaluation date. */ - fun dateLastEvaluated(): Optional = - Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + /** The number of tests failing. */ + fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") - /** The next test evaluation date. */ - fun dateOfNextEvaluation(): Optional = - Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + fun links(): Links = links.getRequired("links") + + /** The inference pipeline name. */ + fun name(): String = name.getRequired("name") /** The number of tests passing. */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") - /** The number of tests failing. */ - fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") - - /** The total number of tests. */ - fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") + /** The project id. */ + fun projectId(): String = projectId.getRequired("projectId") /** The status of test evaluation for the inference pipeline. */ fun status(): Status = status.getRequired("status") @@ -102,89 +122,116 @@ private constructor( fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) - fun links(): Links = links.getRequired("links") + /** The total number of tests. */ + fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") - /** The inference pipeline id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun project(): Optional = Optional.ofNullable(project.getNullable("project")) - /** The project id. */ - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + fun workspace(): Optional = Optional.ofNullable(workspace.getNullable("workspace")) /** The workspace id. */ - @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId() = workspaceId - - @JsonProperty("project") @ExcludeMissing fun _project() = project - - @JsonProperty("workspace") @ExcludeMissing fun _workspace() = workspace + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The inference pipeline name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + /** The inference pipeline id. */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated - /** The last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + /** The last test evaluation date. */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun _dateLastEvaluated(): JsonField = dateLastEvaluated /** The last data sample received date. */ @JsonProperty("dateLastSampleReceived") @ExcludeMissing - fun _dateLastSampleReceived() = dateLastSampleReceived - - /** The inference pipeline description. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description - - /** The last test evaluation date. */ - @JsonProperty("dateLastEvaluated") @ExcludeMissing fun _dateLastEvaluated() = dateLastEvaluated + fun _dateLastSampleReceived(): JsonField = dateLastSampleReceived /** The next test evaluation date. */ @JsonProperty("dateOfNextEvaluation") @ExcludeMissing - fun _dateOfNextEvaluation() = dateOfNextEvaluation + fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation - /** The number of tests passing. */ - @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount + /** The last updated date. */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** The inference pipeline description. */ + @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description /** The number of tests failing. */ - @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount + @JsonProperty("failingGoalCount") + @ExcludeMissing + fun _failingGoalCount(): JsonField = failingGoalCount - /** The total number of tests. */ - @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links + + /** The inference pipeline name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** The number of tests passing. */ + @JsonProperty("passingGoalCount") + @ExcludeMissing + fun _passingGoalCount(): JsonField = passingGoalCount + + /** The project id. */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId /** The status of test evaluation for the inference pipeline. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status /** The status message of test evaluation for the inference pipeline. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + + /** The total number of tests. */ + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun _totalGoalCount(): JsonField = totalGoalCount + + @JsonProperty("project") @ExcludeMissing fun _project(): JsonField = project - @JsonProperty("links") @ExcludeMissing fun _links() = links + @JsonProperty("workspace") @ExcludeMissing fun _workspace(): JsonField = workspace + + /** The workspace id. */ + @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): InferencePipelineRetrieveResponse = apply { - if (!validated) { - id() - projectId() - workspaceId() - project().map { it.validate() } - workspace().map { it.validate() } - name() - dateCreated() - dateUpdated() - dateLastSampleReceived() - description() - dateLastEvaluated() - dateOfNextEvaluation() - passingGoalCount() - failingGoalCount() - totalGoalCount() - status() - statusMessage() - links().validate() - validated = true + if (validated) { + return@apply } + + id() + dateCreated() + dateLastEvaluated() + dateLastSampleReceived() + dateOfNextEvaluation() + dateUpdated() + description() + failingGoalCount() + links().validate() + name() + passingGoalCount() + projectId() + status() + statusMessage() + totalGoalCount() + project().ifPresent { it.validate() } + workspace().ifPresent { it.validate() } + workspaceId() + validated = true } fun toBuilder() = Builder().from(this) @@ -196,271 +243,269 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var projectId: JsonField = JsonMissing.of() - private var workspaceId: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateLastEvaluated: JsonField? = null + private var dateLastSampleReceived: JsonField? = null + private var dateOfNextEvaluation: JsonField? = null + private var dateUpdated: JsonField? = null + private var description: JsonField? = null + private var failingGoalCount: JsonField? = null + private var links: JsonField? = null + private var name: JsonField? = null + private var passingGoalCount: JsonField? = null + private var projectId: JsonField? = null + private var status: JsonField? = null + private var statusMessage: JsonField? = null + private var totalGoalCount: JsonField? = null private var project: JsonField = JsonMissing.of() private var workspace: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() - private var dateLastSampleReceived: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() - private var dateLastEvaluated: JsonField = JsonMissing.of() - private var dateOfNextEvaluation: JsonField = JsonMissing.of() - private var passingGoalCount: JsonField = JsonMissing.of() - private var failingGoalCount: JsonField = JsonMissing.of() - private var totalGoalCount: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var statusMessage: JsonField = JsonMissing.of() - private var links: JsonField = JsonMissing.of() + private var workspaceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(inferencePipelineRetrieveResponse: InferencePipelineRetrieveResponse) = apply { - this.id = inferencePipelineRetrieveResponse.id - this.projectId = inferencePipelineRetrieveResponse.projectId - this.workspaceId = inferencePipelineRetrieveResponse.workspaceId - this.project = inferencePipelineRetrieveResponse.project - this.workspace = inferencePipelineRetrieveResponse.workspace - this.name = inferencePipelineRetrieveResponse.name - this.dateCreated = inferencePipelineRetrieveResponse.dateCreated - this.dateUpdated = inferencePipelineRetrieveResponse.dateUpdated - this.dateLastSampleReceived = - inferencePipelineRetrieveResponse.dateLastSampleReceived - this.description = inferencePipelineRetrieveResponse.description - this.dateLastEvaluated = inferencePipelineRetrieveResponse.dateLastEvaluated - this.dateOfNextEvaluation = inferencePipelineRetrieveResponse.dateOfNextEvaluation - this.passingGoalCount = inferencePipelineRetrieveResponse.passingGoalCount - this.failingGoalCount = inferencePipelineRetrieveResponse.failingGoalCount - this.totalGoalCount = inferencePipelineRetrieveResponse.totalGoalCount - this.status = inferencePipelineRetrieveResponse.status - this.statusMessage = inferencePipelineRetrieveResponse.statusMessage - this.links = inferencePipelineRetrieveResponse.links - additionalProperties(inferencePipelineRetrieveResponse.additionalProperties) + id = inferencePipelineRetrieveResponse.id + dateCreated = inferencePipelineRetrieveResponse.dateCreated + dateLastEvaluated = inferencePipelineRetrieveResponse.dateLastEvaluated + dateLastSampleReceived = inferencePipelineRetrieveResponse.dateLastSampleReceived + dateOfNextEvaluation = inferencePipelineRetrieveResponse.dateOfNextEvaluation + dateUpdated = inferencePipelineRetrieveResponse.dateUpdated + description = inferencePipelineRetrieveResponse.description + failingGoalCount = inferencePipelineRetrieveResponse.failingGoalCount + links = inferencePipelineRetrieveResponse.links + name = inferencePipelineRetrieveResponse.name + passingGoalCount = inferencePipelineRetrieveResponse.passingGoalCount + projectId = inferencePipelineRetrieveResponse.projectId + status = inferencePipelineRetrieveResponse.status + statusMessage = inferencePipelineRetrieveResponse.statusMessage + totalGoalCount = inferencePipelineRetrieveResponse.totalGoalCount + project = inferencePipelineRetrieveResponse.project + workspace = inferencePipelineRetrieveResponse.workspace + workspaceId = inferencePipelineRetrieveResponse.workspaceId + additionalProperties = + inferencePipelineRetrieveResponse.additionalProperties.toMutableMap() } /** The inference pipeline id. */ fun id(id: String) = id(JsonField.of(id)) /** The inference pipeline id. */ - @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + fun id(id: JsonField) = apply { this.id = id } - /** The project id. */ - fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - - /** The project id. */ - @JsonProperty("projectId") - @ExcludeMissing - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The workspace id. */ - fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + /** The creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } - /** The workspace id. */ - @JsonProperty("workspaceId") - @ExcludeMissing - fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = + dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) - fun project(project: Project) = project(JsonField.of(project)) + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: Optional) = + dateLastEvaluated(dateLastEvaluated.orElse(null)) - @JsonProperty("project") - @ExcludeMissing - fun project(project: JsonField) = apply { this.project = project } + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } - fun workspace(workspace: Workspace) = workspace(JsonField.of(workspace)) + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime?) = + dateLastSampleReceived(JsonField.ofNullable(dateLastSampleReceived)) - @JsonProperty("workspace") - @ExcludeMissing - fun workspace(workspace: JsonField) = apply { this.workspace = workspace } + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: Optional) = + dateLastSampleReceived(dateLastSampleReceived.orElse(null)) - /** The inference pipeline name. */ - fun name(name: String) = name(JsonField.of(name)) + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { + this.dateLastSampleReceived = dateLastSampleReceived + } - /** The inference pipeline name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = + dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) - /** The creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = + dateOfNextEvaluation(dateOfNextEvaluation.orElse(null)) - /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun dateCreated(dateCreated: JsonField) = apply { - this.dateCreated = dateCreated + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation } /** The last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - /** The last data sample received date. */ - fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime) = - dateLastSampleReceived(JsonField.of(dateLastSampleReceived)) - - /** The last data sample received date. */ - @JsonProperty("dateLastSampleReceived") - @ExcludeMissing - fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { - this.dateLastSampleReceived = dateLastSampleReceived - } + /** The inference pipeline description. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) /** The inference pipeline description. */ - fun description(description: String) = description(JsonField.of(description)) + fun description(description: Optional) = description(description.orElse(null)) /** The inference pipeline description. */ - @JsonProperty("description") - @ExcludeMissing fun description(description: JsonField) = apply { this.description = description } - /** The last test evaluation date. */ - fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime) = - dateLastEvaluated(JsonField.of(dateLastEvaluated)) + /** The number of tests failing. */ + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) - /** The last test evaluation date. */ - @JsonProperty("dateLastEvaluated") - @ExcludeMissing - fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { - this.dateLastEvaluated = dateLastEvaluated + /** The number of tests failing. */ + fun failingGoalCount(failingGoalCount: JsonField) = apply { + this.failingGoalCount = failingGoalCount } - /** The next test evaluation date. */ - fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = - dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) + fun links(links: Links) = links(JsonField.of(links)) - /** The next test evaluation date. */ - @JsonProperty("dateOfNextEvaluation") - @ExcludeMissing - fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { - this.dateOfNextEvaluation = dateOfNextEvaluation - } + fun links(links: JsonField) = apply { this.links = links } + + /** The inference pipeline name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The inference pipeline name. */ + fun name(name: JsonField) = apply { this.name = name } /** The number of tests passing. */ fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) /** The number of tests passing. */ - @JsonProperty("passingGoalCount") - @ExcludeMissing fun passingGoalCount(passingGoalCount: JsonField) = apply { this.passingGoalCount = passingGoalCount } - /** The number of tests failing. */ - fun failingGoalCount(failingGoalCount: Long) = - failingGoalCount(JsonField.of(failingGoalCount)) - - /** The number of tests failing. */ - @JsonProperty("failingGoalCount") - @ExcludeMissing - fun failingGoalCount(failingGoalCount: JsonField) = apply { - this.failingGoalCount = failingGoalCount - } - - /** The total number of tests. */ - fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) + /** The project id. */ + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** The total number of tests. */ - @JsonProperty("totalGoalCount") - @ExcludeMissing - fun totalGoalCount(totalGoalCount: JsonField) = apply { - this.totalGoalCount = totalGoalCount - } + /** The project id. */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** The status of test evaluation for the inference pipeline. */ fun status(status: Status) = status(JsonField.of(status)) /** The status of test evaluation for the inference pipeline. */ - @JsonProperty("status") - @ExcludeMissing fun status(status: JsonField) = apply { this.status = status } /** The status message of test evaluation for the inference pipeline. */ - fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** The status message of test evaluation for the inference pipeline. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.orElse(null)) /** The status message of test evaluation for the inference pipeline. */ - @JsonProperty("statusMessage") - @ExcludeMissing fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } - fun links(links: Links) = links(JsonField.of(links)) + /** The total number of tests. */ + fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - @JsonProperty("links") - @ExcludeMissing - fun links(links: JsonField) = apply { this.links = links } + /** The total number of tests. */ + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount + } + + fun project(project: Project?) = project(JsonField.ofNullable(project)) + + fun project(project: Optional) = project(project.orElse(null)) + + fun project(project: JsonField) = apply { this.project = project } + + fun workspace(workspace: Workspace?) = workspace(JsonField.ofNullable(workspace)) + + fun workspace(workspace: Optional) = workspace(workspace.orElse(null)) + + fun workspace(workspace: JsonField) = apply { this.workspace = workspace } + + /** The workspace id. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** The workspace id. */ + fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): InferencePipelineRetrieveResponse = InferencePipelineRetrieveResponse( - id, - projectId, - workspaceId, + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateLastEvaluated", dateLastEvaluated), + checkRequired("dateLastSampleReceived", dateLastSampleReceived), + checkRequired("dateOfNextEvaluation", dateOfNextEvaluation), + checkRequired("dateUpdated", dateUpdated), + checkRequired("description", description), + checkRequired("failingGoalCount", failingGoalCount), + checkRequired("links", links), + checkRequired("name", name), + checkRequired("passingGoalCount", passingGoalCount), + checkRequired("projectId", projectId), + checkRequired("status", status), + checkRequired("statusMessage", statusMessage), + checkRequired("totalGoalCount", totalGoalCount), project, workspace, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - status, - statusMessage, - links, + workspaceId, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect class Links + @JsonCreator private constructor( - private val app: JsonField, - private val additionalProperties: Map, + @JsonProperty("app") @ExcludeMissing private val app: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun app(): String = app.getRequired("app") - @JsonProperty("app") @ExcludeMissing fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Links = apply { - if (!validated) { - app() - validated = true + if (validated) { + return@apply } + + app() + validated = true } fun toBuilder() = Builder().from(this) @@ -472,36 +517,40 @@ private constructor( class Builder { - private var app: JsonField = JsonMissing.of() + private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) + app = links.app + additionalProperties = links.additionalProperties.toMutableMap() } fun app(app: String) = app(JsonField.of(app)) - @JsonProperty("app") - @ExcludeMissing fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toImmutable()) + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Links = + Links(checkRequired("app", app), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -521,6 +570,7 @@ private constructor( override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } + /** The status of test evaluation for the inference pipeline. */ class Status @JsonCreator private constructor( @@ -602,53 +652,90 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = Project.Builder::class) @NoAutoDetect class Project + @JsonCreator private constructor( - private val id: JsonField, - private val workspaceId: JsonField, - private val creatorId: JsonField, - private val name: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val description: JsonField, - private val source: JsonField, - private val taskType: JsonField, - private val versionCount: JsonField, - private val inferencePipelineCount: JsonField, - private val goalCount: JsonField, - private val developmentGoalCount: JsonField, - private val monitoringGoalCount: JsonField, - private val links: JsonField, - private val gitRepo: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + private val creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("developmentGoalCount") + @ExcludeMissing + private val developmentGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("goalCount") + @ExcludeMissing + private val goalCount: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + private val inferencePipelineCount: JsonField = JsonMissing.of(), + @JsonProperty("links") + @ExcludeMissing + private val links: JsonField = JsonMissing.of(), + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + private val monitoringGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("source") + @ExcludeMissing + private val source: JsonField = JsonMissing.of(), + @JsonProperty("taskType") + @ExcludeMissing + private val taskType: JsonField = JsonMissing.of(), + @JsonProperty("versionCount") + @ExcludeMissing + private val versionCount: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + private val workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("gitRepo") + @ExcludeMissing + private val gitRepo: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The project id. */ fun id(): String = id.getRequired("id") - /** The workspace id. */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The project creator id. */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The project name. */ - fun name(): String = name.getRequired("name") - /** The project creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") /** The project last updated date. */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The project description. */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") + + /** The total number of tests in the project. */ + fun goalCount(): Long = goalCount.getRequired("goalCount") + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(): Long = + inferencePipelineCount.getRequired("inferencePipelineCount") + + /** Links to the project. */ + fun links(): Links = links.getRequired("links") + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") + + /** The project name. */ + fun name(): String = name.getRequired("name") /** The source of the project. */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) @@ -659,101 +746,107 @@ private constructor( /** The number of versions (commits) in the project. */ fun versionCount(): Long = versionCount.getRequired("versionCount") - /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(): Long = - inferencePipelineCount.getRequired("inferencePipelineCount") - - /** The total number of tests in the project. */ - fun goalCount(): Long = goalCount.getRequired("goalCount") - - /** The number of tests in the development mode of the project. */ - fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") - - /** The number of tests in the monitoring mode of the project. */ - fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") + /** The workspace id. */ + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** Links to the project. */ - fun links(): Links = links.getRequired("links") + /** The project description. */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) /** The project id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id - - /** The workspace id. */ - @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId() = workspaceId + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The project creator id. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId - - /** The project name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId /** The project creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated /** The project last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated - - /** The project description. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description - - /** The source of the project. */ - @JsonProperty("source") @ExcludeMissing fun _source() = source + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - /** The task type of the project. */ - @JsonProperty("taskType") @ExcludeMissing fun _taskType() = taskType + /** The number of tests in the development mode of the project. */ + @JsonProperty("developmentGoalCount") + @ExcludeMissing + fun _developmentGoalCount(): JsonField = developmentGoalCount - /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") @ExcludeMissing fun _versionCount() = versionCount + /** The total number of tests in the project. */ + @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount /** The number of inference pipelines in the project. */ @JsonProperty("inferencePipelineCount") @ExcludeMissing - fun _inferencePipelineCount() = inferencePipelineCount - - /** The total number of tests in the project. */ - @JsonProperty("goalCount") @ExcludeMissing fun _goalCount() = goalCount + fun _inferencePipelineCount(): JsonField = inferencePipelineCount - /** The number of tests in the development mode of the project. */ - @JsonProperty("developmentGoalCount") - @ExcludeMissing - fun _developmentGoalCount() = developmentGoalCount + /** Links to the project. */ + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links /** The number of tests in the monitoring mode of the project. */ @JsonProperty("monitoringGoalCount") @ExcludeMissing - fun _monitoringGoalCount() = monitoringGoalCount + fun _monitoringGoalCount(): JsonField = monitoringGoalCount - /** Links to the project. */ - @JsonProperty("links") @ExcludeMissing fun _links() = links + /** The project name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** The source of the project. */ + @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source + + /** The task type of the project. */ + @JsonProperty("taskType") @ExcludeMissing fun _taskType(): JsonField = taskType - @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo() = gitRepo + /** The number of versions (commits) in the project. */ + @JsonProperty("versionCount") + @ExcludeMissing + fun _versionCount(): JsonField = versionCount + + /** The workspace id. */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** The project description. */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Project = apply { - if (!validated) { - id() - workspaceId() - creatorId() - name() - dateCreated() - dateUpdated() - description() - source() - taskType() - versionCount() - inferencePipelineCount() - goalCount() - developmentGoalCount() - monitoringGoalCount() - links().validate() - gitRepo().map { it.validate() } - validated = true + if (validated) { + return@apply } + + id() + creatorId() + dateCreated() + dateUpdated() + developmentGoalCount() + goalCount() + inferencePipelineCount() + links().validate() + monitoringGoalCount() + name() + source() + taskType() + versionCount() + workspaceId() + description() + gitRepo().ifPresent { it.validate() } + validated = true } fun toBuilder() = Builder().from(this) @@ -765,85 +858,64 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var workspaceId: JsonField = JsonMissing.of() - private var creatorId: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var developmentGoalCount: JsonField? = null + private var goalCount: JsonField? = null + private var inferencePipelineCount: JsonField? = null + private var links: JsonField? = null + private var monitoringGoalCount: JsonField? = null + private var name: JsonField? = null + private var source: JsonField? = null + private var taskType: JsonField? = null + private var versionCount: JsonField? = null + private var workspaceId: JsonField? = null private var description: JsonField = JsonMissing.of() - private var source: JsonField = JsonMissing.of() - private var taskType: JsonField = JsonMissing.of() - private var versionCount: JsonField = JsonMissing.of() - private var inferencePipelineCount: JsonField = JsonMissing.of() - private var goalCount: JsonField = JsonMissing.of() - private var developmentGoalCount: JsonField = JsonMissing.of() - private var monitoringGoalCount: JsonField = JsonMissing.of() - private var links: JsonField = JsonMissing.of() private var gitRepo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(project: Project) = apply { - this.id = project.id - this.workspaceId = project.workspaceId - this.creatorId = project.creatorId - this.name = project.name - this.dateCreated = project.dateCreated - this.dateUpdated = project.dateUpdated - this.description = project.description - this.source = project.source - this.taskType = project.taskType - this.versionCount = project.versionCount - this.inferencePipelineCount = project.inferencePipelineCount - this.goalCount = project.goalCount - this.developmentGoalCount = project.developmentGoalCount - this.monitoringGoalCount = project.monitoringGoalCount - this.links = project.links - this.gitRepo = project.gitRepo - additionalProperties(project.additionalProperties) + id = project.id + creatorId = project.creatorId + dateCreated = project.dateCreated + dateUpdated = project.dateUpdated + developmentGoalCount = project.developmentGoalCount + goalCount = project.goalCount + inferencePipelineCount = project.inferencePipelineCount + links = project.links + monitoringGoalCount = project.monitoringGoalCount + name = project.name + source = project.source + taskType = project.taskType + versionCount = project.versionCount + workspaceId = project.workspaceId + description = project.description + gitRepo = project.gitRepo + additionalProperties = project.additionalProperties.toMutableMap() } /** The project id. */ fun id(id: String) = id(JsonField.of(id)) /** The project id. */ - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - /** The workspace id. */ - fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) - - /** The workspace id. */ - @JsonProperty("workspaceId") - @ExcludeMissing - fun workspaceId(workspaceId: JsonField) = apply { - this.workspaceId = workspaceId - } + /** The project creator id. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The project creator id. */ - fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) /** The project creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } - /** The project name. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The project name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) /** The project creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -852,163 +924,176 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) /** The project last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - /** The project description. */ - fun description(description: String) = description(JsonField.of(description)) + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: Long) = + developmentGoalCount(JsonField.of(developmentGoalCount)) - /** The project description. */ - @JsonProperty("description") - @ExcludeMissing - fun description(description: JsonField) = apply { - this.description = description + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: JsonField) = apply { + this.developmentGoalCount = developmentGoalCount + } + + /** The total number of tests in the project. */ + fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) + + /** The total number of tests in the project. */ + fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(inferencePipelineCount: Long) = + inferencePipelineCount(JsonField.of(inferencePipelineCount)) + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { + this.inferencePipelineCount = inferencePipelineCount } + /** Links to the project. */ + fun links(links: Links) = links(JsonField.of(links)) + + /** Links to the project. */ + fun links(links: JsonField) = apply { this.links = links } + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(monitoringGoalCount: Long) = + monitoringGoalCount(JsonField.of(monitoringGoalCount)) + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { + this.monitoringGoalCount = monitoringGoalCount + } + + /** The project name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The project name. */ + fun name(name: JsonField) = apply { this.name = name } + /** The source of the project. */ - fun source(source: Source) = source(JsonField.of(source)) + fun source(source: Source?) = source(JsonField.ofNullable(source)) + + /** The source of the project. */ + fun source(source: Optional) = source(source.orElse(null)) /** The source of the project. */ - @JsonProperty("source") - @ExcludeMissing fun source(source: JsonField) = apply { this.source = source } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) /** The task type of the project. */ - @JsonProperty("taskType") - @ExcludeMissing fun taskType(taskType: JsonField) = apply { this.taskType = taskType } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") - @ExcludeMissing fun versionCount(versionCount: JsonField) = apply { this.versionCount = versionCount } - /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(inferencePipelineCount: Long) = - inferencePipelineCount(JsonField.of(inferencePipelineCount)) - - /** The number of inference pipelines in the project. */ - @JsonProperty("inferencePipelineCount") - @ExcludeMissing - fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { - this.inferencePipelineCount = inferencePipelineCount - } - - /** The total number of tests in the project. */ - fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) - - /** The total number of tests in the project. */ - @JsonProperty("goalCount") - @ExcludeMissing - fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } + /** The workspace id. */ + fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) - /** The number of tests in the development mode of the project. */ - fun developmentGoalCount(developmentGoalCount: Long) = - developmentGoalCount(JsonField.of(developmentGoalCount)) + /** The workspace id. */ + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.orElse(null)) - /** The number of tests in the development mode of the project. */ - @JsonProperty("developmentGoalCount") - @ExcludeMissing - fun developmentGoalCount(developmentGoalCount: JsonField) = apply { - this.developmentGoalCount = developmentGoalCount + /** The workspace id. */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId } - /** The number of tests in the monitoring mode of the project. */ - fun monitoringGoalCount(monitoringGoalCount: Long) = - monitoringGoalCount(JsonField.of(monitoringGoalCount)) + /** The project description. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) - /** The number of tests in the monitoring mode of the project. */ - @JsonProperty("monitoringGoalCount") - @ExcludeMissing - fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { - this.monitoringGoalCount = monitoringGoalCount - } + /** The project description. */ + fun description(description: Optional) = description(description.orElse(null)) - /** Links to the project. */ - fun links(links: Links) = links(JsonField.of(links)) + /** The project description. */ + fun description(description: JsonField) = apply { + this.description = description + } - /** Links to the project. */ - @JsonProperty("links") - @ExcludeMissing - fun links(links: JsonField) = apply { this.links = links } + fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) - fun gitRepo(gitRepo: GitRepo) = gitRepo(JsonField.of(gitRepo)) + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.orElse(null)) - @JsonProperty("gitRepo") - @ExcludeMissing fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Project = Project( - id, - workspaceId, - creatorId, - name, - dateCreated, - dateUpdated, + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("developmentGoalCount", developmentGoalCount), + checkRequired("goalCount", goalCount), + checkRequired("inferencePipelineCount", inferencePipelineCount), + checkRequired("links", links), + checkRequired("monitoringGoalCount", monitoringGoalCount), + checkRequired("name", name), + checkRequired("source", source), + checkRequired("taskType", taskType), + checkRequired("versionCount", versionCount), + checkRequired("workspaceId", workspaceId), description, - source, - taskType, - versionCount, - inferencePipelineCount, - goalCount, - developmentGoalCount, - monitoringGoalCount, - links, gitRepo, additionalProperties.toImmutable(), ) } /** Links to the project. */ - @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect class Links + @JsonCreator private constructor( - private val app: JsonField, - private val additionalProperties: Map, + @JsonProperty("app") + @ExcludeMissing + private val app: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun app(): String = app.getRequired("app") - @JsonProperty("app") @ExcludeMissing fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Links = apply { - if (!validated) { - app() - validated = true + if (validated) { + return@apply } + + app() + validated = true } fun toBuilder() = Builder().from(this) @@ -1020,29 +1105,26 @@ private constructor( class Builder { - private var app: JsonField = JsonMissing.of() + private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) + app = links.app + additionalProperties = links.additionalProperties.toMutableMap() } fun app(app: String) = app(JsonField.of(app)) - @JsonProperty("app") - @ExcludeMissing fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1050,7 +1132,16 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toImmutable()) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Links = + Links(checkRequired("app", app), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -1070,6 +1161,7 @@ private constructor( override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } + /** The source of the project. */ class Source @JsonCreator private constructor( @@ -1133,6 +1225,7 @@ private constructor( override fun toString() = value.toString() } + /** The task type of the project. */ class TaskType @JsonCreator private constructor( @@ -1202,95 +1295,130 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = GitRepo.Builder::class) @NoAutoDetect class GitRepo + @JsonCreator private constructor( - private val id: JsonField, - private val gitId: JsonField, - private val dateConnected: JsonField, - private val dateUpdated: JsonField, - private val branch: JsonField, - private val name: JsonField, - private val private_: JsonField, - private val slug: JsonField, - private val url: JsonField, - private val rootDir: JsonField, - private val projectId: JsonField, - private val gitAccountId: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("dateConnected") + @ExcludeMissing + private val dateConnected: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("gitAccountId") + @ExcludeMissing + private val gitAccountId: JsonField = JsonMissing.of(), + @JsonProperty("gitId") + @ExcludeMissing + private val gitId: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("private") + @ExcludeMissing + private val private_: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + private val projectId: JsonField = JsonMissing.of(), + @JsonProperty("slug") + @ExcludeMissing + private val slug: JsonField = JsonMissing.of(), + @JsonProperty("url") + @ExcludeMissing + private val url: JsonField = JsonMissing.of(), + @JsonProperty("branch") + @ExcludeMissing + private val branch: JsonField = JsonMissing.of(), + @JsonProperty("rootDir") + @ExcludeMissing + private val rootDir: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): String = id.getRequired("id") - fun gitId(): Long = gitId.getRequired("gitId") - fun dateConnected(): OffsetDateTime = dateConnected.getRequired("dateConnected") fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + + fun gitId(): Long = gitId.getRequired("gitId") fun name(): String = name.getRequired("name") fun private_(): Boolean = private_.getRequired("private") + fun projectId(): String = projectId.getRequired("projectId") + fun slug(): String = slug.getRequired("slug") fun url(): String = url.getRequired("url") - fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) - - fun projectId(): String = projectId.getRequired("projectId") + fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) - fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - @JsonProperty("gitId") @ExcludeMissing fun _gitId() = gitId + @JsonProperty("dateConnected") + @ExcludeMissing + fun _dateConnected(): JsonField = dateConnected - @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected() = dateConnected + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("gitAccountId") + @ExcludeMissing + fun _gitAccountId(): JsonField = gitAccountId - @JsonProperty("branch") @ExcludeMissing fun _branch() = branch + @JsonProperty("gitId") @ExcludeMissing fun _gitId(): JsonField = gitId - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - @JsonProperty("private") @ExcludeMissing fun _private_() = private_ + @JsonProperty("private") @ExcludeMissing fun _private_(): JsonField = private_ - @JsonProperty("slug") @ExcludeMissing fun _slug() = slug + @JsonProperty("projectId") + @ExcludeMissing + fun _projectId(): JsonField = projectId - @JsonProperty("url") @ExcludeMissing fun _url() = url + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - @JsonProperty("rootDir") @ExcludeMissing fun _rootDir() = rootDir + @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch - @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId() = gitAccountId + @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): GitRepo = apply { - if (!validated) { - id() - gitId() - dateConnected() - dateUpdated() - branch() - name() - private_() - slug() - url() - rootDir() - projectId() - gitAccountId() - validated = true + if (validated) { + return@apply } + + id() + dateConnected() + dateUpdated() + gitAccountId() + gitId() + name() + private_() + projectId() + slug() + url() + branch() + rootDir() + validated = true } fun toBuilder() = Builder().from(this) @@ -1302,54 +1430,44 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var gitId: JsonField = JsonMissing.of() - private var dateConnected: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var dateConnected: JsonField? = null + private var dateUpdated: JsonField? = null + private var gitAccountId: JsonField? = null + private var gitId: JsonField? = null + private var name: JsonField? = null + private var private_: JsonField? = null + private var projectId: JsonField? = null + private var slug: JsonField? = null + private var url: JsonField? = null private var branch: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var private_: JsonField = JsonMissing.of() - private var slug: JsonField = JsonMissing.of() - private var url: JsonField = JsonMissing.of() private var rootDir: JsonField = JsonMissing.of() - private var projectId: JsonField = JsonMissing.of() - private var gitAccountId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(gitRepo: GitRepo) = apply { - this.id = gitRepo.id - this.gitId = gitRepo.gitId - this.dateConnected = gitRepo.dateConnected - this.dateUpdated = gitRepo.dateUpdated - this.branch = gitRepo.branch - this.name = gitRepo.name - this.private_ = gitRepo.private_ - this.slug = gitRepo.slug - this.url = gitRepo.url - this.rootDir = gitRepo.rootDir - this.projectId = gitRepo.projectId - this.gitAccountId = gitRepo.gitAccountId - additionalProperties(gitRepo.additionalProperties) + id = gitRepo.id + dateConnected = gitRepo.dateConnected + dateUpdated = gitRepo.dateUpdated + gitAccountId = gitRepo.gitAccountId + gitId = gitRepo.gitId + name = gitRepo.name + private_ = gitRepo.private_ + projectId = gitRepo.projectId + slug = gitRepo.slug + url = gitRepo.url + branch = gitRepo.branch + rootDir = gitRepo.rootDir + additionalProperties = gitRepo.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) - - @JsonProperty("gitId") - @ExcludeMissing - fun gitId(gitId: JsonField) = apply { this.gitId = gitId } - fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) - @JsonProperty("dateConnected") - @ExcludeMissing fun dateConnected(dateConnected: JsonField) = apply { this.dateConnected = dateConnected } @@ -1357,70 +1475,55 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - fun branch(branch: String) = branch(JsonField.of(branch)) + fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) - @JsonProperty("branch") - @ExcludeMissing - fun branch(branch: JsonField) = apply { this.branch = branch } + fun gitAccountId(gitAccountId: JsonField) = apply { + this.gitAccountId = gitAccountId + } + + fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) + + fun gitId(gitId: JsonField) = apply { this.gitId = gitId } fun name(name: String) = name(JsonField.of(name)) - @JsonProperty("name") - @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } fun private_(private_: Boolean) = private_(JsonField.of(private_)) - @JsonProperty("private") - @ExcludeMissing fun private_(private_: JsonField) = apply { this.private_ = private_ } + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + fun slug(slug: String) = slug(JsonField.of(slug)) - @JsonProperty("slug") - @ExcludeMissing fun slug(slug: JsonField) = apply { this.slug = slug } fun url(url: String) = url(JsonField.of(url)) - @JsonProperty("url") - @ExcludeMissing fun url(url: JsonField) = apply { this.url = url } - fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) - - @JsonProperty("rootDir") - @ExcludeMissing - fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } - - fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + fun branch(branch: String) = branch(JsonField.of(branch)) - @JsonProperty("projectId") - @ExcludeMissing - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + fun branch(branch: JsonField) = apply { this.branch = branch } - fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) + fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) - @JsonProperty("gitAccountId") - @ExcludeMissing - fun gitAccountId(gitAccountId: JsonField) = apply { - this.gitAccountId = gitAccountId - } + fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1428,20 +1531,28 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): GitRepo = GitRepo( - id, - gitId, - dateConnected, - dateUpdated, + checkRequired("id", id), + checkRequired("dateConnected", dateConnected), + checkRequired("dateUpdated", dateUpdated), + checkRequired("gitAccountId", gitAccountId), + checkRequired("gitId", gitId), + checkRequired("name", name), + checkRequired("private_", private_), + checkRequired("projectId", projectId), + checkRequired("slug", slug), + checkRequired("url", url), branch, - name, - private_, - slug, - url, rootDir, - projectId, - gitAccountId, additionalProperties.toImmutable(), ) } @@ -1451,17 +1562,17 @@ private constructor( return true } - return /* spotless:off */ other is GitRepo && id == other.id && gitId == other.gitId && dateConnected == other.dateConnected && dateUpdated == other.dateUpdated && branch == other.branch && name == other.name && private_ == other.private_ && slug == other.slug && url == other.url && rootDir == other.rootDir && projectId == other.projectId && gitAccountId == other.gitAccountId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GitRepo && id == other.id && dateConnected == other.dateConnected && dateUpdated == other.dateUpdated && gitAccountId == other.gitAccountId && gitId == other.gitId && name == other.name && private_ == other.private_ && projectId == other.projectId && slug == other.slug && url == other.url && branch == other.branch && rootDir == other.rootDir && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, gitId, dateConnected, dateUpdated, branch, name, private_, slug, url, rootDir, projectId, gitAccountId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dateConnected, dateUpdated, gitAccountId, gitId, name, private_, projectId, slug, url, branch, rootDir, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GitRepo{id=$id, gitId=$gitId, dateConnected=$dateConnected, dateUpdated=$dateUpdated, branch=$branch, name=$name, private_=$private_, slug=$slug, url=$url, rootDir=$rootDir, projectId=$projectId, gitAccountId=$gitAccountId, additionalProperties=$additionalProperties}" + "GitRepo{id=$id, dateConnected=$dateConnected, dateUpdated=$dateUpdated, gitAccountId=$gitAccountId, gitId=$gitId, name=$name, private_=$private_, projectId=$projectId, slug=$slug, url=$url, branch=$branch, rootDir=$rootDir, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1469,52 +1580,78 @@ private constructor( return true } - return /* spotless:off */ other is Project && id == other.id && workspaceId == other.workspaceId && creatorId == other.creatorId && name == other.name && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && description == other.description && source == other.source && taskType == other.taskType && versionCount == other.versionCount && inferencePipelineCount == other.inferencePipelineCount && goalCount == other.goalCount && developmentGoalCount == other.developmentGoalCount && monitoringGoalCount == other.monitoringGoalCount && links == other.links && gitRepo == other.gitRepo && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Project && id == other.id && creatorId == other.creatorId && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && developmentGoalCount == other.developmentGoalCount && goalCount == other.goalCount && inferencePipelineCount == other.inferencePipelineCount && links == other.links && monitoringGoalCount == other.monitoringGoalCount && name == other.name && source == other.source && taskType == other.taskType && versionCount == other.versionCount && workspaceId == other.workspaceId && description == other.description && gitRepo == other.gitRepo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, workspaceId, creatorId, name, dateCreated, dateUpdated, description, source, taskType, versionCount, inferencePipelineCount, goalCount, developmentGoalCount, monitoringGoalCount, links, gitRepo, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, creatorId, dateCreated, dateUpdated, developmentGoalCount, goalCount, inferencePipelineCount, links, monitoringGoalCount, name, source, taskType, versionCount, workspaceId, description, gitRepo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Project{id=$id, workspaceId=$workspaceId, creatorId=$creatorId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, source=$source, taskType=$taskType, versionCount=$versionCount, inferencePipelineCount=$inferencePipelineCount, goalCount=$goalCount, developmentGoalCount=$developmentGoalCount, monitoringGoalCount=$monitoringGoalCount, links=$links, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" + "Project{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, developmentGoalCount=$developmentGoalCount, goalCount=$goalCount, inferencePipelineCount=$inferencePipelineCount, links=$links, monitoringGoalCount=$monitoringGoalCount, name=$name, source=$source, taskType=$taskType, versionCount=$versionCount, workspaceId=$workspaceId, description=$description, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Workspace.Builder::class) @NoAutoDetect class Workspace + @JsonCreator private constructor( - private val id: JsonField, - private val name: JsonField, - private val slug: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val creatorId: JsonField, - private val inviteCode: JsonField, - private val wildcardDomains: JsonField>, - private val projectCount: JsonField, - private val memberCount: JsonField, - private val monthlyUsage: JsonField>, - private val inviteCount: JsonField, - private val periodStartDate: JsonField, - private val periodEndDate: JsonField, - private val samlOnlyAccess: JsonField, - private val status: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + private val creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("inviteCount") + @ExcludeMissing + private val inviteCount: JsonField = JsonMissing.of(), + @JsonProperty("memberCount") + @ExcludeMissing + private val memberCount: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("periodEndDate") + @ExcludeMissing + private val periodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("periodStartDate") + @ExcludeMissing + private val periodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("projectCount") + @ExcludeMissing + private val projectCount: JsonField = JsonMissing.of(), + @JsonProperty("slug") + @ExcludeMissing + private val slug: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonProperty("inviteCode") + @ExcludeMissing + private val inviteCode: JsonField = JsonMissing.of(), + @JsonProperty("monthlyUsage") + @ExcludeMissing + private val monthlyUsage: JsonField> = JsonMissing.of(), + @JsonProperty("samlOnlyAccess") + @ExcludeMissing + private val samlOnlyAccess: JsonField = JsonMissing.of(), + @JsonProperty("wildcardDomains") + @ExcludeMissing + private val wildcardDomains: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The workspace id. */ fun id(): String = id.getRequired("id") - /** The workspace name. */ - fun name(): String = name.getRequired("name") - - /** The workspace slug. */ - fun slug(): String = slug.getRequired("slug") + /** The workspace creator id. */ + fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) /** The workspace creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") @@ -1522,111 +1659,140 @@ private constructor( /** The workspace last updated date. */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The workspace creator id. */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - - /** The workspace invite code. */ - fun inviteCode(): Optional = - Optional.ofNullable(inviteCode.getNullable("inviteCode")) - - fun wildcardDomains(): Optional> = - Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) - - /** The number of projects in the workspace. */ - fun projectCount(): Long = projectCount.getRequired("projectCount") + /** The number of invites in the workspace. */ + fun inviteCount(): Long = inviteCount.getRequired("inviteCount") /** The number of members in the workspace. */ fun memberCount(): Long = memberCount.getRequired("memberCount") - fun monthlyUsage(): Optional> = - Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) + /** The workspace name. */ + fun name(): String = name.getRequired("name") - /** The number of invites in the workspace. */ - fun inviteCount(): Long = inviteCount.getRequired("inviteCount") + /** The end date of the current billing period. */ + fun periodEndDate(): Optional = + Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) /** The start date of the current billing period. */ fun periodStartDate(): Optional = Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) - /** The end date of the current billing period. */ - fun periodEndDate(): Optional = - Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) + /** The number of projects in the workspace. */ + fun projectCount(): Long = projectCount.getRequired("projectCount") + + /** The workspace slug. */ + fun slug(): String = slug.getRequired("slug") + + fun status(): Status = status.getRequired("status") + + /** The workspace invite code. */ + fun inviteCode(): Optional = + Optional.ofNullable(inviteCode.getNullable("inviteCode")) + + fun monthlyUsage(): Optional> = + Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) /** Whether the workspace only allows SAML authentication. */ fun samlOnlyAccess(): Optional = Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) - fun status(): Status = status.getRequired("status") + fun wildcardDomains(): Optional> = + Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) /** The workspace id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The workspace name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name - - /** The workspace slug. */ - @JsonProperty("slug") @ExcludeMissing fun _slug() = slug + /** The workspace creator id. */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId /** The workspace creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated /** The workspace last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - /** The workspace creator id. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + /** The number of invites in the workspace. */ + @JsonProperty("inviteCount") + @ExcludeMissing + fun _inviteCount(): JsonField = inviteCount - /** The workspace invite code. */ - @JsonProperty("inviteCode") @ExcludeMissing fun _inviteCode() = inviteCode + /** The number of members in the workspace. */ + @JsonProperty("memberCount") + @ExcludeMissing + fun _memberCount(): JsonField = memberCount - @JsonProperty("wildcardDomains") @ExcludeMissing fun _wildcardDomains() = wildcardDomains + /** The workspace name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The number of projects in the workspace. */ - @JsonProperty("projectCount") @ExcludeMissing fun _projectCount() = projectCount + /** The end date of the current billing period. */ + @JsonProperty("periodEndDate") + @ExcludeMissing + fun _periodEndDate(): JsonField = periodEndDate - /** The number of members in the workspace. */ - @JsonProperty("memberCount") @ExcludeMissing fun _memberCount() = memberCount + /** The start date of the current billing period. */ + @JsonProperty("periodStartDate") + @ExcludeMissing + fun _periodStartDate(): JsonField = periodStartDate - @JsonProperty("monthlyUsage") @ExcludeMissing fun _monthlyUsage() = monthlyUsage + /** The number of projects in the workspace. */ + @JsonProperty("projectCount") + @ExcludeMissing + fun _projectCount(): JsonField = projectCount - /** The number of invites in the workspace. */ - @JsonProperty("inviteCount") @ExcludeMissing fun _inviteCount() = inviteCount + /** The workspace slug. */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - /** The start date of the current billing period. */ - @JsonProperty("periodStartDate") @ExcludeMissing fun _periodStartDate() = periodStartDate + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The end date of the current billing period. */ - @JsonProperty("periodEndDate") @ExcludeMissing fun _periodEndDate() = periodEndDate + /** The workspace invite code. */ + @JsonProperty("inviteCode") + @ExcludeMissing + fun _inviteCode(): JsonField = inviteCode + + @JsonProperty("monthlyUsage") + @ExcludeMissing + fun _monthlyUsage(): JsonField> = monthlyUsage /** Whether the workspace only allows SAML authentication. */ - @JsonProperty("samlOnlyAccess") @ExcludeMissing fun _samlOnlyAccess() = samlOnlyAccess + @JsonProperty("samlOnlyAccess") + @ExcludeMissing + fun _samlOnlyAccess(): JsonField = samlOnlyAccess - @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonProperty("wildcardDomains") + @ExcludeMissing + fun _wildcardDomains(): JsonField> = wildcardDomains @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Workspace = apply { - if (!validated) { - id() - name() - slug() - dateCreated() - dateUpdated() - creatorId() - inviteCode() - wildcardDomains() - projectCount() - memberCount() - monthlyUsage().map { it.forEach { it.validate() } } - inviteCount() - periodStartDate() - periodEndDate() - samlOnlyAccess() - status() - validated = true + if (validated) { + return@apply } + + id() + creatorId() + dateCreated() + dateUpdated() + inviteCount() + memberCount() + name() + periodEndDate() + periodStartDate() + projectCount() + slug() + status() + inviteCode() + monthlyUsage().ifPresent { it.forEach { it.validate() } } + samlOnlyAccess() + wildcardDomains() + validated = true } fun toBuilder() = Builder().from(this) @@ -1638,75 +1804,64 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var slug: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() - private var creatorId: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var inviteCount: JsonField? = null + private var memberCount: JsonField? = null + private var name: JsonField? = null + private var periodEndDate: JsonField? = null + private var periodStartDate: JsonField? = null + private var projectCount: JsonField? = null + private var slug: JsonField? = null + private var status: JsonField? = null private var inviteCode: JsonField = JsonMissing.of() - private var wildcardDomains: JsonField> = JsonMissing.of() - private var projectCount: JsonField = JsonMissing.of() - private var memberCount: JsonField = JsonMissing.of() - private var monthlyUsage: JsonField> = JsonMissing.of() - private var inviteCount: JsonField = JsonMissing.of() - private var periodStartDate: JsonField = JsonMissing.of() - private var periodEndDate: JsonField = JsonMissing.of() + private var monthlyUsage: JsonField>? = null private var samlOnlyAccess: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() + private var wildcardDomains: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(workspace: Workspace) = apply { - this.id = workspace.id - this.name = workspace.name - this.slug = workspace.slug - this.dateCreated = workspace.dateCreated - this.dateUpdated = workspace.dateUpdated - this.creatorId = workspace.creatorId - this.inviteCode = workspace.inviteCode - this.wildcardDomains = workspace.wildcardDomains - this.projectCount = workspace.projectCount - this.memberCount = workspace.memberCount - this.monthlyUsage = workspace.monthlyUsage - this.inviteCount = workspace.inviteCount - this.periodStartDate = workspace.periodStartDate - this.periodEndDate = workspace.periodEndDate - this.samlOnlyAccess = workspace.samlOnlyAccess - this.status = workspace.status - additionalProperties(workspace.additionalProperties) + id = workspace.id + creatorId = workspace.creatorId + dateCreated = workspace.dateCreated + dateUpdated = workspace.dateUpdated + inviteCount = workspace.inviteCount + memberCount = workspace.memberCount + name = workspace.name + periodEndDate = workspace.periodEndDate + periodStartDate = workspace.periodStartDate + projectCount = workspace.projectCount + slug = workspace.slug + status = workspace.status + inviteCode = workspace.inviteCode + monthlyUsage = workspace.monthlyUsage.map { it.toMutableList() } + samlOnlyAccess = workspace.samlOnlyAccess + wildcardDomains = workspace.wildcardDomains.map { it.toMutableList() } + additionalProperties = workspace.additionalProperties.toMutableMap() } /** The workspace id. */ fun id(id: String) = id(JsonField.of(id)) /** The workspace id. */ - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - /** The workspace name. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The workspace name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + /** The workspace creator id. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The workspace slug. */ - fun slug(slug: String) = slug(JsonField.of(slug)) + /** The workspace creator id. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) - /** The workspace slug. */ - @JsonProperty("slug") - @ExcludeMissing - fun slug(slug: JsonField) = apply { this.slug = slug } + /** The workspace creator id. */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The workspace creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) /** The workspace creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -1715,92 +1870,96 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) /** The workspace last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - /** The workspace creator id. */ - fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) + /** The number of invites in the workspace. */ + fun inviteCount(inviteCount: Long) = inviteCount(JsonField.of(inviteCount)) - /** The workspace creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + /** The number of invites in the workspace. */ + fun inviteCount(inviteCount: JsonField) = apply { this.inviteCount = inviteCount } - /** The workspace invite code. */ - fun inviteCode(inviteCode: String) = inviteCode(JsonField.of(inviteCode)) + /** The number of members in the workspace. */ + fun memberCount(memberCount: Long) = memberCount(JsonField.of(memberCount)) - /** The workspace invite code. */ - @JsonProperty("inviteCode") - @ExcludeMissing - fun inviteCode(inviteCode: JsonField) = apply { this.inviteCode = inviteCode } + /** The number of members in the workspace. */ + fun memberCount(memberCount: JsonField) = apply { this.memberCount = memberCount } - fun wildcardDomains(wildcardDomains: List) = - wildcardDomains(JsonField.of(wildcardDomains)) + /** The workspace name. */ + fun name(name: String) = name(JsonField.of(name)) - @JsonProperty("wildcardDomains") - @ExcludeMissing - fun wildcardDomains(wildcardDomains: JsonField>) = apply { - this.wildcardDomains = wildcardDomains + /** The workspace name. */ + fun name(name: JsonField) = apply { this.name = name } + + /** The end date of the current billing period. */ + fun periodEndDate(periodEndDate: OffsetDateTime?) = + periodEndDate(JsonField.ofNullable(periodEndDate)) + + /** The end date of the current billing period. */ + fun periodEndDate(periodEndDate: Optional) = + periodEndDate(periodEndDate.orElse(null)) + + /** The end date of the current billing period. */ + fun periodEndDate(periodEndDate: JsonField) = apply { + this.periodEndDate = periodEndDate + } + + /** The start date of the current billing period. */ + fun periodStartDate(periodStartDate: OffsetDateTime?) = + periodStartDate(JsonField.ofNullable(periodStartDate)) + + /** The start date of the current billing period. */ + fun periodStartDate(periodStartDate: Optional) = + periodStartDate(periodStartDate.orElse(null)) + + /** The start date of the current billing period. */ + fun periodStartDate(periodStartDate: JsonField) = apply { + this.periodStartDate = periodStartDate } /** The number of projects in the workspace. */ fun projectCount(projectCount: Long) = projectCount(JsonField.of(projectCount)) /** The number of projects in the workspace. */ - @JsonProperty("projectCount") - @ExcludeMissing fun projectCount(projectCount: JsonField) = apply { this.projectCount = projectCount } - /** The number of members in the workspace. */ - fun memberCount(memberCount: Long) = memberCount(JsonField.of(memberCount)) + /** The workspace slug. */ + fun slug(slug: String) = slug(JsonField.of(slug)) - /** The number of members in the workspace. */ - @JsonProperty("memberCount") - @ExcludeMissing - fun memberCount(memberCount: JsonField) = apply { this.memberCount = memberCount } + /** The workspace slug. */ + fun slug(slug: JsonField) = apply { this.slug = slug } - fun monthlyUsage(monthlyUsage: List) = - monthlyUsage(JsonField.of(monthlyUsage)) + fun status(status: Status) = status(JsonField.of(status)) - @JsonProperty("monthlyUsage") - @ExcludeMissing - fun monthlyUsage(monthlyUsage: JsonField>) = apply { - this.monthlyUsage = monthlyUsage - } + fun status(status: JsonField) = apply { this.status = status } - /** The number of invites in the workspace. */ - fun inviteCount(inviteCount: Long) = inviteCount(JsonField.of(inviteCount)) + /** The workspace invite code. */ + fun inviteCode(inviteCode: String) = inviteCode(JsonField.of(inviteCode)) - /** The number of invites in the workspace. */ - @JsonProperty("inviteCount") - @ExcludeMissing - fun inviteCount(inviteCount: JsonField) = apply { this.inviteCount = inviteCount } + /** The workspace invite code. */ + fun inviteCode(inviteCode: JsonField) = apply { this.inviteCode = inviteCode } - /** The start date of the current billing period. */ - fun periodStartDate(periodStartDate: OffsetDateTime) = - periodStartDate(JsonField.of(periodStartDate)) + fun monthlyUsage(monthlyUsage: List) = + monthlyUsage(JsonField.of(monthlyUsage)) - /** The start date of the current billing period. */ - @JsonProperty("periodStartDate") - @ExcludeMissing - fun periodStartDate(periodStartDate: JsonField) = apply { - this.periodStartDate = periodStartDate + fun monthlyUsage(monthlyUsage: JsonField>) = apply { + this.monthlyUsage = monthlyUsage.map { it.toMutableList() } } - /** The end date of the current billing period. */ - fun periodEndDate(periodEndDate: OffsetDateTime) = - periodEndDate(JsonField.of(periodEndDate)) - - /** The end date of the current billing period. */ - @JsonProperty("periodEndDate") - @ExcludeMissing - fun periodEndDate(periodEndDate: JsonField) = apply { - this.periodEndDate = periodEndDate + fun addMonthlyUsage(monthlyUsage: MonthlyUsage) = apply { + this.monthlyUsage = + (this.monthlyUsage ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(monthlyUsage) + } } /** Whether the workspace only allows SAML authentication. */ @@ -1808,50 +1967,67 @@ private constructor( samlOnlyAccess(JsonField.of(samlOnlyAccess)) /** Whether the workspace only allows SAML authentication. */ - @JsonProperty("samlOnlyAccess") - @ExcludeMissing fun samlOnlyAccess(samlOnlyAccess: JsonField) = apply { this.samlOnlyAccess = samlOnlyAccess } - fun status(status: Status) = status(JsonField.of(status)) + fun wildcardDomains(wildcardDomains: List) = + wildcardDomains(JsonField.of(wildcardDomains)) - @JsonProperty("status") - @ExcludeMissing - fun status(status: JsonField) = apply { this.status = status } + fun wildcardDomains(wildcardDomains: JsonField>) = apply { + this.wildcardDomains = wildcardDomains.map { it.toMutableList() } + } + + fun addWildcardDomain(wildcardDomain: String) = apply { + wildcardDomains = + (wildcardDomains ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(wildcardDomain) + } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Workspace = Workspace( - id, - name, - slug, - dateCreated, - dateUpdated, - creatorId, + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("inviteCount", inviteCount), + checkRequired("memberCount", memberCount), + checkRequired("name", name), + checkRequired("periodEndDate", periodEndDate), + checkRequired("periodStartDate", periodStartDate), + checkRequired("projectCount", projectCount), + checkRequired("slug", slug), + checkRequired("status", status), inviteCode, - wildcardDomains.map { it.toImmutable() }, - projectCount, - memberCount, - monthlyUsage.map { it.toImmutable() }, - inviteCount, - periodStartDate, - periodEndDate, + (monthlyUsage ?: JsonMissing.of()).map { it.toImmutable() }, samlOnlyAccess, - status, + (wildcardDomains ?: JsonMissing.of()).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -1949,17 +2125,25 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = MonthlyUsage.Builder::class) @NoAutoDetect class MonthlyUsage + @JsonCreator private constructor( - private val monthYear: JsonField, - private val predictionCount: JsonField, - private val executionTimeMs: JsonField, - private val additionalProperties: Map, + @JsonProperty("executionTimeMs") + @ExcludeMissing + private val executionTimeMs: JsonField = JsonMissing.of(), + @JsonProperty("monthYear") + @ExcludeMissing + private val monthYear: JsonField = JsonMissing.of(), + @JsonProperty("predictionCount") + @ExcludeMissing + private val predictionCount: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + fun executionTimeMs(): Optional = + Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) fun monthYear(): Optional = Optional.ofNullable(monthYear.getNullable("monthYear")) @@ -1967,30 +2151,33 @@ private constructor( fun predictionCount(): Optional = Optional.ofNullable(predictionCount.getNullable("predictionCount")) - fun executionTimeMs(): Optional = - Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) - - @JsonProperty("monthYear") @ExcludeMissing fun _monthYear() = monthYear + @JsonProperty("executionTimeMs") + @ExcludeMissing + fun _executionTimeMs(): JsonField = executionTimeMs - @JsonProperty("predictionCount") + @JsonProperty("monthYear") @ExcludeMissing - fun _predictionCount() = predictionCount + fun _monthYear(): JsonField = monthYear - @JsonProperty("executionTimeMs") + @JsonProperty("predictionCount") @ExcludeMissing - fun _executionTimeMs() = executionTimeMs + fun _predictionCount(): JsonField = predictionCount @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): MonthlyUsage = apply { - if (!validated) { - monthYear() - predictionCount() - executionTimeMs() - validated = true + if (validated) { + return@apply } + + executionTimeMs() + monthYear() + predictionCount() + validated = true } fun toBuilder() = Builder().from(this) @@ -2002,23 +2189,35 @@ private constructor( class Builder { + private var executionTimeMs: JsonField = JsonMissing.of() private var monthYear: JsonField = JsonMissing.of() private var predictionCount: JsonField = JsonMissing.of() - private var executionTimeMs: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(monthlyUsage: MonthlyUsage) = apply { - this.monthYear = monthlyUsage.monthYear - this.predictionCount = monthlyUsage.predictionCount - this.executionTimeMs = monthlyUsage.executionTimeMs - additionalProperties(monthlyUsage.additionalProperties) + executionTimeMs = monthlyUsage.executionTimeMs + monthYear = monthlyUsage.monthYear + predictionCount = monthlyUsage.predictionCount + additionalProperties = monthlyUsage.additionalProperties.toMutableMap() + } + + fun executionTimeMs(executionTimeMs: Long?) = + executionTimeMs(JsonField.ofNullable(executionTimeMs)) + + fun executionTimeMs(executionTimeMs: Long) = + executionTimeMs(executionTimeMs as Long?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun executionTimeMs(executionTimeMs: Optional) = + executionTimeMs(executionTimeMs.orElse(null) as Long?) + + fun executionTimeMs(executionTimeMs: JsonField) = apply { + this.executionTimeMs = executionTimeMs } fun monthYear(monthYear: LocalDate) = monthYear(JsonField.of(monthYear)) - @JsonProperty("monthYear") - @ExcludeMissing fun monthYear(monthYear: JsonField) = apply { this.monthYear = monthYear } @@ -2026,29 +2225,17 @@ private constructor( fun predictionCount(predictionCount: Long) = predictionCount(JsonField.of(predictionCount)) - @JsonProperty("predictionCount") - @ExcludeMissing fun predictionCount(predictionCount: JsonField) = apply { this.predictionCount = predictionCount } - fun executionTimeMs(executionTimeMs: Long) = - executionTimeMs(JsonField.of(executionTimeMs)) - - @JsonProperty("executionTimeMs") - @ExcludeMissing - fun executionTimeMs(executionTimeMs: JsonField) = apply { - this.executionTimeMs = executionTimeMs - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -2056,11 +2243,19 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): MonthlyUsage = MonthlyUsage( + executionTimeMs, monthYear, predictionCount, - executionTimeMs, additionalProperties.toImmutable(), ) } @@ -2070,17 +2265,17 @@ private constructor( return true } - return /* spotless:off */ other is MonthlyUsage && monthYear == other.monthYear && predictionCount == other.predictionCount && executionTimeMs == other.executionTimeMs && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MonthlyUsage && executionTimeMs == other.executionTimeMs && monthYear == other.monthYear && predictionCount == other.predictionCount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(monthYear, predictionCount, executionTimeMs, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(executionTimeMs, monthYear, predictionCount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MonthlyUsage{monthYear=$monthYear, predictionCount=$predictionCount, executionTimeMs=$executionTimeMs, additionalProperties=$additionalProperties}" + "MonthlyUsage{executionTimeMs=$executionTimeMs, monthYear=$monthYear, predictionCount=$predictionCount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2088,17 +2283,17 @@ private constructor( return true } - return /* spotless:off */ other is Workspace && id == other.id && name == other.name && slug == other.slug && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && creatorId == other.creatorId && inviteCode == other.inviteCode && wildcardDomains == other.wildcardDomains && projectCount == other.projectCount && memberCount == other.memberCount && monthlyUsage == other.monthlyUsage && inviteCount == other.inviteCount && periodStartDate == other.periodStartDate && periodEndDate == other.periodEndDate && samlOnlyAccess == other.samlOnlyAccess && status == other.status && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Workspace && id == other.id && creatorId == other.creatorId && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && inviteCount == other.inviteCount && memberCount == other.memberCount && name == other.name && periodEndDate == other.periodEndDate && periodStartDate == other.periodStartDate && projectCount == other.projectCount && slug == other.slug && status == other.status && inviteCode == other.inviteCode && monthlyUsage == other.monthlyUsage && samlOnlyAccess == other.samlOnlyAccess && wildcardDomains == other.wildcardDomains && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, name, slug, dateCreated, dateUpdated, creatorId, inviteCode, wildcardDomains, projectCount, memberCount, monthlyUsage, inviteCount, periodStartDate, periodEndDate, samlOnlyAccess, status, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, creatorId, dateCreated, dateUpdated, inviteCount, memberCount, name, periodEndDate, periodStartDate, projectCount, slug, status, inviteCode, monthlyUsage, samlOnlyAccess, wildcardDomains, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Workspace{id=$id, name=$name, slug=$slug, dateCreated=$dateCreated, dateUpdated=$dateUpdated, creatorId=$creatorId, inviteCode=$inviteCode, wildcardDomains=$wildcardDomains, projectCount=$projectCount, memberCount=$memberCount, monthlyUsage=$monthlyUsage, inviteCount=$inviteCount, periodStartDate=$periodStartDate, periodEndDate=$periodEndDate, samlOnlyAccess=$samlOnlyAccess, status=$status, additionalProperties=$additionalProperties}" + "Workspace{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, inviteCount=$inviteCount, memberCount=$memberCount, name=$name, periodEndDate=$periodEndDate, periodStartDate=$periodStartDate, projectCount=$projectCount, slug=$slug, status=$status, inviteCode=$inviteCode, monthlyUsage=$monthlyUsage, samlOnlyAccess=$samlOnlyAccess, wildcardDomains=$wildcardDomains, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2106,15 +2301,15 @@ private constructor( return true } - return /* spotless:off */ other is InferencePipelineRetrieveResponse && id == other.id && projectId == other.projectId && workspaceId == other.workspaceId && project == other.project && workspace == other.workspace && name == other.name && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && dateLastSampleReceived == other.dateLastSampleReceived && description == other.description && dateLastEvaluated == other.dateLastEvaluated && dateOfNextEvaluation == other.dateOfNextEvaluation && passingGoalCount == other.passingGoalCount && failingGoalCount == other.failingGoalCount && totalGoalCount == other.totalGoalCount && status == other.status && statusMessage == other.statusMessage && links == other.links && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is InferencePipelineRetrieveResponse && id == other.id && dateCreated == other.dateCreated && dateLastEvaluated == other.dateLastEvaluated && dateLastSampleReceived == other.dateLastSampleReceived && dateOfNextEvaluation == other.dateOfNextEvaluation && dateUpdated == other.dateUpdated && description == other.description && failingGoalCount == other.failingGoalCount && links == other.links && name == other.name && passingGoalCount == other.passingGoalCount && projectId == other.projectId && status == other.status && statusMessage == other.statusMessage && totalGoalCount == other.totalGoalCount && project == other.project && workspace == other.workspace && workspaceId == other.workspaceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, projectId, workspaceId, project, workspace, name, dateCreated, dateUpdated, dateLastSampleReceived, description, dateLastEvaluated, dateOfNextEvaluation, passingGoalCount, failingGoalCount, totalGoalCount, status, statusMessage, links, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dateCreated, dateLastEvaluated, dateLastSampleReceived, dateOfNextEvaluation, dateUpdated, description, failingGoalCount, links, name, passingGoalCount, projectId, status, statusMessage, totalGoalCount, project, workspace, workspaceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InferencePipelineRetrieveResponse{id=$id, projectId=$projectId, workspaceId=$workspaceId, project=$project, workspace=$workspace, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, dateLastSampleReceived=$dateLastSampleReceived, description=$description, dateLastEvaluated=$dateLastEvaluated, dateOfNextEvaluation=$dateOfNextEvaluation, passingGoalCount=$passingGoalCount, failingGoalCount=$failingGoalCount, totalGoalCount=$totalGoalCount, status=$status, statusMessage=$statusMessage, links=$links, additionalProperties=$additionalProperties}" + "InferencePipelineRetrieveResponse{id=$id, dateCreated=$dateCreated, dateLastEvaluated=$dateLastEvaluated, dateLastSampleReceived=$dateLastSampleReceived, dateOfNextEvaluation=$dateOfNextEvaluation, dateUpdated=$dateUpdated, description=$description, failingGoalCount=$failingGoalCount, links=$links, name=$name, passingGoalCount=$passingGoalCount, projectId=$projectId, status=$status, statusMessage=$statusMessage, totalGoalCount=$totalGoalCount, project=$project, workspace=$workspace, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt index 763d8018..54db74f4 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt @@ -4,50 +4,49 @@ package com.openlayer.api.models import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import java.util.Objects import java.util.Optional +/** Update an inference data point in an inference pipeline. */ class InferencePipelineRowUpdateParams constructor( private val inferencePipelineId: String, private val inferenceId: String, - private val row: JsonValue, - private val config: Config?, + private val body: InferencePipelineRowUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun inferencePipelineId(): String = inferencePipelineId + /** Specify the inference id as a query param. */ fun inferenceId(): String = inferenceId - fun row(): JsonValue = row + fun _row(): JsonValue = body._row() - fun config(): Optional = Optional.ofNullable(config) + fun config(): Optional = body.config() + + fun _config(): JsonField = body._config() + + fun _additionalBodyProperties(): Map = body._additionalProperties() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): InferencePipelineRowUpdateBody { - return InferencePipelineRowUpdateBody( - row, - config, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): InferencePipelineRowUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -66,23 +65,39 @@ constructor( } } - @JsonDeserialize(builder = InferencePipelineRowUpdateBody.Builder::class) @NoAutoDetect class InferencePipelineRowUpdateBody + @JsonCreator internal constructor( - private val row: JsonValue?, - private val config: Config?, - private val additionalProperties: Map, + @JsonProperty("row") @ExcludeMissing private val row: JsonValue = JsonMissing.of(), + @JsonProperty("config") + @ExcludeMissing + private val config: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("row") fun row(): JsonValue? = row + @JsonProperty("row") @ExcludeMissing fun _row(): JsonValue = row + + fun config(): Optional = Optional.ofNullable(config.getNullable("config")) - @JsonProperty("config") fun config(): Config? = config + @JsonProperty("config") @ExcludeMissing fun _config(): JsonField = config @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + + fun validate(): InferencePipelineRowUpdateBody = apply { + if (validated) { + return@apply + } + + config().ifPresent { it.validate() } + validated = true + } + fun toBuilder() = Builder().from(this) companion object { @@ -93,38 +108,48 @@ constructor( class Builder { private var row: JsonValue? = null - private var config: Config? = null + private var config: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(inferencePipelineRowUpdateBody: InferencePipelineRowUpdateBody) = apply { - this.row = inferencePipelineRowUpdateBody.row - this.config = inferencePipelineRowUpdateBody.config - additionalProperties(inferencePipelineRowUpdateBody.additionalProperties) + row = inferencePipelineRowUpdateBody.row + config = inferencePipelineRowUpdateBody.config + additionalProperties = + inferencePipelineRowUpdateBody.additionalProperties.toMutableMap() } - @JsonProperty("row") fun row(row: JsonValue) = apply { this.row = row } + fun row(row: JsonValue) = apply { this.row = row } + + fun config(config: Config?) = config(JsonField.ofNullable(config)) + + fun config(config: Optional) = config(config.orElse(null)) - @JsonProperty("config") fun config(config: Config) = apply { this.config = config } + fun config(config: JsonField) = apply { this.config = config } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): InferencePipelineRowUpdateBody = InferencePipelineRowUpdateBody( - checkNotNull(row) { "`row` is required but was not set" }, + checkRequired("row", row), config, additionalProperties.toImmutable(), ) @@ -160,24 +185,20 @@ constructor( private var inferencePipelineId: String? = null private var inferenceId: String? = null - private var row: JsonValue? = null - private var config: Config? = null + private var body: InferencePipelineRowUpdateBody.Builder = + InferencePipelineRowUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(inferencePipelineRowUpdateParams: InferencePipelineRowUpdateParams) = apply { inferencePipelineId = inferencePipelineRowUpdateParams.inferencePipelineId inferenceId = inferencePipelineRowUpdateParams.inferenceId - row = inferencePipelineRowUpdateParams.row - config = inferencePipelineRowUpdateParams.config + body = inferencePipelineRowUpdateParams.body.toBuilder() additionalHeaders = inferencePipelineRowUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = inferencePipelineRowUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - inferencePipelineRowUpdateParams.additionalBodyProperties.toMutableMap() } fun inferencePipelineId(inferencePipelineId: String) = apply { @@ -187,9 +208,32 @@ constructor( /** Specify the inference id as a query param. */ fun inferenceId(inferenceId: String) = apply { this.inferenceId = inferenceId } - fun row(row: JsonValue) = apply { this.row = row } + fun row(row: JsonValue) = apply { body.row(row) } - fun config(config: Config) = apply { this.config = config } + fun config(config: Config?) = apply { body.config(config) } + + fun config(config: Optional) = config(config.orElse(null)) + + fun config(config: JsonField) = apply { body.config(config) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -289,83 +333,115 @@ constructor( additionalQueryParams.removeAll(keys) } - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) - } - fun build(): InferencePipelineRowUpdateParams = InferencePipelineRowUpdateParams( - checkNotNull(inferencePipelineId) { - "`inferencePipelineId` is required but was not set" - }, - checkNotNull(inferenceId) { "`inferenceId` is required but was not set" }, - checkNotNull(row) { "`row` is required but was not set" }, - config, + checkRequired("inferencePipelineId", inferencePipelineId), + checkRequired("inferenceId", inferenceId), + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } - @JsonDeserialize(builder = Config.Builder::class) @NoAutoDetect class Config + @JsonCreator private constructor( - private val inferenceIdColumnName: String?, - private val latencyColumnName: String?, - private val timestampColumnName: String?, - private val groundTruthColumnName: String?, - private val humanFeedbackColumnName: String?, - private val additionalProperties: Map, + @JsonProperty("groundTruthColumnName") + @ExcludeMissing + private val groundTruthColumnName: JsonField = JsonMissing.of(), + @JsonProperty("humanFeedbackColumnName") + @ExcludeMissing + private val humanFeedbackColumnName: JsonField = JsonMissing.of(), + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + private val inferenceIdColumnName: JsonField = JsonMissing.of(), + @JsonProperty("latencyColumnName") + @ExcludeMissing + private val latencyColumnName: JsonField = JsonMissing.of(), + @JsonProperty("timestampColumnName") + @ExcludeMissing + private val timestampColumnName: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Name of the column with the ground truths. */ + fun groundTruthColumnName(): Optional = + Optional.ofNullable(groundTruthColumnName.getNullable("groundTruthColumnName")) + + /** Name of the column with human feedback. */ + fun humanFeedbackColumnName(): Optional = + Optional.ofNullable(humanFeedbackColumnName.getNullable("humanFeedbackColumnName")) + /** * Name of the column with the inference ids. This is useful if you want to update rows at a * later point in time. If not provided, a unique id is generated by Openlayer. */ - @JsonProperty("inferenceIdColumnName") - fun inferenceIdColumnName(): String? = inferenceIdColumnName + fun inferenceIdColumnName(): Optional = + Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) /** Name of the column with the latencies. */ - @JsonProperty("latencyColumnName") fun latencyColumnName(): String? = latencyColumnName + fun latencyColumnName(): Optional = + Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) /** * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not * provided, the upload timestamp is used. */ - @JsonProperty("timestampColumnName") - fun timestampColumnName(): String? = timestampColumnName + fun timestampColumnName(): Optional = + Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) /** Name of the column with the ground truths. */ @JsonProperty("groundTruthColumnName") - fun groundTruthColumnName(): String? = groundTruthColumnName + @ExcludeMissing + fun _groundTruthColumnName(): JsonField = groundTruthColumnName /** Name of the column with human feedback. */ @JsonProperty("humanFeedbackColumnName") - fun humanFeedbackColumnName(): String? = humanFeedbackColumnName + @ExcludeMissing + fun _humanFeedbackColumnName(): JsonField = humanFeedbackColumnName + + /** + * Name of the column with the inference ids. This is useful if you want to update rows at a + * later point in time. If not provided, a unique id is generated by Openlayer. + */ + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + fun _inferenceIdColumnName(): JsonField = inferenceIdColumnName + + /** Name of the column with the latencies. */ + @JsonProperty("latencyColumnName") + @ExcludeMissing + fun _latencyColumnName(): JsonField = latencyColumnName + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. + */ + @JsonProperty("timestampColumnName") + @ExcludeMissing + fun _timestampColumnName(): JsonField = timestampColumnName @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + + fun validate(): Config = apply { + if (validated) { + return@apply + } + + groundTruthColumnName() + humanFeedbackColumnName() + inferenceIdColumnName() + latencyColumnName() + timestampColumnName() + validated = true + } + fun toBuilder() = Builder().from(this) companion object { @@ -375,35 +451,81 @@ constructor( class Builder { - private var inferenceIdColumnName: String? = null - private var latencyColumnName: String? = null - private var timestampColumnName: String? = null - private var groundTruthColumnName: String? = null - private var humanFeedbackColumnName: String? = null + private var groundTruthColumnName: JsonField = JsonMissing.of() + private var humanFeedbackColumnName: JsonField = JsonMissing.of() + private var inferenceIdColumnName: JsonField = JsonMissing.of() + private var latencyColumnName: JsonField = JsonMissing.of() + private var timestampColumnName: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(config: Config) = apply { - this.inferenceIdColumnName = config.inferenceIdColumnName - this.latencyColumnName = config.latencyColumnName - this.timestampColumnName = config.timestampColumnName - this.groundTruthColumnName = config.groundTruthColumnName - this.humanFeedbackColumnName = config.humanFeedbackColumnName - additionalProperties(config.additionalProperties) + groundTruthColumnName = config.groundTruthColumnName + humanFeedbackColumnName = config.humanFeedbackColumnName + inferenceIdColumnName = config.inferenceIdColumnName + latencyColumnName = config.latencyColumnName + timestampColumnName = config.timestampColumnName + additionalProperties = config.additionalProperties.toMutableMap() + } + + /** Name of the column with the ground truths. */ + fun groundTruthColumnName(groundTruthColumnName: String?) = + groundTruthColumnName(JsonField.ofNullable(groundTruthColumnName)) + + /** Name of the column with the ground truths. */ + fun groundTruthColumnName(groundTruthColumnName: Optional) = + groundTruthColumnName(groundTruthColumnName.orElse(null)) + + /** Name of the column with the ground truths. */ + fun groundTruthColumnName(groundTruthColumnName: JsonField) = apply { + this.groundTruthColumnName = groundTruthColumnName + } + + /** Name of the column with human feedback. */ + fun humanFeedbackColumnName(humanFeedbackColumnName: String?) = + humanFeedbackColumnName(JsonField.ofNullable(humanFeedbackColumnName)) + + /** Name of the column with human feedback. */ + fun humanFeedbackColumnName(humanFeedbackColumnName: Optional) = + humanFeedbackColumnName(humanFeedbackColumnName.orElse(null)) + + /** Name of the column with human feedback. */ + fun humanFeedbackColumnName(humanFeedbackColumnName: JsonField) = apply { + this.humanFeedbackColumnName = humanFeedbackColumnName } /** * Name of the column with the inference ids. This is useful if you want to update rows * at a later point in time. If not provided, a unique id is generated by Openlayer. */ - @JsonProperty("inferenceIdColumnName") - fun inferenceIdColumnName(inferenceIdColumnName: String) = apply { + fun inferenceIdColumnName(inferenceIdColumnName: String?) = + inferenceIdColumnName(JsonField.ofNullable(inferenceIdColumnName)) + + /** + * Name of the column with the inference ids. This is useful if you want to update rows + * at a later point in time. If not provided, a unique id is generated by Openlayer. + */ + fun inferenceIdColumnName(inferenceIdColumnName: Optional) = + inferenceIdColumnName(inferenceIdColumnName.orElse(null)) + + /** + * Name of the column with the inference ids. This is useful if you want to update rows + * at a later point in time. If not provided, a unique id is generated by Openlayer. + */ + fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { this.inferenceIdColumnName = inferenceIdColumnName } /** Name of the column with the latencies. */ - @JsonProperty("latencyColumnName") - fun latencyColumnName(latencyColumnName: String) = apply { + fun latencyColumnName(latencyColumnName: String?) = + latencyColumnName(JsonField.ofNullable(latencyColumnName)) + + /** Name of the column with the latencies. */ + fun latencyColumnName(latencyColumnName: Optional) = + latencyColumnName(latencyColumnName.orElse(null)) + + /** Name of the column with the latencies. */ + fun latencyColumnName(latencyColumnName: JsonField) = apply { this.latencyColumnName = latencyColumnName } @@ -411,44 +533,50 @@ constructor( * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not * provided, the upload timestamp is used. */ - @JsonProperty("timestampColumnName") - fun timestampColumnName(timestampColumnName: String) = apply { - this.timestampColumnName = timestampColumnName - } + fun timestampColumnName(timestampColumnName: String?) = + timestampColumnName(JsonField.ofNullable(timestampColumnName)) - /** Name of the column with the ground truths. */ - @JsonProperty("groundTruthColumnName") - fun groundTruthColumnName(groundTruthColumnName: String) = apply { - this.groundTruthColumnName = groundTruthColumnName - } + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. + */ + fun timestampColumnName(timestampColumnName: Optional) = + timestampColumnName(timestampColumnName.orElse(null)) - /** Name of the column with human feedback. */ - @JsonProperty("humanFeedbackColumnName") - fun humanFeedbackColumnName(humanFeedbackColumnName: String) = apply { - this.humanFeedbackColumnName = humanFeedbackColumnName + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. + */ + fun timestampColumnName(timestampColumnName: JsonField) = apply { + this.timestampColumnName = timestampColumnName } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Config = Config( + groundTruthColumnName, + humanFeedbackColumnName, inferenceIdColumnName, latencyColumnName, timestampColumnName, - groundTruthColumnName, - humanFeedbackColumnName, additionalProperties.toImmutable(), ) } @@ -458,17 +586,17 @@ constructor( return true } - return /* spotless:off */ other is Config && inferenceIdColumnName == other.inferenceIdColumnName && latencyColumnName == other.latencyColumnName && timestampColumnName == other.timestampColumnName && groundTruthColumnName == other.groundTruthColumnName && humanFeedbackColumnName == other.humanFeedbackColumnName && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Config && groundTruthColumnName == other.groundTruthColumnName && humanFeedbackColumnName == other.humanFeedbackColumnName && inferenceIdColumnName == other.inferenceIdColumnName && latencyColumnName == other.latencyColumnName && timestampColumnName == other.timestampColumnName && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(inferenceIdColumnName, latencyColumnName, timestampColumnName, groundTruthColumnName, humanFeedbackColumnName, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(groundTruthColumnName, humanFeedbackColumnName, inferenceIdColumnName, latencyColumnName, timestampColumnName, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Config{inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, timestampColumnName=$timestampColumnName, groundTruthColumnName=$groundTruthColumnName, humanFeedbackColumnName=$humanFeedbackColumnName, additionalProperties=$additionalProperties}" + "Config{groundTruthColumnName=$groundTruthColumnName, humanFeedbackColumnName=$humanFeedbackColumnName, inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -476,11 +604,11 @@ constructor( return true } - return /* spotless:off */ other is InferencePipelineRowUpdateParams && inferencePipelineId == other.inferencePipelineId && inferenceId == other.inferenceId && row == other.row && config == other.config && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is InferencePipelineRowUpdateParams && inferencePipelineId == other.inferencePipelineId && inferenceId == other.inferenceId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(inferencePipelineId, inferenceId, row, config, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(inferencePipelineId, inferenceId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "InferencePipelineRowUpdateParams{inferencePipelineId=$inferencePipelineId, inferenceId=$inferenceId, row=$row, config=$config, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "InferencePipelineRowUpdateParams{inferencePipelineId=$inferencePipelineId, inferenceId=$inferenceId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt index 48e69d52..2fe5f58f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt @@ -6,40 +6,45 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.Enum import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects -@JsonDeserialize(builder = InferencePipelineRowUpdateResponse.Builder::class) @NoAutoDetect class InferencePipelineRowUpdateResponse +@JsonCreator private constructor( - private val success: JsonField, - private val additionalProperties: Map, + @JsonProperty("success") + @ExcludeMissing + private val success: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun success(): Success = success.getRequired("success") - @JsonProperty("success") @ExcludeMissing fun _success() = success + @JsonProperty("success") @ExcludeMissing fun _success(): JsonField = success @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): InferencePipelineRowUpdateResponse = apply { - if (!validated) { - success() - validated = true + if (validated) { + return@apply } + + success() + validated = true } fun toBuilder() = Builder().from(this) @@ -51,38 +56,45 @@ private constructor( class Builder { - private var success: JsonField = JsonMissing.of() + private var success: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(inferencePipelineRowUpdateResponse: InferencePipelineRowUpdateResponse) = apply { - this.success = inferencePipelineRowUpdateResponse.success - additionalProperties(inferencePipelineRowUpdateResponse.additionalProperties) + success = inferencePipelineRowUpdateResponse.success + additionalProperties = + inferencePipelineRowUpdateResponse.additionalProperties.toMutableMap() } fun success(success: Success) = success(JsonField.of(success)) - @JsonProperty("success") - @ExcludeMissing fun success(success: JsonField) = apply { this.success = success } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): InferencePipelineRowUpdateResponse = - InferencePipelineRowUpdateResponse(success, additionalProperties.toImmutable()) + InferencePipelineRowUpdateResponse( + checkRequired("success", success), + additionalProperties.toImmutable() + ) } class Success diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt index 4a8df2d2..a2aad46e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt @@ -6,12 +6,14 @@ import com.fasterxml.jackson.annotation.JsonCreator import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects import java.util.Optional +/** List the latest test results for an inference pipeline. */ class InferencePipelineTestResultListParams constructor( private val inferencePipelineId: String, @@ -25,12 +27,22 @@ constructor( fun inferencePipelineId(): String = inferencePipelineId + /** The page to return in a paginated query. */ fun page(): Optional = Optional.ofNullable(page) + /** Maximum number of items to return per page. */ fun perPage(): Optional = Optional.ofNullable(perPage) + /** + * Filter list of test results by status. Available statuses are `running`, `passing`, + * `failing`, `skipped`, and `error`. + */ fun status(): Optional = Optional.ofNullable(status) + /** + * Filter objects by test type. Available types are `integrity`, `consistency`, `performance`, + * `fairness`, and `robustness`. + */ fun type(): Optional = Optional.ofNullable(type) fun _additionalHeaders(): Headers = additionalHeaders @@ -94,22 +106,48 @@ constructor( } /** The page to return in a paginated query. */ - fun page(page: Long) = apply { this.page = page } + fun page(page: Long?) = apply { this.page = page } + + /** The page to return in a paginated query. */ + fun page(page: Long) = page(page as Long?) + + /** The page to return in a paginated query. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun page(page: Optional) = page(page.orElse(null) as Long?) /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { this.perPage = perPage } + fun perPage(perPage: Long?) = apply { this.perPage = perPage } + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long) = perPage(perPage as Long?) + + /** Maximum number of items to return per page. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun perPage(perPage: Optional) = perPage(perPage.orElse(null) as Long?) + + /** + * Filter list of test results by status. Available statuses are `running`, `passing`, + * `failing`, `skipped`, and `error`. + */ + fun status(status: Status?) = apply { this.status = status } /** * Filter list of test results by status. Available statuses are `running`, `passing`, * `failing`, `skipped`, and `error`. */ - fun status(status: Status) = apply { this.status = status } + fun status(status: Optional) = status(status.orElse(null)) + + /** + * Filter objects by test type. Available types are `integrity`, `consistency`, + * `performance`, `fairness`, and `robustness`. + */ + fun type(type: Type?) = apply { this.type = type } /** * Filter objects by test type. Available types are `integrity`, `consistency`, * `performance`, `fairness`, and `robustness`. */ - fun type(type: Type) = apply { this.type = type } + fun type(type: Optional) = type(type.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -211,9 +249,7 @@ constructor( fun build(): InferencePipelineTestResultListParams = InferencePipelineTestResultListParams( - checkNotNull(inferencePipelineId) { - "`inferencePipelineId` is required but was not set" - }, + checkRequired("inferencePipelineId", inferencePipelineId), page, perPage, status, @@ -223,6 +259,10 @@ constructor( ) } + /** + * Filter list of test results by status. Available statuses are `running`, `passing`, + * `failing`, `skipped`, and `error`. + */ class Status @JsonCreator private constructor( @@ -298,6 +338,10 @@ constructor( override fun toString() = value.toString() } + /** + * Filter objects by test type. Available types are `integrity`, `consistency`, `performance`, + * `fairness`, and `robustness`. + */ class Type @JsonCreator private constructor( diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt index eea537a6..7493604c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt @@ -21,36 +21,42 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.getOrThrow +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = InferencePipelineTestResultListResponse.Builder::class) @NoAutoDetect class InferencePipelineTestResultListResponse +@JsonCreator private constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") + @ExcludeMissing + private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun items(): List = items.getRequired("items") - @JsonProperty("items") @ExcludeMissing fun _items() = items + @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): InferencePipelineTestResultListResponse = apply { - if (!validated) { - items().forEach { it.validate() } - validated = true + if (validated) { + return@apply } + + items().forEach { it.validate() } + validated = true } fun toBuilder() = Builder().from(this) @@ -62,93 +68,124 @@ private constructor( class Builder { - private var items: JsonField> = JsonMissing.of() + private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( inferencePipelineTestResultListResponse: InferencePipelineTestResultListResponse ) = apply { - this.items = inferencePipelineTestResultListResponse.items - additionalProperties(inferencePipelineTestResultListResponse.additionalProperties) + items = inferencePipelineTestResultListResponse.items.map { it.toMutableList() } + additionalProperties = + inferencePipelineTestResultListResponse.additionalProperties.toMutableMap() } fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") - @ExcludeMissing - fun items(items: JsonField>) = apply { this.items = items } + fun items(items: JsonField>) = apply { + this.items = items.map { it.toMutableList() } + } + + fun addItem(item: Item) = apply { + items = + (items ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(item) + } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): InferencePipelineTestResultListResponse = InferencePipelineTestResultListResponse( - items.map { it.toImmutable() }, + checkRequired("items", items).map { it.toImmutable() }, additionalProperties.toImmutable() ) } - @JsonDeserialize(builder = Item.Builder::class) @NoAutoDetect class Item + @JsonCreator private constructor( - private val id: JsonField, - private val goal: JsonField, - private val goalId: JsonField, - private val projectVersionId: JsonField, - private val inferencePipelineId: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val dateDataStarts: JsonField, - private val dateDataEnds: JsonField, - private val status: JsonField, - private val statusMessage: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateDataEnds") + @ExcludeMissing + private val dateDataEnds: JsonField = JsonMissing.of(), + @JsonProperty("dateDataStarts") + @ExcludeMissing + private val dateDataStarts: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineId") + @ExcludeMissing + private val inferencePipelineId: JsonField = JsonMissing.of(), + @JsonProperty("projectVersionId") + @ExcludeMissing + private val projectVersionId: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + private val statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("goal") @ExcludeMissing private val goal: JsonField = JsonMissing.of(), + @JsonProperty("goalId") + @ExcludeMissing + private val goalId: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** Project version (commit) id. */ fun id(): String = id.getRequired("id") - fun goal(): Optional = Optional.ofNullable(goal.getNullable("goal")) - - /** The test id. */ - fun goalId(): Optional = Optional.ofNullable(goalId.getNullable("goalId")) - - /** The project version (commit) id. */ - fun projectVersionId(): Optional = - Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) - - /** The inference pipeline id. */ - fun inferencePipelineId(): Optional = - Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) - /** The creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The last updated date. */ - fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** The data end date. */ + fun dateDataEnds(): Optional = + Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) /** The data start date. */ fun dateDataStarts(): Optional = Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) - /** The data end date. */ - fun dateDataEnds(): Optional = - Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) + /** The last updated date. */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** The inference pipeline id. */ + fun inferencePipelineId(): Optional = + Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) + + /** The project version (commit) id. */ + fun projectVersionId(): Optional = + Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) /** The status of the test. */ fun status(): Status = status.getRequired("status") @@ -157,59 +194,80 @@ private constructor( fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) - /** Project version (commit) id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id - - @JsonProperty("goal") @ExcludeMissing fun _goal() = goal + fun goal(): Optional = Optional.ofNullable(goal.getNullable("goal")) /** The test id. */ - @JsonProperty("goalId") @ExcludeMissing fun _goalId() = goalId + fun goalId(): Optional = Optional.ofNullable(goalId.getNullable("goalId")) - /** The project version (commit) id. */ - @JsonProperty("projectVersionId") @ExcludeMissing fun _projectVersionId() = projectVersionId + /** Project version (commit) id. */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The inference pipeline id. */ - @JsonProperty("inferencePipelineId") + /** The creation date. */ + @JsonProperty("dateCreated") @ExcludeMissing - fun _inferencePipelineId() = inferencePipelineId + fun _dateCreated(): JsonField = dateCreated - /** The creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + /** The data end date. */ + @JsonProperty("dateDataEnds") + @ExcludeMissing + fun _dateDataEnds(): JsonField = dateDataEnds + + /** The data start date. */ + @JsonProperty("dateDataStarts") + @ExcludeMissing + fun _dateDataStarts(): JsonField = dateDataStarts /** The last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - /** The data start date. */ - @JsonProperty("dateDataStarts") @ExcludeMissing fun _dateDataStarts() = dateDataStarts + /** The inference pipeline id. */ + @JsonProperty("inferencePipelineId") + @ExcludeMissing + fun _inferencePipelineId(): JsonField = inferencePipelineId - /** The data end date. */ - @JsonProperty("dateDataEnds") @ExcludeMissing fun _dateDataEnds() = dateDataEnds + /** The project version (commit) id. */ + @JsonProperty("projectVersionId") + @ExcludeMissing + fun _projectVersionId(): JsonField = projectVersionId /** The status of the test. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status /** The status message. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + + @JsonProperty("goal") @ExcludeMissing fun _goal(): JsonField = goal + + /** The test id. */ + @JsonProperty("goalId") @ExcludeMissing fun _goalId(): JsonField = goalId @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Item = apply { - if (!validated) { - id() - goal().map { it.validate() } - goalId() - projectVersionId() - inferencePipelineId() - dateCreated() - dateUpdated() - dateDataStarts() - dateDataEnds() - status() - statusMessage() - validated = true + if (validated) { + return@apply } + + id() + dateCreated() + dateDataEnds() + dateDataStarts() + dateUpdated() + inferencePipelineId() + projectVersionId() + status() + statusMessage() + goal().ifPresent { it.validate() } + goalId() + validated = true } fun toBuilder() = Builder().from(this) @@ -221,170 +279,178 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateDataEnds: JsonField? = null + private var dateDataStarts: JsonField? = null + private var dateUpdated: JsonField? = null + private var inferencePipelineId: JsonField? = null + private var projectVersionId: JsonField? = null + private var status: JsonField? = null + private var statusMessage: JsonField? = null private var goal: JsonField = JsonMissing.of() private var goalId: JsonField = JsonMissing.of() - private var projectVersionId: JsonField = JsonMissing.of() - private var inferencePipelineId: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() - private var dateDataStarts: JsonField = JsonMissing.of() - private var dateDataEnds: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var statusMessage: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(item: Item) = apply { - this.id = item.id - this.goal = item.goal - this.goalId = item.goalId - this.projectVersionId = item.projectVersionId - this.inferencePipelineId = item.inferencePipelineId - this.dateCreated = item.dateCreated - this.dateUpdated = item.dateUpdated - this.dateDataStarts = item.dateDataStarts - this.dateDataEnds = item.dateDataEnds - this.status = item.status - this.statusMessage = item.statusMessage - additionalProperties(item.additionalProperties) + id = item.id + dateCreated = item.dateCreated + dateDataEnds = item.dateDataEnds + dateDataStarts = item.dateDataStarts + dateUpdated = item.dateUpdated + inferencePipelineId = item.inferencePipelineId + projectVersionId = item.projectVersionId + status = item.status + statusMessage = item.statusMessage + goal = item.goal + goalId = item.goalId + additionalProperties = item.additionalProperties.toMutableMap() } /** Project version (commit) id. */ fun id(id: String) = id(JsonField.of(id)) /** Project version (commit) id. */ - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - fun goal(goal: Goal) = goal(JsonField.of(goal)) - - @JsonProperty("goal") - @ExcludeMissing - fun goal(goal: JsonField) = apply { this.goal = goal } + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The test id. */ - fun goalId(goalId: String) = goalId(JsonField.of(goalId)) + /** The creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } - /** The test id. */ - @JsonProperty("goalId") - @ExcludeMissing - fun goalId(goalId: JsonField) = apply { this.goalId = goalId } + /** The data end date. */ + fun dateDataEnds(dateDataEnds: OffsetDateTime?) = + dateDataEnds(JsonField.ofNullable(dateDataEnds)) - /** The project version (commit) id. */ - fun projectVersionId(projectVersionId: String) = - projectVersionId(JsonField.of(projectVersionId)) + /** The data end date. */ + fun dateDataEnds(dateDataEnds: Optional) = + dateDataEnds(dateDataEnds.orElse(null)) - /** The project version (commit) id. */ - @JsonProperty("projectVersionId") - @ExcludeMissing - fun projectVersionId(projectVersionId: JsonField) = apply { - this.projectVersionId = projectVersionId + /** The data end date. */ + fun dateDataEnds(dateDataEnds: JsonField) = apply { + this.dateDataEnds = dateDataEnds } - /** The inference pipeline id. */ - fun inferencePipelineId(inferencePipelineId: String) = - inferencePipelineId(JsonField.of(inferencePipelineId)) - - /** The inference pipeline id. */ - @JsonProperty("inferencePipelineId") - @ExcludeMissing - fun inferencePipelineId(inferencePipelineId: JsonField) = apply { - this.inferencePipelineId = inferencePipelineId - } + /** The data start date. */ + fun dateDataStarts(dateDataStarts: OffsetDateTime?) = + dateDataStarts(JsonField.ofNullable(dateDataStarts)) - /** The creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + /** The data start date. */ + fun dateDataStarts(dateDataStarts: Optional) = + dateDataStarts(dateDataStarts.orElse(null)) - /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun dateCreated(dateCreated: JsonField) = apply { - this.dateCreated = dateCreated + /** The data start date. */ + fun dateDataStarts(dateDataStarts: JsonField) = apply { + this.dateDataStarts = dateDataStarts } /** The last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - /** The data start date. */ - fun dateDataStarts(dateDataStarts: OffsetDateTime) = - dateDataStarts(JsonField.of(dateDataStarts)) + /** The inference pipeline id. */ + fun inferencePipelineId(inferencePipelineId: String?) = + inferencePipelineId(JsonField.ofNullable(inferencePipelineId)) - /** The data start date. */ - @JsonProperty("dateDataStarts") - @ExcludeMissing - fun dateDataStarts(dateDataStarts: JsonField) = apply { - this.dateDataStarts = dateDataStarts + /** The inference pipeline id. */ + fun inferencePipelineId(inferencePipelineId: Optional) = + inferencePipelineId(inferencePipelineId.orElse(null)) + + /** The inference pipeline id. */ + fun inferencePipelineId(inferencePipelineId: JsonField) = apply { + this.inferencePipelineId = inferencePipelineId } - /** The data end date. */ - fun dateDataEnds(dateDataEnds: OffsetDateTime) = - dateDataEnds(JsonField.of(dateDataEnds)) + /** The project version (commit) id. */ + fun projectVersionId(projectVersionId: String?) = + projectVersionId(JsonField.ofNullable(projectVersionId)) - /** The data end date. */ - @JsonProperty("dateDataEnds") - @ExcludeMissing - fun dateDataEnds(dateDataEnds: JsonField) = apply { - this.dateDataEnds = dateDataEnds + /** The project version (commit) id. */ + fun projectVersionId(projectVersionId: Optional) = + projectVersionId(projectVersionId.orElse(null)) + + /** The project version (commit) id. */ + fun projectVersionId(projectVersionId: JsonField) = apply { + this.projectVersionId = projectVersionId } /** The status of the test. */ fun status(status: Status) = status(JsonField.of(status)) /** The status of the test. */ - @JsonProperty("status") - @ExcludeMissing fun status(status: JsonField) = apply { this.status = status } /** The status message. */ - fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** The status message. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.orElse(null)) /** The status message. */ - @JsonProperty("statusMessage") - @ExcludeMissing fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } + fun goal(goal: Goal) = goal(JsonField.of(goal)) + + fun goal(goal: JsonField) = apply { this.goal = goal } + + /** The test id. */ + fun goalId(goalId: String?) = goalId(JsonField.ofNullable(goalId)) + + /** The test id. */ + fun goalId(goalId: Optional) = goalId(goalId.orElse(null)) + + /** The test id. */ + fun goalId(goalId: JsonField) = apply { this.goalId = goalId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Item = Item( - id, + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateDataEnds", dateDataEnds), + checkRequired("dateDataStarts", dateDataStarts), + checkRequired("dateUpdated", dateUpdated), + checkRequired("inferencePipelineId", inferencePipelineId), + checkRequired("projectVersionId", projectVersionId), + checkRequired("status", status), + checkRequired("statusMessage", statusMessage), goal, goalId, - projectVersionId, - inferencePipelineId, - dateCreated, - dateUpdated, - dateDataStarts, - dateDataEnds, - status, - statusMessage, additionalProperties.toImmutable(), ) } + /** The status of the test. */ class Status @JsonCreator private constructor( @@ -460,45 +526,93 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = Goal.Builder::class) @NoAutoDetect class Goal + @JsonCreator private constructor( - private val id: JsonField, - private val number: JsonField, - private val name: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val description: JsonValue, - private val evaluationWindow: JsonField, - private val delayWindow: JsonField, - private val type: JsonField, - private val subtype: JsonField, - private val creatorId: JsonField, - private val originProjectVersionId: JsonField, - private val thresholds: JsonField>, - private val archived: JsonField, - private val dateArchived: JsonField, - private val suggested: JsonField, - private val commentCount: JsonField, - private val usesMlModel: JsonField, - private val usesValidationDataset: JsonField, - private val usesTrainingDataset: JsonField, - private val usesReferenceDataset: JsonField, - private val usesProductionData: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("commentCount") + @ExcludeMissing + private val commentCount: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + private val creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateArchived") + @ExcludeMissing + private val dateArchived: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonValue = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("number") + @ExcludeMissing + private val number: JsonField = JsonMissing.of(), + @JsonProperty("originProjectVersionId") + @ExcludeMissing + private val originProjectVersionId: JsonField = JsonMissing.of(), + @JsonProperty("subtype") + @ExcludeMissing + private val subtype: JsonField = JsonMissing.of(), + @JsonProperty("suggested") + @ExcludeMissing + private val suggested: JsonField = JsonMissing.of(), + @JsonProperty("thresholds") + @ExcludeMissing + private val thresholds: JsonField> = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonProperty("archived") + @ExcludeMissing + private val archived: JsonField = JsonMissing.of(), + @JsonProperty("delayWindow") + @ExcludeMissing + private val delayWindow: JsonField = JsonMissing.of(), + @JsonProperty("evaluationWindow") + @ExcludeMissing + private val evaluationWindow: JsonField = JsonMissing.of(), + @JsonProperty("usesMlModel") + @ExcludeMissing + private val usesMlModel: JsonField = JsonMissing.of(), + @JsonProperty("usesProductionData") + @ExcludeMissing + private val usesProductionData: JsonField = JsonMissing.of(), + @JsonProperty("usesReferenceDataset") + @ExcludeMissing + private val usesReferenceDataset: JsonField = JsonMissing.of(), + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + private val usesTrainingDataset: JsonField = JsonMissing.of(), + @JsonProperty("usesValidationDataset") + @ExcludeMissing + private val usesValidationDataset: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The test id. */ fun id(): String = id.getRequired("id") - /** The test number. */ - fun number(): Long = number.getRequired("number") + /** The number of comments on the test. */ + fun commentCount(): Long = commentCount.getRequired("commentCount") - /** The test name. */ - fun name(): String = name.getRequired("name") + /** The test creator id. */ + fun creatorId(): Optional = + Optional.ofNullable(creatorId.getNullable("creatorId")) + + /** The date the test was archived. */ + fun dateArchived(): Optional = + Optional.ofNullable(dateArchived.getNullable("dateArchived")) /** The creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") @@ -506,170 +620,187 @@ private constructor( /** The last updated date. */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The evaluation window in seconds. Only applies to tests that use production data. */ - fun evaluationWindow(): Optional = - Optional.ofNullable(evaluationWindow.getNullable("evaluationWindow")) - - /** The delay window in seconds. Only applies to tests that use production data. */ - fun delayWindow(): Optional = - Optional.ofNullable(delayWindow.getNullable("delayWindow")) - - /** The test type. */ - fun type(): String = type.getRequired("type") + /** The test description. */ + @JsonProperty("description") @ExcludeMissing fun _description(): JsonValue = description - /** The test subtype. */ - fun subtype(): String = subtype.getRequired("subtype") + /** The test name. */ + fun name(): String = name.getRequired("name") - /** The test creator id. */ - fun creatorId(): Optional = - Optional.ofNullable(creatorId.getNullable("creatorId")) + /** The test number. */ + fun number(): Long = number.getRequired("number") /** The project version (commit) id where the test was created. */ fun originProjectVersionId(): Optional = Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) - fun thresholds(): List = thresholds.getRequired("thresholds") + /** The test subtype. */ + fun subtype(): String = subtype.getRequired("subtype") + + /** Whether the test is suggested or user-created. */ + fun suggested(): Boolean = suggested.getRequired("suggested") + + fun thresholds(): List = thresholds.getRequired("thresholds") + + /** The test type. */ + fun type(): String = type.getRequired("type") /** Whether the test is archived. */ fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) - /** The date the test was archived. */ - fun dateArchived(): Optional = - Optional.ofNullable(dateArchived.getNullable("dateArchived")) - - /** Whether the test is suggested or user-created. */ - fun suggested(): Boolean = suggested.getRequired("suggested") + /** The delay window in seconds. Only applies to tests that use production data. */ + fun delayWindow(): Optional = + Optional.ofNullable(delayWindow.getNullable("delayWindow")) - /** The number of comments on the test. */ - fun commentCount(): Long = commentCount.getRequired("commentCount") + /** The evaluation window in seconds. Only applies to tests that use production data. */ + fun evaluationWindow(): Optional = + Optional.ofNullable(evaluationWindow.getNullable("evaluationWindow")) /** Whether the test uses an ML model. */ fun usesMlModel(): Optional = Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) - /** Whether the test uses a validation dataset. */ - fun usesValidationDataset(): Optional = - Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) - - /** Whether the test uses a training dataset. */ - fun usesTrainingDataset(): Optional = - Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) + /** Whether the test uses production data (monitoring mode only). */ + fun usesProductionData(): Optional = + Optional.ofNullable(usesProductionData.getNullable("usesProductionData")) /** Whether the test uses a reference dataset (monitoring mode only). */ fun usesReferenceDataset(): Optional = Optional.ofNullable(usesReferenceDataset.getNullable("usesReferenceDataset")) - /** Whether the test uses production data (monitoring mode only). */ - fun usesProductionData(): Optional = - Optional.ofNullable(usesProductionData.getNullable("usesProductionData")) + /** Whether the test uses a training dataset. */ + fun usesTrainingDataset(): Optional = + Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) + + /** Whether the test uses a validation dataset. */ + fun usesValidationDataset(): Optional = + Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) /** The test id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The test number. */ - @JsonProperty("number") @ExcludeMissing fun _number() = number + /** The number of comments on the test. */ + @JsonProperty("commentCount") + @ExcludeMissing + fun _commentCount(): JsonField = commentCount - /** The test name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + /** The test creator id. */ + @JsonProperty("creatorId") + @ExcludeMissing + fun _creatorId(): JsonField = creatorId + + /** The date the test was archived. */ + @JsonProperty("dateArchived") + @ExcludeMissing + fun _dateArchived(): JsonField = dateArchived /** The creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated - - /** The test description. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description - - /** The evaluation window in seconds. Only applies to tests that use production data. */ - @JsonProperty("evaluationWindow") + @JsonProperty("dateUpdated") @ExcludeMissing - fun _evaluationWindow() = evaluationWindow + fun _dateUpdated(): JsonField = dateUpdated - /** The delay window in seconds. Only applies to tests that use production data. */ - @JsonProperty("delayWindow") @ExcludeMissing fun _delayWindow() = delayWindow + /** The test name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The test type. */ - @JsonProperty("type") @ExcludeMissing fun _type() = type + /** The test number. */ + @JsonProperty("number") @ExcludeMissing fun _number(): JsonField = number + + /** The project version (commit) id where the test was created. */ + @JsonProperty("originProjectVersionId") + @ExcludeMissing + fun _originProjectVersionId(): JsonField = originProjectVersionId /** The test subtype. */ - @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype + @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype - /** The test creator id. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + /** Whether the test is suggested or user-created. */ + @JsonProperty("suggested") + @ExcludeMissing + fun _suggested(): JsonField = suggested - /** The project version (commit) id where the test was created. */ - @JsonProperty("originProjectVersionId") + @JsonProperty("thresholds") @ExcludeMissing - fun _originProjectVersionId() = originProjectVersionId + fun _thresholds(): JsonField> = thresholds - @JsonProperty("thresholds") @ExcludeMissing fun _thresholds() = thresholds + /** The test type. */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type /** Whether the test is archived. */ - @JsonProperty("archived") @ExcludeMissing fun _archived() = archived + @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived - /** The date the test was archived. */ - @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived() = dateArchived - - /** Whether the test is suggested or user-created. */ - @JsonProperty("suggested") @ExcludeMissing fun _suggested() = suggested + /** The delay window in seconds. Only applies to tests that use production data. */ + @JsonProperty("delayWindow") + @ExcludeMissing + fun _delayWindow(): JsonField = delayWindow - /** The number of comments on the test. */ - @JsonProperty("commentCount") @ExcludeMissing fun _commentCount() = commentCount + /** The evaluation window in seconds. Only applies to tests that use production data. */ + @JsonProperty("evaluationWindow") + @ExcludeMissing + fun _evaluationWindow(): JsonField = evaluationWindow /** Whether the test uses an ML model. */ - @JsonProperty("usesMlModel") @ExcludeMissing fun _usesMlModel() = usesMlModel - - /** Whether the test uses a validation dataset. */ - @JsonProperty("usesValidationDataset") + @JsonProperty("usesMlModel") @ExcludeMissing - fun _usesValidationDataset() = usesValidationDataset + fun _usesMlModel(): JsonField = usesMlModel - /** Whether the test uses a training dataset. */ - @JsonProperty("usesTrainingDataset") + /** Whether the test uses production data (monitoring mode only). */ + @JsonProperty("usesProductionData") @ExcludeMissing - fun _usesTrainingDataset() = usesTrainingDataset + fun _usesProductionData(): JsonField = usesProductionData /** Whether the test uses a reference dataset (monitoring mode only). */ @JsonProperty("usesReferenceDataset") @ExcludeMissing - fun _usesReferenceDataset() = usesReferenceDataset + fun _usesReferenceDataset(): JsonField = usesReferenceDataset - /** Whether the test uses production data (monitoring mode only). */ - @JsonProperty("usesProductionData") + /** Whether the test uses a training dataset. */ + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + fun _usesTrainingDataset(): JsonField = usesTrainingDataset + + /** Whether the test uses a validation dataset. */ + @JsonProperty("usesValidationDataset") @ExcludeMissing - fun _usesProductionData() = usesProductionData + fun _usesValidationDataset(): JsonField = usesValidationDataset @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Goal = apply { - if (!validated) { - id() - number() - name() - dateCreated() - dateUpdated() - evaluationWindow() - delayWindow() - type() - subtype() - creatorId() - originProjectVersionId() - thresholds().forEach { it.validate() } - archived() - dateArchived() - suggested() - commentCount() - usesMlModel() - usesValidationDataset() - usesTrainingDataset() - usesReferenceDataset() - usesProductionData() - validated = true + if (validated) { + return@apply } + + id() + commentCount() + creatorId() + dateArchived() + dateCreated() + dateUpdated() + name() + number() + originProjectVersionId() + subtype() + suggested() + thresholds().forEach { it.validate() } + type() + archived() + delayWindow() + evaluationWindow() + usesMlModel() + usesProductionData() + usesReferenceDataset() + usesTrainingDataset() + usesValidationDataset() + validated = true } fun toBuilder() = Builder().from(this) @@ -681,88 +812,98 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var number: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() - private var description: JsonValue = JsonMissing.of() - private var evaluationWindow: JsonField = JsonMissing.of() - private var delayWindow: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() - private var subtype: JsonField = JsonMissing.of() - private var creatorId: JsonField = JsonMissing.of() - private var originProjectVersionId: JsonField = JsonMissing.of() - private var thresholds: JsonField> = JsonMissing.of() + private var id: JsonField? = null + private var commentCount: JsonField? = null + private var creatorId: JsonField? = null + private var dateArchived: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var description: JsonValue? = null + private var name: JsonField? = null + private var number: JsonField? = null + private var originProjectVersionId: JsonField? = null + private var subtype: JsonField? = null + private var suggested: JsonField? = null + private var thresholds: JsonField>? = null + private var type: JsonField? = null private var archived: JsonField = JsonMissing.of() - private var dateArchived: JsonField = JsonMissing.of() - private var suggested: JsonField = JsonMissing.of() - private var commentCount: JsonField = JsonMissing.of() + private var delayWindow: JsonField = JsonMissing.of() + private var evaluationWindow: JsonField = JsonMissing.of() private var usesMlModel: JsonField = JsonMissing.of() - private var usesValidationDataset: JsonField = JsonMissing.of() - private var usesTrainingDataset: JsonField = JsonMissing.of() - private var usesReferenceDataset: JsonField = JsonMissing.of() private var usesProductionData: JsonField = JsonMissing.of() + private var usesReferenceDataset: JsonField = JsonMissing.of() + private var usesTrainingDataset: JsonField = JsonMissing.of() + private var usesValidationDataset: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(goal: Goal) = apply { - this.id = goal.id - this.number = goal.number - this.name = goal.name - this.dateCreated = goal.dateCreated - this.dateUpdated = goal.dateUpdated - this.description = goal.description - this.evaluationWindow = goal.evaluationWindow - this.delayWindow = goal.delayWindow - this.type = goal.type - this.subtype = goal.subtype - this.creatorId = goal.creatorId - this.originProjectVersionId = goal.originProjectVersionId - this.thresholds = goal.thresholds - this.archived = goal.archived - this.dateArchived = goal.dateArchived - this.suggested = goal.suggested - this.commentCount = goal.commentCount - this.usesMlModel = goal.usesMlModel - this.usesValidationDataset = goal.usesValidationDataset - this.usesTrainingDataset = goal.usesTrainingDataset - this.usesReferenceDataset = goal.usesReferenceDataset - this.usesProductionData = goal.usesProductionData - additionalProperties(goal.additionalProperties) + id = goal.id + commentCount = goal.commentCount + creatorId = goal.creatorId + dateArchived = goal.dateArchived + dateCreated = goal.dateCreated + dateUpdated = goal.dateUpdated + description = goal.description + name = goal.name + number = goal.number + originProjectVersionId = goal.originProjectVersionId + subtype = goal.subtype + suggested = goal.suggested + thresholds = goal.thresholds.map { it.toMutableList() } + type = goal.type + archived = goal.archived + delayWindow = goal.delayWindow + evaluationWindow = goal.evaluationWindow + usesMlModel = goal.usesMlModel + usesProductionData = goal.usesProductionData + usesReferenceDataset = goal.usesReferenceDataset + usesTrainingDataset = goal.usesTrainingDataset + usesValidationDataset = goal.usesValidationDataset + additionalProperties = goal.additionalProperties.toMutableMap() } /** The test id. */ fun id(id: String) = id(JsonField.of(id)) /** The test id. */ - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - /** The test number. */ - fun number(number: Long) = number(JsonField.of(number)) + /** The number of comments on the test. */ + fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) - /** The test number. */ - @JsonProperty("number") - @ExcludeMissing - fun number(number: JsonField) = apply { this.number = number } + /** The number of comments on the test. */ + fun commentCount(commentCount: JsonField) = apply { + this.commentCount = commentCount + } - /** The test name. */ - fun name(name: String) = name(JsonField.of(name)) + /** The test creator id. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The test name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + /** The test creator id. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + + /** The test creator id. */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The date the test was archived. */ + fun dateArchived(dateArchived: OffsetDateTime?) = + dateArchived(JsonField.ofNullable(dateArchived)) + + /** The date the test was archived. */ + fun dateArchived(dateArchived: Optional) = + dateArchived(dateArchived.orElse(null)) + + /** The date the test was archived. */ + fun dateArchived(dateArchived: JsonField) = apply { + this.dateArchived = dateArchived + } /** The creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -772,152 +913,139 @@ private constructor( dateUpdated(JsonField.of(dateUpdated)) /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } /** The test description. */ - @JsonProperty("description") - @ExcludeMissing fun description(description: JsonValue) = apply { this.description = description } - /** - * The evaluation window in seconds. Only applies to tests that use production data. - */ - fun evaluationWindow(evaluationWindow: Double) = - evaluationWindow(JsonField.of(evaluationWindow)) + /** The test name. */ + fun name(name: String) = name(JsonField.of(name)) - /** - * The evaluation window in seconds. Only applies to tests that use production data. - */ - @JsonProperty("evaluationWindow") - @ExcludeMissing - fun evaluationWindow(evaluationWindow: JsonField) = apply { - this.evaluationWindow = evaluationWindow - } + /** The test name. */ + fun name(name: JsonField) = apply { this.name = name } - /** The delay window in seconds. Only applies to tests that use production data. */ - fun delayWindow(delayWindow: Double) = delayWindow(JsonField.of(delayWindow)) + /** The test number. */ + fun number(number: Long) = number(JsonField.of(number)) - /** The delay window in seconds. Only applies to tests that use production data. */ - @JsonProperty("delayWindow") - @ExcludeMissing - fun delayWindow(delayWindow: JsonField) = apply { - this.delayWindow = delayWindow - } + /** The test number. */ + fun number(number: JsonField) = apply { this.number = number } - /** The test type. */ - fun type(type: String) = type(JsonField.of(type)) + /** The project version (commit) id where the test was created. */ + fun originProjectVersionId(originProjectVersionId: String?) = + originProjectVersionId(JsonField.ofNullable(originProjectVersionId)) - /** The test type. */ - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } + /** The project version (commit) id where the test was created. */ + fun originProjectVersionId(originProjectVersionId: Optional) = + originProjectVersionId(originProjectVersionId.orElse(null)) + + /** The project version (commit) id where the test was created. */ + fun originProjectVersionId(originProjectVersionId: JsonField) = apply { + this.originProjectVersionId = originProjectVersionId + } /** The test subtype. */ fun subtype(subtype: String) = subtype(JsonField.of(subtype)) /** The test subtype. */ - @JsonProperty("subtype") - @ExcludeMissing fun subtype(subtype: JsonField) = apply { this.subtype = subtype } - /** The test creator id. */ - fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) - - /** The test creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } - - /** The project version (commit) id where the test was created. */ - fun originProjectVersionId(originProjectVersionId: String) = - originProjectVersionId(JsonField.of(originProjectVersionId)) + /** Whether the test is suggested or user-created. */ + fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) - /** The project version (commit) id where the test was created. */ - @JsonProperty("originProjectVersionId") - @ExcludeMissing - fun originProjectVersionId(originProjectVersionId: JsonField) = apply { - this.originProjectVersionId = originProjectVersionId - } + /** Whether the test is suggested or user-created. */ + fun suggested(suggested: JsonField) = apply { this.suggested = suggested } fun thresholds(thresholds: List) = thresholds(JsonField.of(thresholds)) - @JsonProperty("thresholds") - @ExcludeMissing fun thresholds(thresholds: JsonField>) = apply { - this.thresholds = thresholds + this.thresholds = thresholds.map { it.toMutableList() } + } + + fun addThreshold(threshold: Threshold) = apply { + thresholds = + (thresholds ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(threshold) + } } + /** The test type. */ + fun type(type: String) = type(JsonField.of(type)) + + /** The test type. */ + fun type(type: JsonField) = apply { this.type = type } + /** Whether the test is archived. */ fun archived(archived: Boolean) = archived(JsonField.of(archived)) /** Whether the test is archived. */ - @JsonProperty("archived") - @ExcludeMissing fun archived(archived: JsonField) = apply { this.archived = archived } - /** The date the test was archived. */ - fun dateArchived(dateArchived: OffsetDateTime) = - dateArchived(JsonField.of(dateArchived)) + /** The delay window in seconds. Only applies to tests that use production data. */ + fun delayWindow(delayWindow: Double?) = + delayWindow(JsonField.ofNullable(delayWindow)) - /** The date the test was archived. */ - @JsonProperty("dateArchived") - @ExcludeMissing - fun dateArchived(dateArchived: JsonField) = apply { - this.dateArchived = dateArchived + /** The delay window in seconds. Only applies to tests that use production data. */ + fun delayWindow(delayWindow: Double) = delayWindow(delayWindow as Double?) + + /** The delay window in seconds. Only applies to tests that use production data. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun delayWindow(delayWindow: Optional) = + delayWindow(delayWindow.orElse(null) as Double?) + + /** The delay window in seconds. Only applies to tests that use production data. */ + fun delayWindow(delayWindow: JsonField) = apply { + this.delayWindow = delayWindow } - /** Whether the test is suggested or user-created. */ - fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) + /** + * The evaluation window in seconds. Only applies to tests that use production data. + */ + fun evaluationWindow(evaluationWindow: Double?) = + evaluationWindow(JsonField.ofNullable(evaluationWindow)) - /** Whether the test is suggested or user-created. */ - @JsonProperty("suggested") - @ExcludeMissing - fun suggested(suggested: JsonField) = apply { this.suggested = suggested } + /** + * The evaluation window in seconds. Only applies to tests that use production data. + */ + fun evaluationWindow(evaluationWindow: Double) = + evaluationWindow(evaluationWindow as Double?) - /** The number of comments on the test. */ - fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) + /** + * The evaluation window in seconds. Only applies to tests that use production data. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun evaluationWindow(evaluationWindow: Optional) = + evaluationWindow(evaluationWindow.orElse(null) as Double?) - /** The number of comments on the test. */ - @JsonProperty("commentCount") - @ExcludeMissing - fun commentCount(commentCount: JsonField) = apply { - this.commentCount = commentCount + /** + * The evaluation window in seconds. Only applies to tests that use production data. + */ + fun evaluationWindow(evaluationWindow: JsonField) = apply { + this.evaluationWindow = evaluationWindow } /** Whether the test uses an ML model. */ fun usesMlModel(usesMlModel: Boolean) = usesMlModel(JsonField.of(usesMlModel)) /** Whether the test uses an ML model. */ - @JsonProperty("usesMlModel") - @ExcludeMissing fun usesMlModel(usesMlModel: JsonField) = apply { this.usesMlModel = usesMlModel } - /** Whether the test uses a validation dataset. */ - fun usesValidationDataset(usesValidationDataset: Boolean) = - usesValidationDataset(JsonField.of(usesValidationDataset)) - - /** Whether the test uses a validation dataset. */ - @JsonProperty("usesValidationDataset") - @ExcludeMissing - fun usesValidationDataset(usesValidationDataset: JsonField) = apply { - this.usesValidationDataset = usesValidationDataset - } - - /** Whether the test uses a training dataset. */ - fun usesTrainingDataset(usesTrainingDataset: Boolean) = - usesTrainingDataset(JsonField.of(usesTrainingDataset)) + /** Whether the test uses production data (monitoring mode only). */ + fun usesProductionData(usesProductionData: Boolean) = + usesProductionData(JsonField.of(usesProductionData)) - /** Whether the test uses a training dataset. */ - @JsonProperty("usesTrainingDataset") - @ExcludeMissing - fun usesTrainingDataset(usesTrainingDataset: JsonField) = apply { - this.usesTrainingDataset = usesTrainingDataset + /** Whether the test uses production data (monitoring mode only). */ + fun usesProductionData(usesProductionData: JsonField) = apply { + this.usesProductionData = usesProductionData } /** Whether the test uses a reference dataset (monitoring mode only). */ @@ -925,31 +1053,35 @@ private constructor( usesReferenceDataset(JsonField.of(usesReferenceDataset)) /** Whether the test uses a reference dataset (monitoring mode only). */ - @JsonProperty("usesReferenceDataset") - @ExcludeMissing fun usesReferenceDataset(usesReferenceDataset: JsonField) = apply { this.usesReferenceDataset = usesReferenceDataset } - /** Whether the test uses production data (monitoring mode only). */ - fun usesProductionData(usesProductionData: Boolean) = - usesProductionData(JsonField.of(usesProductionData)) + /** Whether the test uses a training dataset. */ + fun usesTrainingDataset(usesTrainingDataset: Boolean) = + usesTrainingDataset(JsonField.of(usesTrainingDataset)) - /** Whether the test uses production data (monitoring mode only). */ - @JsonProperty("usesProductionData") - @ExcludeMissing - fun usesProductionData(usesProductionData: JsonField) = apply { - this.usesProductionData = usesProductionData + /** Whether the test uses a training dataset. */ + fun usesTrainingDataset(usesTrainingDataset: JsonField) = apply { + this.usesTrainingDataset = usesTrainingDataset + } + + /** Whether the test uses a validation dataset. */ + fun usesValidationDataset(usesValidationDataset: Boolean) = + usesValidationDataset(JsonField.of(usesValidationDataset)) + + /** Whether the test uses a validation dataset. */ + fun usesValidationDataset(usesValidationDataset: JsonField) = apply { + this.usesValidationDataset = usesValidationDataset } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -957,52 +1089,65 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Goal = Goal( - id, - number, - name, - dateCreated, - dateUpdated, - description, - evaluationWindow, - delayWindow, - type, - subtype, - creatorId, - originProjectVersionId, - thresholds.map { it.toImmutable() }, + checkRequired("id", id), + checkRequired("commentCount", commentCount), + checkRequired("creatorId", creatorId), + checkRequired("dateArchived", dateArchived), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("description", description), + checkRequired("name", name), + checkRequired("number", number), + checkRequired("originProjectVersionId", originProjectVersionId), + checkRequired("subtype", subtype), + checkRequired("suggested", suggested), + checkRequired("thresholds", thresholds).map { it.toImmutable() }, + checkRequired("type", type), archived, - dateArchived, - suggested, - commentCount, + delayWindow, + evaluationWindow, usesMlModel, - usesValidationDataset, - usesTrainingDataset, - usesReferenceDataset, usesProductionData, + usesReferenceDataset, + usesTrainingDataset, + usesValidationDataset, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Threshold.Builder::class) @NoAutoDetect class Threshold + @JsonCreator private constructor( - private val measurement: JsonField, - private val insightName: JsonField, - private val insightParameters: JsonField>, - private val operator: JsonField, - private val value: JsonField, - private val additionalProperties: Map, + @JsonProperty("insightName") + @ExcludeMissing + private val insightName: JsonField = JsonMissing.of(), + @JsonProperty("insightParameters") + @ExcludeMissing + private val insightParameters: JsonField> = JsonMissing.of(), + @JsonProperty("measurement") + @ExcludeMissing + private val measurement: JsonField = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + private val operator: JsonField = JsonMissing.of(), + @JsonProperty("value") + @ExcludeMissing + private val value: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** The measurement to be evaluated. */ - fun measurement(): Optional = - Optional.ofNullable(measurement.getNullable("measurement")) - /** The insight name to be evaluated. */ fun insightName(): Optional = Optional.ofNullable(insightName.getNullable("insightName")) @@ -1010,6 +1155,10 @@ private constructor( fun insightParameters(): Optional> = Optional.ofNullable(insightParameters.getNullable("insightParameters")) + /** The measurement to be evaluated. */ + fun measurement(): Optional = + Optional.ofNullable(measurement.getNullable("measurement")) + /** The operator to be used for the evaluation. */ fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) @@ -1017,35 +1166,45 @@ private constructor( /** The value to be compared. */ fun value(): Optional = Optional.ofNullable(value.getNullable("value")) - /** The measurement to be evaluated. */ - @JsonProperty("measurement") @ExcludeMissing fun _measurement() = measurement - /** The insight name to be evaluated. */ - @JsonProperty("insightName") @ExcludeMissing fun _insightName() = insightName + @JsonProperty("insightName") + @ExcludeMissing + fun _insightName(): JsonField = insightName @JsonProperty("insightParameters") @ExcludeMissing - fun _insightParameters() = insightParameters + fun _insightParameters(): JsonField> = insightParameters + + /** The measurement to be evaluated. */ + @JsonProperty("measurement") + @ExcludeMissing + fun _measurement(): JsonField = measurement /** The operator to be used for the evaluation. */ - @JsonProperty("operator") @ExcludeMissing fun _operator() = operator + @JsonProperty("operator") + @ExcludeMissing + fun _operator(): JsonField = operator /** The value to be compared. */ - @JsonProperty("value") @ExcludeMissing fun _value() = value + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Threshold = apply { - if (!validated) { - measurement() - insightName() - insightParameters() - operator() - value() - validated = true + if (validated) { + return@apply } + + insightName() + insightParameters() + measurement() + operator() + value().ifPresent { it.validate() } + validated = true } fun toBuilder() = Builder().from(this) @@ -1057,39 +1216,27 @@ private constructor( class Builder { - private var measurement: JsonField = JsonMissing.of() private var insightName: JsonField = JsonMissing.of() - private var insightParameters: JsonField> = JsonMissing.of() + private var insightParameters: JsonField>? = null + private var measurement: JsonField = JsonMissing.of() private var operator: JsonField = JsonMissing.of() private var value: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(threshold: Threshold) = apply { - this.measurement = threshold.measurement - this.insightName = threshold.insightName - this.insightParameters = threshold.insightParameters - this.operator = threshold.operator - this.value = threshold.value - additionalProperties(threshold.additionalProperties) - } - - /** The measurement to be evaluated. */ - fun measurement(measurement: String) = measurement(JsonField.of(measurement)) - - /** The measurement to be evaluated. */ - @JsonProperty("measurement") - @ExcludeMissing - fun measurement(measurement: JsonField) = apply { - this.measurement = measurement + insightName = threshold.insightName + insightParameters = threshold.insightParameters.map { it.toMutableList() } + measurement = threshold.measurement + operator = threshold.operator + value = threshold.value + additionalProperties = threshold.additionalProperties.toMutableMap() } /** The insight name to be evaluated. */ fun insightName(insightName: String) = insightName(JsonField.of(insightName)) /** The insight name to be evaluated. */ - @JsonProperty("insightName") - @ExcludeMissing fun insightName(insightName: JsonField) = apply { this.insightName = insightName } @@ -1097,36 +1244,62 @@ private constructor( fun insightParameters(insightParameters: List) = insightParameters(JsonField.of(insightParameters)) - @JsonProperty("insightParameters") - @ExcludeMissing fun insightParameters(insightParameters: JsonField>) = apply { - this.insightParameters = insightParameters + this.insightParameters = insightParameters.map { it.toMutableList() } + } + + fun addInsightParameter(insightParameter: JsonValue) = apply { + insightParameters = + (insightParameters ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(insightParameter) + } + } + + /** The measurement to be evaluated. */ + fun measurement(measurement: String) = measurement(JsonField.of(measurement)) + + /** The measurement to be evaluated. */ + fun measurement(measurement: JsonField) = apply { + this.measurement = measurement } /** The operator to be used for the evaluation. */ fun operator(operator: String) = operator(JsonField.of(operator)) /** The operator to be used for the evaluation. */ - @JsonProperty("operator") - @ExcludeMissing fun operator(operator: JsonField) = apply { this.operator = operator } /** The value to be compared. */ fun value(value: Value) = value(JsonField.of(value)) /** The value to be compared. */ - @JsonProperty("value") - @ExcludeMissing fun value(value: JsonField) = apply { this.value = value } + /** The value to be compared. */ + fun value(number: Double) = value(Value.ofNumber(number)) + + /** The value to be compared. */ + fun value(bool: Boolean) = value(Value.ofBool(bool)) + + /** The value to be compared. */ + fun value(string: String) = value(Value.ofString(string)) + + /** The value to be compared. */ + fun valueOfStrings(strings: List) = value(Value.ofStrings(strings)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1134,17 +1307,26 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Threshold = Threshold( - measurement, insightName, - insightParameters.map { it.toImmutable() }, + (insightParameters ?: JsonMissing.of()).map { it.toImmutable() }, + measurement, operator, value, additionalProperties.toImmutable(), ) } + /** The value to be compared. */ @JsonDeserialize(using = Value.Deserializer::class) @JsonSerialize(using = Value.Serializer::class) class Value @@ -1156,8 +1338,6 @@ private constructor( private val _json: JsonValue? = null, ) { - private var validated: Boolean = false - fun number(): Optional = Optional.ofNullable(number) fun bool(): Optional = Optional.ofNullable(bool) @@ -1194,15 +1374,25 @@ private constructor( } } + private var validated: Boolean = false + fun validate(): Value = apply { - if (!validated) { - if ( - number == null && bool == null && string == null && strings == null - ) { - throw OpenlayerInvalidDataException("Unknown Value: $_json") - } - validated = true + if (validated) { + return@apply } + + accept( + object : Visitor { + override fun visitNumber(number: Double) {} + + override fun visitBool(bool: Boolean) {} + + override fun visitString(string: String) {} + + override fun visitStrings(strings: List) {} + } + ) + validated = true } override fun equals(other: Any?): Boolean { @@ -1297,17 +1487,17 @@ private constructor( return true } - return /* spotless:off */ other is Threshold && measurement == other.measurement && insightName == other.insightName && insightParameters == other.insightParameters && operator == other.operator && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Threshold && insightName == other.insightName && insightParameters == other.insightParameters && measurement == other.measurement && operator == other.operator && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(measurement, insightName, insightParameters, operator, value, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(insightName, insightParameters, measurement, operator, value, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + "Threshold{insightName=$insightName, insightParameters=$insightParameters, measurement=$measurement, operator=$operator, value=$value, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1315,17 +1505,17 @@ private constructor( return true } - return /* spotless:off */ other is Goal && id == other.id && number == other.number && name == other.name && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && description == other.description && evaluationWindow == other.evaluationWindow && delayWindow == other.delayWindow && type == other.type && subtype == other.subtype && creatorId == other.creatorId && originProjectVersionId == other.originProjectVersionId && thresholds == other.thresholds && archived == other.archived && dateArchived == other.dateArchived && suggested == other.suggested && commentCount == other.commentCount && usesMlModel == other.usesMlModel && usesValidationDataset == other.usesValidationDataset && usesTrainingDataset == other.usesTrainingDataset && usesReferenceDataset == other.usesReferenceDataset && usesProductionData == other.usesProductionData && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Goal && id == other.id && commentCount == other.commentCount && creatorId == other.creatorId && dateArchived == other.dateArchived && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && description == other.description && name == other.name && number == other.number && originProjectVersionId == other.originProjectVersionId && subtype == other.subtype && suggested == other.suggested && thresholds == other.thresholds && type == other.type && archived == other.archived && delayWindow == other.delayWindow && evaluationWindow == other.evaluationWindow && usesMlModel == other.usesMlModel && usesProductionData == other.usesProductionData && usesReferenceDataset == other.usesReferenceDataset && usesTrainingDataset == other.usesTrainingDataset && usesValidationDataset == other.usesValidationDataset && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, number, name, dateCreated, dateUpdated, description, evaluationWindow, delayWindow, type, subtype, creatorId, originProjectVersionId, thresholds, archived, dateArchived, suggested, commentCount, usesMlModel, usesValidationDataset, usesTrainingDataset, usesReferenceDataset, usesProductionData, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, commentCount, creatorId, dateArchived, dateCreated, dateUpdated, description, name, number, originProjectVersionId, subtype, suggested, thresholds, type, archived, delayWindow, evaluationWindow, usesMlModel, usesProductionData, usesReferenceDataset, usesTrainingDataset, usesValidationDataset, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Goal{id=$id, number=$number, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, evaluationWindow=$evaluationWindow, delayWindow=$delayWindow, type=$type, subtype=$subtype, creatorId=$creatorId, originProjectVersionId=$originProjectVersionId, thresholds=$thresholds, archived=$archived, dateArchived=$dateArchived, suggested=$suggested, commentCount=$commentCount, usesMlModel=$usesMlModel, usesValidationDataset=$usesValidationDataset, usesTrainingDataset=$usesTrainingDataset, usesReferenceDataset=$usesReferenceDataset, usesProductionData=$usesProductionData, additionalProperties=$additionalProperties}" + "Goal{id=$id, commentCount=$commentCount, creatorId=$creatorId, dateArchived=$dateArchived, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, name=$name, number=$number, originProjectVersionId=$originProjectVersionId, subtype=$subtype, suggested=$suggested, thresholds=$thresholds, type=$type, archived=$archived, delayWindow=$delayWindow, evaluationWindow=$evaluationWindow, usesMlModel=$usesMlModel, usesProductionData=$usesProductionData, usesReferenceDataset=$usesReferenceDataset, usesTrainingDataset=$usesTrainingDataset, usesValidationDataset=$usesValidationDataset, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1333,17 +1523,17 @@ private constructor( return true } - return /* spotless:off */ other is Item && id == other.id && goal == other.goal && goalId == other.goalId && projectVersionId == other.projectVersionId && inferencePipelineId == other.inferencePipelineId && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && dateDataStarts == other.dateDataStarts && dateDataEnds == other.dateDataEnds && status == other.status && statusMessage == other.statusMessage && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Item && id == other.id && dateCreated == other.dateCreated && dateDataEnds == other.dateDataEnds && dateDataStarts == other.dateDataStarts && dateUpdated == other.dateUpdated && inferencePipelineId == other.inferencePipelineId && projectVersionId == other.projectVersionId && status == other.status && statusMessage == other.statusMessage && goal == other.goal && goalId == other.goalId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, goal, goalId, projectVersionId, inferencePipelineId, dateCreated, dateUpdated, dateDataStarts, dateDataEnds, status, statusMessage, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dateCreated, dateDataEnds, dateDataStarts, dateUpdated, inferencePipelineId, projectVersionId, status, statusMessage, goal, goalId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Item{id=$id, goal=$goal, goalId=$goalId, projectVersionId=$projectVersionId, inferencePipelineId=$inferencePipelineId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, dateDataStarts=$dateDataStarts, dateDataEnds=$dateDataEnds, status=$status, statusMessage=$statusMessage, additionalProperties=$additionalProperties}" + "Item{id=$id, dateCreated=$dateCreated, dateDataEnds=$dateDataEnds, dateDataStarts=$dateDataStarts, dateUpdated=$dateUpdated, inferencePipelineId=$inferencePipelineId, projectVersionId=$projectVersionId, status=$status, statusMessage=$statusMessage, goal=$goal, goalId=$goalId, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt index 14da868d..a1019f64 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt @@ -4,51 +4,63 @@ package com.openlayer.api.models import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import java.util.Objects import java.util.Optional +/** Update inference pipeline. */ class InferencePipelineUpdateParams constructor( private val inferencePipelineId: String, - private val description: String?, - private val name: String?, - private val referenceDatasetUri: String?, + private val body: InferencePipelineUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun inferencePipelineId(): String = inferencePipelineId - fun description(): Optional = Optional.ofNullable(description) + /** The inference pipeline description. */ + fun description(): Optional = body.description() - fun name(): Optional = Optional.ofNullable(name) + /** The inference pipeline name. */ + fun name(): Optional = body.name() - fun referenceDatasetUri(): Optional = Optional.ofNullable(referenceDatasetUri) + /** + * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to + * handle your reference dataset updates. + */ + fun referenceDatasetUri(): Optional = body.referenceDatasetUri() + + /** The inference pipeline description. */ + fun _description(): JsonField = body._description() + + /** The inference pipeline name. */ + fun _name(): JsonField = body._name() + + /** + * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to + * handle your reference dataset updates. + */ + fun _referenceDatasetUri(): JsonField = body._referenceDatasetUri() + + fun _additionalBodyProperties(): Map = body._additionalProperties() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): InferencePipelineUpdateBody { - return InferencePipelineUpdateBody( - description, - name, - referenceDatasetUri, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): InferencePipelineUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -61,33 +73,70 @@ constructor( } } - @JsonDeserialize(builder = InferencePipelineUpdateBody.Builder::class) @NoAutoDetect class InferencePipelineUpdateBody + @JsonCreator internal constructor( - private val description: String?, - private val name: String?, - private val referenceDatasetUri: String?, - private val additionalProperties: Map, + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("referenceDatasetUri") + @ExcludeMissing + private val referenceDatasetUri: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** The inference pipeline description. */ - @JsonProperty("description") fun description(): String? = description + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) + + /** The inference pipeline name. */ + fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + + /** + * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to + * handle your reference dataset updates. + */ + fun referenceDatasetUri(): Optional = + Optional.ofNullable(referenceDatasetUri.getNullable("referenceDatasetUri")) + + /** The inference pipeline description. */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description /** The inference pipeline name. */ - @JsonProperty("name") fun name(): String? = name + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to * handle your reference dataset updates. */ @JsonProperty("referenceDatasetUri") - fun referenceDatasetUri(): String? = referenceDatasetUri + @ExcludeMissing + fun _referenceDatasetUri(): JsonField = referenceDatasetUri @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + + fun validate(): InferencePipelineUpdateBody = apply { + if (validated) { + return@apply + } + + description() + name() + referenceDatasetUri() + validated = true + } + fun toBuilder() = Builder().from(this) companion object { @@ -97,49 +146,78 @@ constructor( class Builder { - private var description: String? = null - private var name: String? = null - private var referenceDatasetUri: String? = null + private var description: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var referenceDatasetUri: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(inferencePipelineUpdateBody: InferencePipelineUpdateBody) = apply { - this.description = inferencePipelineUpdateBody.description - this.name = inferencePipelineUpdateBody.name - this.referenceDatasetUri = inferencePipelineUpdateBody.referenceDatasetUri - additionalProperties(inferencePipelineUpdateBody.additionalProperties) + description = inferencePipelineUpdateBody.description + name = inferencePipelineUpdateBody.name + referenceDatasetUri = inferencePipelineUpdateBody.referenceDatasetUri + additionalProperties = + inferencePipelineUpdateBody.additionalProperties.toMutableMap() } /** The inference pipeline description. */ - @JsonProperty("description") - fun description(description: String) = apply { this.description = description } + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** The inference pipeline description. */ + fun description(description: Optional) = description(description.orElse(null)) + + /** The inference pipeline description. */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** The inference pipeline name. */ + fun name(name: String) = name(JsonField.of(name)) /** The inference pipeline name. */ - @JsonProperty("name") fun name(name: String) = apply { this.name = name } + fun name(name: JsonField) = apply { this.name = name } /** * The storage uri of your reference dataset. We recommend using the Python SDK or the * UI to handle your reference dataset updates. */ - @JsonProperty("referenceDatasetUri") - fun referenceDatasetUri(referenceDatasetUri: String) = apply { + fun referenceDatasetUri(referenceDatasetUri: String?) = + referenceDatasetUri(JsonField.ofNullable(referenceDatasetUri)) + + /** + * The storage uri of your reference dataset. We recommend using the Python SDK or the + * UI to handle your reference dataset updates. + */ + fun referenceDatasetUri(referenceDatasetUri: Optional) = + referenceDatasetUri(referenceDatasetUri.orElse(null)) + + /** + * The storage uri of your reference dataset. We recommend using the Python SDK or the + * UI to handle your reference dataset updates. + */ + fun referenceDatasetUri(referenceDatasetUri: JsonField) = apply { this.referenceDatasetUri = referenceDatasetUri } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): InferencePipelineUpdateBody = InferencePipelineUpdateBody( description, @@ -178,23 +256,17 @@ constructor( class Builder { private var inferencePipelineId: String? = null - private var description: String? = null - private var name: String? = null - private var referenceDatasetUri: String? = null + private var body: InferencePipelineUpdateBody.Builder = + InferencePipelineUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(inferencePipelineUpdateParams: InferencePipelineUpdateParams) = apply { inferencePipelineId = inferencePipelineUpdateParams.inferencePipelineId - description = inferencePipelineUpdateParams.description - name = inferencePipelineUpdateParams.name - referenceDatasetUri = inferencePipelineUpdateParams.referenceDatasetUri + body = inferencePipelineUpdateParams.body.toBuilder() additionalHeaders = inferencePipelineUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = inferencePipelineUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - inferencePipelineUpdateParams.additionalBodyProperties.toMutableMap() } fun inferencePipelineId(inferencePipelineId: String) = apply { @@ -202,17 +274,60 @@ constructor( } /** The inference pipeline description. */ - fun description(description: String) = apply { this.description = description } + fun description(description: String?) = apply { body.description(description) } + + /** The inference pipeline description. */ + fun description(description: Optional) = description(description.orElse(null)) + + /** The inference pipeline description. */ + fun description(description: JsonField) = apply { body.description(description) } + + /** The inference pipeline name. */ + fun name(name: String) = apply { body.name(name) } /** The inference pipeline name. */ - fun name(name: String) = apply { this.name = name } + fun name(name: JsonField) = apply { body.name(name) } + + /** + * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to + * handle your reference dataset updates. + */ + fun referenceDatasetUri(referenceDatasetUri: String?) = apply { + body.referenceDatasetUri(referenceDatasetUri) + } /** * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to * handle your reference dataset updates. */ - fun referenceDatasetUri(referenceDatasetUri: String) = apply { - this.referenceDatasetUri = referenceDatasetUri + fun referenceDatasetUri(referenceDatasetUri: Optional) = + referenceDatasetUri(referenceDatasetUri.orElse(null)) + + /** + * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to + * handle your reference dataset updates. + */ + fun referenceDatasetUri(referenceDatasetUri: JsonField) = apply { + body.referenceDatasetUri(referenceDatasetUri) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) } fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -313,39 +428,12 @@ constructor( additionalQueryParams.removeAll(keys) } - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) - } - fun build(): InferencePipelineUpdateParams = InferencePipelineUpdateParams( - checkNotNull(inferencePipelineId) { - "`inferencePipelineId` is required but was not set" - }, - description, - name, - referenceDatasetUri, + checkRequired("inferencePipelineId", inferencePipelineId), + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -354,11 +442,11 @@ constructor( return true } - return /* spotless:off */ other is InferencePipelineUpdateParams && inferencePipelineId == other.inferencePipelineId && description == other.description && name == other.name && referenceDatasetUri == other.referenceDatasetUri && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is InferencePipelineUpdateParams && inferencePipelineId == other.inferencePipelineId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(inferencePipelineId, description, name, referenceDatasetUri, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(inferencePipelineId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "InferencePipelineUpdateParams{inferencePipelineId=$inferencePipelineId, description=$description, name=$name, referenceDatasetUri=$referenceDatasetUri, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "InferencePipelineUpdateParams{inferencePipelineId=$inferencePipelineId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt index f41bc623..cc29a2d6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt @@ -6,13 +6,14 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.Enum import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.LocalDate @@ -20,80 +21,99 @@ import java.time.OffsetDateTime import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = InferencePipelineUpdateResponse.Builder::class) @NoAutoDetect class InferencePipelineUpdateResponse +@JsonCreator private constructor( - private val id: JsonField, - private val projectId: JsonField, - private val workspaceId: JsonField, - private val project: JsonField, - private val workspace: JsonField, - private val name: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val dateLastSampleReceived: JsonField, - private val description: JsonField, - private val dateLastEvaluated: JsonField, - private val dateOfNextEvaluation: JsonField, - private val passingGoalCount: JsonField, - private val failingGoalCount: JsonField, - private val totalGoalCount: JsonField, - private val status: JsonField, - private val statusMessage: JsonField, - private val links: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + private val dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastSampleReceived") + @ExcludeMissing + private val dateLastSampleReceived: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + private val dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("failingGoalCount") + @ExcludeMissing + private val failingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing private val links: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), + @JsonProperty("passingGoalCount") + @ExcludeMissing + private val passingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + private val projectId: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + private val statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("totalGoalCount") + @ExcludeMissing + private val totalGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("project") + @ExcludeMissing + private val project: JsonField = JsonMissing.of(), + @JsonProperty("workspace") + @ExcludeMissing + private val workspace: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + private val workspaceId: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The inference pipeline id. */ fun id(): String = id.getRequired("id") - /** The project id. */ - fun projectId(): String = projectId.getRequired("projectId") - - /** The workspace id. */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) - - fun project(): Optional = Optional.ofNullable(project.getNullable("project")) - - fun workspace(): Optional = Optional.ofNullable(workspace.getNullable("workspace")) - - /** The inference pipeline name. */ - fun name(): String = name.getRequired("name") - /** The creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The last updated date. */ - fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** The last test evaluation date. */ + fun dateLastEvaluated(): Optional = + Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) /** The last data sample received date. */ fun dateLastSampleReceived(): Optional = Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + /** The next test evaluation date. */ + fun dateOfNextEvaluation(): Optional = + Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + + /** The last updated date. */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** The inference pipeline description. */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** The last test evaluation date. */ - fun dateLastEvaluated(): Optional = - Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + /** The number of tests failing. */ + fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") - /** The next test evaluation date. */ - fun dateOfNextEvaluation(): Optional = - Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + fun links(): Links = links.getRequired("links") + + /** The inference pipeline name. */ + fun name(): String = name.getRequired("name") /** The number of tests passing. */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") - /** The number of tests failing. */ - fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") - - /** The total number of tests. */ - fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") + /** The project id. */ + fun projectId(): String = projectId.getRequired("projectId") /** The status of test evaluation for the inference pipeline. */ fun status(): Status = status.getRequired("status") @@ -102,89 +122,116 @@ private constructor( fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) - fun links(): Links = links.getRequired("links") + /** The total number of tests. */ + fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") - /** The inference pipeline id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun project(): Optional = Optional.ofNullable(project.getNullable("project")) - /** The project id. */ - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + fun workspace(): Optional = Optional.ofNullable(workspace.getNullable("workspace")) /** The workspace id. */ - @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId() = workspaceId - - @JsonProperty("project") @ExcludeMissing fun _project() = project - - @JsonProperty("workspace") @ExcludeMissing fun _workspace() = workspace + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The inference pipeline name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + /** The inference pipeline id. */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated - /** The last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + /** The last test evaluation date. */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun _dateLastEvaluated(): JsonField = dateLastEvaluated /** The last data sample received date. */ @JsonProperty("dateLastSampleReceived") @ExcludeMissing - fun _dateLastSampleReceived() = dateLastSampleReceived - - /** The inference pipeline description. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description - - /** The last test evaluation date. */ - @JsonProperty("dateLastEvaluated") @ExcludeMissing fun _dateLastEvaluated() = dateLastEvaluated + fun _dateLastSampleReceived(): JsonField = dateLastSampleReceived /** The next test evaluation date. */ @JsonProperty("dateOfNextEvaluation") @ExcludeMissing - fun _dateOfNextEvaluation() = dateOfNextEvaluation + fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation - /** The number of tests passing. */ - @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount + /** The last updated date. */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** The inference pipeline description. */ + @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description /** The number of tests failing. */ - @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount + @JsonProperty("failingGoalCount") + @ExcludeMissing + fun _failingGoalCount(): JsonField = failingGoalCount - /** The total number of tests. */ - @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links + + /** The inference pipeline name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** The number of tests passing. */ + @JsonProperty("passingGoalCount") + @ExcludeMissing + fun _passingGoalCount(): JsonField = passingGoalCount + + /** The project id. */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId /** The status of test evaluation for the inference pipeline. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status /** The status message of test evaluation for the inference pipeline. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + + /** The total number of tests. */ + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun _totalGoalCount(): JsonField = totalGoalCount + + @JsonProperty("project") @ExcludeMissing fun _project(): JsonField = project - @JsonProperty("links") @ExcludeMissing fun _links() = links + @JsonProperty("workspace") @ExcludeMissing fun _workspace(): JsonField = workspace + + /** The workspace id. */ + @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): InferencePipelineUpdateResponse = apply { - if (!validated) { - id() - projectId() - workspaceId() - project().map { it.validate() } - workspace().map { it.validate() } - name() - dateCreated() - dateUpdated() - dateLastSampleReceived() - description() - dateLastEvaluated() - dateOfNextEvaluation() - passingGoalCount() - failingGoalCount() - totalGoalCount() - status() - statusMessage() - links().validate() - validated = true + if (validated) { + return@apply } + + id() + dateCreated() + dateLastEvaluated() + dateLastSampleReceived() + dateOfNextEvaluation() + dateUpdated() + description() + failingGoalCount() + links().validate() + name() + passingGoalCount() + projectId() + status() + statusMessage() + totalGoalCount() + project().ifPresent { it.validate() } + workspace().ifPresent { it.validate() } + workspaceId() + validated = true } fun toBuilder() = Builder().from(this) @@ -196,270 +243,269 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var projectId: JsonField = JsonMissing.of() - private var workspaceId: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateLastEvaluated: JsonField? = null + private var dateLastSampleReceived: JsonField? = null + private var dateOfNextEvaluation: JsonField? = null + private var dateUpdated: JsonField? = null + private var description: JsonField? = null + private var failingGoalCount: JsonField? = null + private var links: JsonField? = null + private var name: JsonField? = null + private var passingGoalCount: JsonField? = null + private var projectId: JsonField? = null + private var status: JsonField? = null + private var statusMessage: JsonField? = null + private var totalGoalCount: JsonField? = null private var project: JsonField = JsonMissing.of() private var workspace: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() - private var dateLastSampleReceived: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() - private var dateLastEvaluated: JsonField = JsonMissing.of() - private var dateOfNextEvaluation: JsonField = JsonMissing.of() - private var passingGoalCount: JsonField = JsonMissing.of() - private var failingGoalCount: JsonField = JsonMissing.of() - private var totalGoalCount: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var statusMessage: JsonField = JsonMissing.of() - private var links: JsonField = JsonMissing.of() + private var workspaceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(inferencePipelineUpdateResponse: InferencePipelineUpdateResponse) = apply { - this.id = inferencePipelineUpdateResponse.id - this.projectId = inferencePipelineUpdateResponse.projectId - this.workspaceId = inferencePipelineUpdateResponse.workspaceId - this.project = inferencePipelineUpdateResponse.project - this.workspace = inferencePipelineUpdateResponse.workspace - this.name = inferencePipelineUpdateResponse.name - this.dateCreated = inferencePipelineUpdateResponse.dateCreated - this.dateUpdated = inferencePipelineUpdateResponse.dateUpdated - this.dateLastSampleReceived = inferencePipelineUpdateResponse.dateLastSampleReceived - this.description = inferencePipelineUpdateResponse.description - this.dateLastEvaluated = inferencePipelineUpdateResponse.dateLastEvaluated - this.dateOfNextEvaluation = inferencePipelineUpdateResponse.dateOfNextEvaluation - this.passingGoalCount = inferencePipelineUpdateResponse.passingGoalCount - this.failingGoalCount = inferencePipelineUpdateResponse.failingGoalCount - this.totalGoalCount = inferencePipelineUpdateResponse.totalGoalCount - this.status = inferencePipelineUpdateResponse.status - this.statusMessage = inferencePipelineUpdateResponse.statusMessage - this.links = inferencePipelineUpdateResponse.links - additionalProperties(inferencePipelineUpdateResponse.additionalProperties) + id = inferencePipelineUpdateResponse.id + dateCreated = inferencePipelineUpdateResponse.dateCreated + dateLastEvaluated = inferencePipelineUpdateResponse.dateLastEvaluated + dateLastSampleReceived = inferencePipelineUpdateResponse.dateLastSampleReceived + dateOfNextEvaluation = inferencePipelineUpdateResponse.dateOfNextEvaluation + dateUpdated = inferencePipelineUpdateResponse.dateUpdated + description = inferencePipelineUpdateResponse.description + failingGoalCount = inferencePipelineUpdateResponse.failingGoalCount + links = inferencePipelineUpdateResponse.links + name = inferencePipelineUpdateResponse.name + passingGoalCount = inferencePipelineUpdateResponse.passingGoalCount + projectId = inferencePipelineUpdateResponse.projectId + status = inferencePipelineUpdateResponse.status + statusMessage = inferencePipelineUpdateResponse.statusMessage + totalGoalCount = inferencePipelineUpdateResponse.totalGoalCount + project = inferencePipelineUpdateResponse.project + workspace = inferencePipelineUpdateResponse.workspace + workspaceId = inferencePipelineUpdateResponse.workspaceId + additionalProperties = + inferencePipelineUpdateResponse.additionalProperties.toMutableMap() } /** The inference pipeline id. */ fun id(id: String) = id(JsonField.of(id)) /** The inference pipeline id. */ - @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + fun id(id: JsonField) = apply { this.id = id } - /** The project id. */ - fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - - /** The project id. */ - @JsonProperty("projectId") - @ExcludeMissing - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The workspace id. */ - fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + /** The creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } - /** The workspace id. */ - @JsonProperty("workspaceId") - @ExcludeMissing - fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = + dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) - fun project(project: Project) = project(JsonField.of(project)) + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: Optional) = + dateLastEvaluated(dateLastEvaluated.orElse(null)) - @JsonProperty("project") - @ExcludeMissing - fun project(project: JsonField) = apply { this.project = project } + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } - fun workspace(workspace: Workspace) = workspace(JsonField.of(workspace)) + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime?) = + dateLastSampleReceived(JsonField.ofNullable(dateLastSampleReceived)) - @JsonProperty("workspace") - @ExcludeMissing - fun workspace(workspace: JsonField) = apply { this.workspace = workspace } + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: Optional) = + dateLastSampleReceived(dateLastSampleReceived.orElse(null)) - /** The inference pipeline name. */ - fun name(name: String) = name(JsonField.of(name)) + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { + this.dateLastSampleReceived = dateLastSampleReceived + } - /** The inference pipeline name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = + dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) - /** The creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = + dateOfNextEvaluation(dateOfNextEvaluation.orElse(null)) - /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun dateCreated(dateCreated: JsonField) = apply { - this.dateCreated = dateCreated + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation } /** The last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - /** The last data sample received date. */ - fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime) = - dateLastSampleReceived(JsonField.of(dateLastSampleReceived)) - - /** The last data sample received date. */ - @JsonProperty("dateLastSampleReceived") - @ExcludeMissing - fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { - this.dateLastSampleReceived = dateLastSampleReceived - } + /** The inference pipeline description. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) /** The inference pipeline description. */ - fun description(description: String) = description(JsonField.of(description)) + fun description(description: Optional) = description(description.orElse(null)) /** The inference pipeline description. */ - @JsonProperty("description") - @ExcludeMissing fun description(description: JsonField) = apply { this.description = description } - /** The last test evaluation date. */ - fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime) = - dateLastEvaluated(JsonField.of(dateLastEvaluated)) + /** The number of tests failing. */ + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) - /** The last test evaluation date. */ - @JsonProperty("dateLastEvaluated") - @ExcludeMissing - fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { - this.dateLastEvaluated = dateLastEvaluated + /** The number of tests failing. */ + fun failingGoalCount(failingGoalCount: JsonField) = apply { + this.failingGoalCount = failingGoalCount } - /** The next test evaluation date. */ - fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = - dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) + fun links(links: Links) = links(JsonField.of(links)) - /** The next test evaluation date. */ - @JsonProperty("dateOfNextEvaluation") - @ExcludeMissing - fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { - this.dateOfNextEvaluation = dateOfNextEvaluation - } + fun links(links: JsonField) = apply { this.links = links } + + /** The inference pipeline name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The inference pipeline name. */ + fun name(name: JsonField) = apply { this.name = name } /** The number of tests passing. */ fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) /** The number of tests passing. */ - @JsonProperty("passingGoalCount") - @ExcludeMissing fun passingGoalCount(passingGoalCount: JsonField) = apply { this.passingGoalCount = passingGoalCount } - /** The number of tests failing. */ - fun failingGoalCount(failingGoalCount: Long) = - failingGoalCount(JsonField.of(failingGoalCount)) - - /** The number of tests failing. */ - @JsonProperty("failingGoalCount") - @ExcludeMissing - fun failingGoalCount(failingGoalCount: JsonField) = apply { - this.failingGoalCount = failingGoalCount - } - - /** The total number of tests. */ - fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) + /** The project id. */ + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** The total number of tests. */ - @JsonProperty("totalGoalCount") - @ExcludeMissing - fun totalGoalCount(totalGoalCount: JsonField) = apply { - this.totalGoalCount = totalGoalCount - } + /** The project id. */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** The status of test evaluation for the inference pipeline. */ fun status(status: Status) = status(JsonField.of(status)) /** The status of test evaluation for the inference pipeline. */ - @JsonProperty("status") - @ExcludeMissing fun status(status: JsonField) = apply { this.status = status } /** The status message of test evaluation for the inference pipeline. */ - fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** The status message of test evaluation for the inference pipeline. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.orElse(null)) /** The status message of test evaluation for the inference pipeline. */ - @JsonProperty("statusMessage") - @ExcludeMissing fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } - fun links(links: Links) = links(JsonField.of(links)) + /** The total number of tests. */ + fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - @JsonProperty("links") - @ExcludeMissing - fun links(links: JsonField) = apply { this.links = links } + /** The total number of tests. */ + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount + } + + fun project(project: Project?) = project(JsonField.ofNullable(project)) + + fun project(project: Optional) = project(project.orElse(null)) + + fun project(project: JsonField) = apply { this.project = project } + + fun workspace(workspace: Workspace?) = workspace(JsonField.ofNullable(workspace)) + + fun workspace(workspace: Optional) = workspace(workspace.orElse(null)) + + fun workspace(workspace: JsonField) = apply { this.workspace = workspace } + + /** The workspace id. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** The workspace id. */ + fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): InferencePipelineUpdateResponse = InferencePipelineUpdateResponse( - id, - projectId, - workspaceId, + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateLastEvaluated", dateLastEvaluated), + checkRequired("dateLastSampleReceived", dateLastSampleReceived), + checkRequired("dateOfNextEvaluation", dateOfNextEvaluation), + checkRequired("dateUpdated", dateUpdated), + checkRequired("description", description), + checkRequired("failingGoalCount", failingGoalCount), + checkRequired("links", links), + checkRequired("name", name), + checkRequired("passingGoalCount", passingGoalCount), + checkRequired("projectId", projectId), + checkRequired("status", status), + checkRequired("statusMessage", statusMessage), + checkRequired("totalGoalCount", totalGoalCount), project, workspace, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - status, - statusMessage, - links, + workspaceId, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect class Links + @JsonCreator private constructor( - private val app: JsonField, - private val additionalProperties: Map, + @JsonProperty("app") @ExcludeMissing private val app: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun app(): String = app.getRequired("app") - @JsonProperty("app") @ExcludeMissing fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Links = apply { - if (!validated) { - app() - validated = true + if (validated) { + return@apply } + + app() + validated = true } fun toBuilder() = Builder().from(this) @@ -471,36 +517,40 @@ private constructor( class Builder { - private var app: JsonField = JsonMissing.of() + private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) + app = links.app + additionalProperties = links.additionalProperties.toMutableMap() } fun app(app: String) = app(JsonField.of(app)) - @JsonProperty("app") - @ExcludeMissing fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toImmutable()) + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Links = + Links(checkRequired("app", app), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -520,6 +570,7 @@ private constructor( override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } + /** The status of test evaluation for the inference pipeline. */ class Status @JsonCreator private constructor( @@ -601,53 +652,90 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = Project.Builder::class) @NoAutoDetect class Project + @JsonCreator private constructor( - private val id: JsonField, - private val workspaceId: JsonField, - private val creatorId: JsonField, - private val name: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val description: JsonField, - private val source: JsonField, - private val taskType: JsonField, - private val versionCount: JsonField, - private val inferencePipelineCount: JsonField, - private val goalCount: JsonField, - private val developmentGoalCount: JsonField, - private val monitoringGoalCount: JsonField, - private val links: JsonField, - private val gitRepo: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + private val creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("developmentGoalCount") + @ExcludeMissing + private val developmentGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("goalCount") + @ExcludeMissing + private val goalCount: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + private val inferencePipelineCount: JsonField = JsonMissing.of(), + @JsonProperty("links") + @ExcludeMissing + private val links: JsonField = JsonMissing.of(), + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + private val monitoringGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("source") + @ExcludeMissing + private val source: JsonField = JsonMissing.of(), + @JsonProperty("taskType") + @ExcludeMissing + private val taskType: JsonField = JsonMissing.of(), + @JsonProperty("versionCount") + @ExcludeMissing + private val versionCount: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + private val workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("gitRepo") + @ExcludeMissing + private val gitRepo: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The project id. */ fun id(): String = id.getRequired("id") - /** The workspace id. */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The project creator id. */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The project name. */ - fun name(): String = name.getRequired("name") - /** The project creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") /** The project last updated date. */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The project description. */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") + + /** The total number of tests in the project. */ + fun goalCount(): Long = goalCount.getRequired("goalCount") + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(): Long = + inferencePipelineCount.getRequired("inferencePipelineCount") + + /** Links to the project. */ + fun links(): Links = links.getRequired("links") + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") + + /** The project name. */ + fun name(): String = name.getRequired("name") /** The source of the project. */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) @@ -658,101 +746,107 @@ private constructor( /** The number of versions (commits) in the project. */ fun versionCount(): Long = versionCount.getRequired("versionCount") - /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(): Long = - inferencePipelineCount.getRequired("inferencePipelineCount") - - /** The total number of tests in the project. */ - fun goalCount(): Long = goalCount.getRequired("goalCount") - - /** The number of tests in the development mode of the project. */ - fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") - - /** The number of tests in the monitoring mode of the project. */ - fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") + /** The workspace id. */ + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** Links to the project. */ - fun links(): Links = links.getRequired("links") + /** The project description. */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) /** The project id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id - - /** The workspace id. */ - @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId() = workspaceId + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The project creator id. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId - - /** The project name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId /** The project creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated /** The project last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated - - /** The project description. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description - - /** The source of the project. */ - @JsonProperty("source") @ExcludeMissing fun _source() = source + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - /** The task type of the project. */ - @JsonProperty("taskType") @ExcludeMissing fun _taskType() = taskType + /** The number of tests in the development mode of the project. */ + @JsonProperty("developmentGoalCount") + @ExcludeMissing + fun _developmentGoalCount(): JsonField = developmentGoalCount - /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") @ExcludeMissing fun _versionCount() = versionCount + /** The total number of tests in the project. */ + @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount /** The number of inference pipelines in the project. */ @JsonProperty("inferencePipelineCount") @ExcludeMissing - fun _inferencePipelineCount() = inferencePipelineCount - - /** The total number of tests in the project. */ - @JsonProperty("goalCount") @ExcludeMissing fun _goalCount() = goalCount + fun _inferencePipelineCount(): JsonField = inferencePipelineCount - /** The number of tests in the development mode of the project. */ - @JsonProperty("developmentGoalCount") - @ExcludeMissing - fun _developmentGoalCount() = developmentGoalCount + /** Links to the project. */ + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links /** The number of tests in the monitoring mode of the project. */ @JsonProperty("monitoringGoalCount") @ExcludeMissing - fun _monitoringGoalCount() = monitoringGoalCount + fun _monitoringGoalCount(): JsonField = monitoringGoalCount - /** Links to the project. */ - @JsonProperty("links") @ExcludeMissing fun _links() = links + /** The project name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** The source of the project. */ + @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source + + /** The task type of the project. */ + @JsonProperty("taskType") @ExcludeMissing fun _taskType(): JsonField = taskType - @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo() = gitRepo + /** The number of versions (commits) in the project. */ + @JsonProperty("versionCount") + @ExcludeMissing + fun _versionCount(): JsonField = versionCount + + /** The workspace id. */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** The project description. */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Project = apply { - if (!validated) { - id() - workspaceId() - creatorId() - name() - dateCreated() - dateUpdated() - description() - source() - taskType() - versionCount() - inferencePipelineCount() - goalCount() - developmentGoalCount() - monitoringGoalCount() - links().validate() - gitRepo().map { it.validate() } - validated = true + if (validated) { + return@apply } + + id() + creatorId() + dateCreated() + dateUpdated() + developmentGoalCount() + goalCount() + inferencePipelineCount() + links().validate() + monitoringGoalCount() + name() + source() + taskType() + versionCount() + workspaceId() + description() + gitRepo().ifPresent { it.validate() } + validated = true } fun toBuilder() = Builder().from(this) @@ -764,85 +858,64 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var workspaceId: JsonField = JsonMissing.of() - private var creatorId: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var developmentGoalCount: JsonField? = null + private var goalCount: JsonField? = null + private var inferencePipelineCount: JsonField? = null + private var links: JsonField? = null + private var monitoringGoalCount: JsonField? = null + private var name: JsonField? = null + private var source: JsonField? = null + private var taskType: JsonField? = null + private var versionCount: JsonField? = null + private var workspaceId: JsonField? = null private var description: JsonField = JsonMissing.of() - private var source: JsonField = JsonMissing.of() - private var taskType: JsonField = JsonMissing.of() - private var versionCount: JsonField = JsonMissing.of() - private var inferencePipelineCount: JsonField = JsonMissing.of() - private var goalCount: JsonField = JsonMissing.of() - private var developmentGoalCount: JsonField = JsonMissing.of() - private var monitoringGoalCount: JsonField = JsonMissing.of() - private var links: JsonField = JsonMissing.of() private var gitRepo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(project: Project) = apply { - this.id = project.id - this.workspaceId = project.workspaceId - this.creatorId = project.creatorId - this.name = project.name - this.dateCreated = project.dateCreated - this.dateUpdated = project.dateUpdated - this.description = project.description - this.source = project.source - this.taskType = project.taskType - this.versionCount = project.versionCount - this.inferencePipelineCount = project.inferencePipelineCount - this.goalCount = project.goalCount - this.developmentGoalCount = project.developmentGoalCount - this.monitoringGoalCount = project.monitoringGoalCount - this.links = project.links - this.gitRepo = project.gitRepo - additionalProperties(project.additionalProperties) + id = project.id + creatorId = project.creatorId + dateCreated = project.dateCreated + dateUpdated = project.dateUpdated + developmentGoalCount = project.developmentGoalCount + goalCount = project.goalCount + inferencePipelineCount = project.inferencePipelineCount + links = project.links + monitoringGoalCount = project.monitoringGoalCount + name = project.name + source = project.source + taskType = project.taskType + versionCount = project.versionCount + workspaceId = project.workspaceId + description = project.description + gitRepo = project.gitRepo + additionalProperties = project.additionalProperties.toMutableMap() } /** The project id. */ fun id(id: String) = id(JsonField.of(id)) /** The project id. */ - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - /** The workspace id. */ - fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) - - /** The workspace id. */ - @JsonProperty("workspaceId") - @ExcludeMissing - fun workspaceId(workspaceId: JsonField) = apply { - this.workspaceId = workspaceId - } + /** The project creator id. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The project creator id. */ - fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) /** The project creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } - /** The project name. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The project name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) /** The project creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -851,163 +924,176 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) /** The project last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - /** The project description. */ - fun description(description: String) = description(JsonField.of(description)) + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: Long) = + developmentGoalCount(JsonField.of(developmentGoalCount)) - /** The project description. */ - @JsonProperty("description") - @ExcludeMissing - fun description(description: JsonField) = apply { - this.description = description + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: JsonField) = apply { + this.developmentGoalCount = developmentGoalCount + } + + /** The total number of tests in the project. */ + fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) + + /** The total number of tests in the project. */ + fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(inferencePipelineCount: Long) = + inferencePipelineCount(JsonField.of(inferencePipelineCount)) + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { + this.inferencePipelineCount = inferencePipelineCount } + /** Links to the project. */ + fun links(links: Links) = links(JsonField.of(links)) + + /** Links to the project. */ + fun links(links: JsonField) = apply { this.links = links } + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(monitoringGoalCount: Long) = + monitoringGoalCount(JsonField.of(monitoringGoalCount)) + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { + this.monitoringGoalCount = monitoringGoalCount + } + + /** The project name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The project name. */ + fun name(name: JsonField) = apply { this.name = name } + /** The source of the project. */ - fun source(source: Source) = source(JsonField.of(source)) + fun source(source: Source?) = source(JsonField.ofNullable(source)) + + /** The source of the project. */ + fun source(source: Optional) = source(source.orElse(null)) /** The source of the project. */ - @JsonProperty("source") - @ExcludeMissing fun source(source: JsonField) = apply { this.source = source } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) /** The task type of the project. */ - @JsonProperty("taskType") - @ExcludeMissing fun taskType(taskType: JsonField) = apply { this.taskType = taskType } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") - @ExcludeMissing fun versionCount(versionCount: JsonField) = apply { this.versionCount = versionCount } - /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(inferencePipelineCount: Long) = - inferencePipelineCount(JsonField.of(inferencePipelineCount)) - - /** The number of inference pipelines in the project. */ - @JsonProperty("inferencePipelineCount") - @ExcludeMissing - fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { - this.inferencePipelineCount = inferencePipelineCount - } - - /** The total number of tests in the project. */ - fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) - - /** The total number of tests in the project. */ - @JsonProperty("goalCount") - @ExcludeMissing - fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } + /** The workspace id. */ + fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) - /** The number of tests in the development mode of the project. */ - fun developmentGoalCount(developmentGoalCount: Long) = - developmentGoalCount(JsonField.of(developmentGoalCount)) + /** The workspace id. */ + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.orElse(null)) - /** The number of tests in the development mode of the project. */ - @JsonProperty("developmentGoalCount") - @ExcludeMissing - fun developmentGoalCount(developmentGoalCount: JsonField) = apply { - this.developmentGoalCount = developmentGoalCount + /** The workspace id. */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId } - /** The number of tests in the monitoring mode of the project. */ - fun monitoringGoalCount(monitoringGoalCount: Long) = - monitoringGoalCount(JsonField.of(monitoringGoalCount)) + /** The project description. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) - /** The number of tests in the monitoring mode of the project. */ - @JsonProperty("monitoringGoalCount") - @ExcludeMissing - fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { - this.monitoringGoalCount = monitoringGoalCount - } + /** The project description. */ + fun description(description: Optional) = description(description.orElse(null)) - /** Links to the project. */ - fun links(links: Links) = links(JsonField.of(links)) + /** The project description. */ + fun description(description: JsonField) = apply { + this.description = description + } - /** Links to the project. */ - @JsonProperty("links") - @ExcludeMissing - fun links(links: JsonField) = apply { this.links = links } + fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) - fun gitRepo(gitRepo: GitRepo) = gitRepo(JsonField.of(gitRepo)) + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.orElse(null)) - @JsonProperty("gitRepo") - @ExcludeMissing fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Project = Project( - id, - workspaceId, - creatorId, - name, - dateCreated, - dateUpdated, + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("developmentGoalCount", developmentGoalCount), + checkRequired("goalCount", goalCount), + checkRequired("inferencePipelineCount", inferencePipelineCount), + checkRequired("links", links), + checkRequired("monitoringGoalCount", monitoringGoalCount), + checkRequired("name", name), + checkRequired("source", source), + checkRequired("taskType", taskType), + checkRequired("versionCount", versionCount), + checkRequired("workspaceId", workspaceId), description, - source, - taskType, - versionCount, - inferencePipelineCount, - goalCount, - developmentGoalCount, - monitoringGoalCount, - links, gitRepo, additionalProperties.toImmutable(), ) } /** Links to the project. */ - @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect class Links + @JsonCreator private constructor( - private val app: JsonField, - private val additionalProperties: Map, + @JsonProperty("app") + @ExcludeMissing + private val app: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun app(): String = app.getRequired("app") - @JsonProperty("app") @ExcludeMissing fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Links = apply { - if (!validated) { - app() - validated = true + if (validated) { + return@apply } + + app() + validated = true } fun toBuilder() = Builder().from(this) @@ -1019,29 +1105,26 @@ private constructor( class Builder { - private var app: JsonField = JsonMissing.of() + private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) + app = links.app + additionalProperties = links.additionalProperties.toMutableMap() } fun app(app: String) = app(JsonField.of(app)) - @JsonProperty("app") - @ExcludeMissing fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1049,7 +1132,16 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toImmutable()) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Links = + Links(checkRequired("app", app), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -1069,6 +1161,7 @@ private constructor( override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } + /** The source of the project. */ class Source @JsonCreator private constructor( @@ -1132,6 +1225,7 @@ private constructor( override fun toString() = value.toString() } + /** The task type of the project. */ class TaskType @JsonCreator private constructor( @@ -1201,95 +1295,130 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = GitRepo.Builder::class) @NoAutoDetect class GitRepo + @JsonCreator private constructor( - private val id: JsonField, - private val gitId: JsonField, - private val dateConnected: JsonField, - private val dateUpdated: JsonField, - private val branch: JsonField, - private val name: JsonField, - private val private_: JsonField, - private val slug: JsonField, - private val url: JsonField, - private val rootDir: JsonField, - private val projectId: JsonField, - private val gitAccountId: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("dateConnected") + @ExcludeMissing + private val dateConnected: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("gitAccountId") + @ExcludeMissing + private val gitAccountId: JsonField = JsonMissing.of(), + @JsonProperty("gitId") + @ExcludeMissing + private val gitId: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("private") + @ExcludeMissing + private val private_: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + private val projectId: JsonField = JsonMissing.of(), + @JsonProperty("slug") + @ExcludeMissing + private val slug: JsonField = JsonMissing.of(), + @JsonProperty("url") + @ExcludeMissing + private val url: JsonField = JsonMissing.of(), + @JsonProperty("branch") + @ExcludeMissing + private val branch: JsonField = JsonMissing.of(), + @JsonProperty("rootDir") + @ExcludeMissing + private val rootDir: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): String = id.getRequired("id") - fun gitId(): Long = gitId.getRequired("gitId") - fun dateConnected(): OffsetDateTime = dateConnected.getRequired("dateConnected") fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + + fun gitId(): Long = gitId.getRequired("gitId") fun name(): String = name.getRequired("name") fun private_(): Boolean = private_.getRequired("private") + fun projectId(): String = projectId.getRequired("projectId") + fun slug(): String = slug.getRequired("slug") fun url(): String = url.getRequired("url") - fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) - - fun projectId(): String = projectId.getRequired("projectId") + fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) - fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - @JsonProperty("gitId") @ExcludeMissing fun _gitId() = gitId + @JsonProperty("dateConnected") + @ExcludeMissing + fun _dateConnected(): JsonField = dateConnected - @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected() = dateConnected + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("gitAccountId") + @ExcludeMissing + fun _gitAccountId(): JsonField = gitAccountId - @JsonProperty("branch") @ExcludeMissing fun _branch() = branch + @JsonProperty("gitId") @ExcludeMissing fun _gitId(): JsonField = gitId - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - @JsonProperty("private") @ExcludeMissing fun _private_() = private_ + @JsonProperty("private") @ExcludeMissing fun _private_(): JsonField = private_ - @JsonProperty("slug") @ExcludeMissing fun _slug() = slug + @JsonProperty("projectId") + @ExcludeMissing + fun _projectId(): JsonField = projectId - @JsonProperty("url") @ExcludeMissing fun _url() = url + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - @JsonProperty("rootDir") @ExcludeMissing fun _rootDir() = rootDir + @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch - @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId() = gitAccountId + @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): GitRepo = apply { - if (!validated) { - id() - gitId() - dateConnected() - dateUpdated() - branch() - name() - private_() - slug() - url() - rootDir() - projectId() - gitAccountId() - validated = true + if (validated) { + return@apply } + + id() + dateConnected() + dateUpdated() + gitAccountId() + gitId() + name() + private_() + projectId() + slug() + url() + branch() + rootDir() + validated = true } fun toBuilder() = Builder().from(this) @@ -1301,54 +1430,44 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var gitId: JsonField = JsonMissing.of() - private var dateConnected: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var dateConnected: JsonField? = null + private var dateUpdated: JsonField? = null + private var gitAccountId: JsonField? = null + private var gitId: JsonField? = null + private var name: JsonField? = null + private var private_: JsonField? = null + private var projectId: JsonField? = null + private var slug: JsonField? = null + private var url: JsonField? = null private var branch: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var private_: JsonField = JsonMissing.of() - private var slug: JsonField = JsonMissing.of() - private var url: JsonField = JsonMissing.of() private var rootDir: JsonField = JsonMissing.of() - private var projectId: JsonField = JsonMissing.of() - private var gitAccountId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(gitRepo: GitRepo) = apply { - this.id = gitRepo.id - this.gitId = gitRepo.gitId - this.dateConnected = gitRepo.dateConnected - this.dateUpdated = gitRepo.dateUpdated - this.branch = gitRepo.branch - this.name = gitRepo.name - this.private_ = gitRepo.private_ - this.slug = gitRepo.slug - this.url = gitRepo.url - this.rootDir = gitRepo.rootDir - this.projectId = gitRepo.projectId - this.gitAccountId = gitRepo.gitAccountId - additionalProperties(gitRepo.additionalProperties) + id = gitRepo.id + dateConnected = gitRepo.dateConnected + dateUpdated = gitRepo.dateUpdated + gitAccountId = gitRepo.gitAccountId + gitId = gitRepo.gitId + name = gitRepo.name + private_ = gitRepo.private_ + projectId = gitRepo.projectId + slug = gitRepo.slug + url = gitRepo.url + branch = gitRepo.branch + rootDir = gitRepo.rootDir + additionalProperties = gitRepo.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) - - @JsonProperty("gitId") - @ExcludeMissing - fun gitId(gitId: JsonField) = apply { this.gitId = gitId } - fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) - @JsonProperty("dateConnected") - @ExcludeMissing fun dateConnected(dateConnected: JsonField) = apply { this.dateConnected = dateConnected } @@ -1356,70 +1475,55 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - fun branch(branch: String) = branch(JsonField.of(branch)) + fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) - @JsonProperty("branch") - @ExcludeMissing - fun branch(branch: JsonField) = apply { this.branch = branch } + fun gitAccountId(gitAccountId: JsonField) = apply { + this.gitAccountId = gitAccountId + } + + fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) + + fun gitId(gitId: JsonField) = apply { this.gitId = gitId } fun name(name: String) = name(JsonField.of(name)) - @JsonProperty("name") - @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } fun private_(private_: Boolean) = private_(JsonField.of(private_)) - @JsonProperty("private") - @ExcludeMissing fun private_(private_: JsonField) = apply { this.private_ = private_ } + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + fun slug(slug: String) = slug(JsonField.of(slug)) - @JsonProperty("slug") - @ExcludeMissing fun slug(slug: JsonField) = apply { this.slug = slug } fun url(url: String) = url(JsonField.of(url)) - @JsonProperty("url") - @ExcludeMissing fun url(url: JsonField) = apply { this.url = url } - fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) - - @JsonProperty("rootDir") - @ExcludeMissing - fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } - - fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + fun branch(branch: String) = branch(JsonField.of(branch)) - @JsonProperty("projectId") - @ExcludeMissing - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + fun branch(branch: JsonField) = apply { this.branch = branch } - fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) + fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) - @JsonProperty("gitAccountId") - @ExcludeMissing - fun gitAccountId(gitAccountId: JsonField) = apply { - this.gitAccountId = gitAccountId - } + fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1427,20 +1531,28 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): GitRepo = GitRepo( - id, - gitId, - dateConnected, - dateUpdated, + checkRequired("id", id), + checkRequired("dateConnected", dateConnected), + checkRequired("dateUpdated", dateUpdated), + checkRequired("gitAccountId", gitAccountId), + checkRequired("gitId", gitId), + checkRequired("name", name), + checkRequired("private_", private_), + checkRequired("projectId", projectId), + checkRequired("slug", slug), + checkRequired("url", url), branch, - name, - private_, - slug, - url, rootDir, - projectId, - gitAccountId, additionalProperties.toImmutable(), ) } @@ -1450,17 +1562,17 @@ private constructor( return true } - return /* spotless:off */ other is GitRepo && id == other.id && gitId == other.gitId && dateConnected == other.dateConnected && dateUpdated == other.dateUpdated && branch == other.branch && name == other.name && private_ == other.private_ && slug == other.slug && url == other.url && rootDir == other.rootDir && projectId == other.projectId && gitAccountId == other.gitAccountId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GitRepo && id == other.id && dateConnected == other.dateConnected && dateUpdated == other.dateUpdated && gitAccountId == other.gitAccountId && gitId == other.gitId && name == other.name && private_ == other.private_ && projectId == other.projectId && slug == other.slug && url == other.url && branch == other.branch && rootDir == other.rootDir && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, gitId, dateConnected, dateUpdated, branch, name, private_, slug, url, rootDir, projectId, gitAccountId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dateConnected, dateUpdated, gitAccountId, gitId, name, private_, projectId, slug, url, branch, rootDir, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GitRepo{id=$id, gitId=$gitId, dateConnected=$dateConnected, dateUpdated=$dateUpdated, branch=$branch, name=$name, private_=$private_, slug=$slug, url=$url, rootDir=$rootDir, projectId=$projectId, gitAccountId=$gitAccountId, additionalProperties=$additionalProperties}" + "GitRepo{id=$id, dateConnected=$dateConnected, dateUpdated=$dateUpdated, gitAccountId=$gitAccountId, gitId=$gitId, name=$name, private_=$private_, projectId=$projectId, slug=$slug, url=$url, branch=$branch, rootDir=$rootDir, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1468,52 +1580,78 @@ private constructor( return true } - return /* spotless:off */ other is Project && id == other.id && workspaceId == other.workspaceId && creatorId == other.creatorId && name == other.name && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && description == other.description && source == other.source && taskType == other.taskType && versionCount == other.versionCount && inferencePipelineCount == other.inferencePipelineCount && goalCount == other.goalCount && developmentGoalCount == other.developmentGoalCount && monitoringGoalCount == other.monitoringGoalCount && links == other.links && gitRepo == other.gitRepo && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Project && id == other.id && creatorId == other.creatorId && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && developmentGoalCount == other.developmentGoalCount && goalCount == other.goalCount && inferencePipelineCount == other.inferencePipelineCount && links == other.links && monitoringGoalCount == other.monitoringGoalCount && name == other.name && source == other.source && taskType == other.taskType && versionCount == other.versionCount && workspaceId == other.workspaceId && description == other.description && gitRepo == other.gitRepo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, workspaceId, creatorId, name, dateCreated, dateUpdated, description, source, taskType, versionCount, inferencePipelineCount, goalCount, developmentGoalCount, monitoringGoalCount, links, gitRepo, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, creatorId, dateCreated, dateUpdated, developmentGoalCount, goalCount, inferencePipelineCount, links, monitoringGoalCount, name, source, taskType, versionCount, workspaceId, description, gitRepo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Project{id=$id, workspaceId=$workspaceId, creatorId=$creatorId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, source=$source, taskType=$taskType, versionCount=$versionCount, inferencePipelineCount=$inferencePipelineCount, goalCount=$goalCount, developmentGoalCount=$developmentGoalCount, monitoringGoalCount=$monitoringGoalCount, links=$links, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" + "Project{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, developmentGoalCount=$developmentGoalCount, goalCount=$goalCount, inferencePipelineCount=$inferencePipelineCount, links=$links, monitoringGoalCount=$monitoringGoalCount, name=$name, source=$source, taskType=$taskType, versionCount=$versionCount, workspaceId=$workspaceId, description=$description, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Workspace.Builder::class) @NoAutoDetect class Workspace + @JsonCreator private constructor( - private val id: JsonField, - private val name: JsonField, - private val slug: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val creatorId: JsonField, - private val inviteCode: JsonField, - private val wildcardDomains: JsonField>, - private val projectCount: JsonField, - private val memberCount: JsonField, - private val monthlyUsage: JsonField>, - private val inviteCount: JsonField, - private val periodStartDate: JsonField, - private val periodEndDate: JsonField, - private val samlOnlyAccess: JsonField, - private val status: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + private val creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("inviteCount") + @ExcludeMissing + private val inviteCount: JsonField = JsonMissing.of(), + @JsonProperty("memberCount") + @ExcludeMissing + private val memberCount: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("periodEndDate") + @ExcludeMissing + private val periodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("periodStartDate") + @ExcludeMissing + private val periodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("projectCount") + @ExcludeMissing + private val projectCount: JsonField = JsonMissing.of(), + @JsonProperty("slug") + @ExcludeMissing + private val slug: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonProperty("inviteCode") + @ExcludeMissing + private val inviteCode: JsonField = JsonMissing.of(), + @JsonProperty("monthlyUsage") + @ExcludeMissing + private val monthlyUsage: JsonField> = JsonMissing.of(), + @JsonProperty("samlOnlyAccess") + @ExcludeMissing + private val samlOnlyAccess: JsonField = JsonMissing.of(), + @JsonProperty("wildcardDomains") + @ExcludeMissing + private val wildcardDomains: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The workspace id. */ fun id(): String = id.getRequired("id") - /** The workspace name. */ - fun name(): String = name.getRequired("name") - - /** The workspace slug. */ - fun slug(): String = slug.getRequired("slug") + /** The workspace creator id. */ + fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) /** The workspace creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") @@ -1521,111 +1659,140 @@ private constructor( /** The workspace last updated date. */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The workspace creator id. */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - - /** The workspace invite code. */ - fun inviteCode(): Optional = - Optional.ofNullable(inviteCode.getNullable("inviteCode")) - - fun wildcardDomains(): Optional> = - Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) - - /** The number of projects in the workspace. */ - fun projectCount(): Long = projectCount.getRequired("projectCount") + /** The number of invites in the workspace. */ + fun inviteCount(): Long = inviteCount.getRequired("inviteCount") /** The number of members in the workspace. */ fun memberCount(): Long = memberCount.getRequired("memberCount") - fun monthlyUsage(): Optional> = - Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) + /** The workspace name. */ + fun name(): String = name.getRequired("name") - /** The number of invites in the workspace. */ - fun inviteCount(): Long = inviteCount.getRequired("inviteCount") + /** The end date of the current billing period. */ + fun periodEndDate(): Optional = + Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) /** The start date of the current billing period. */ fun periodStartDate(): Optional = Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) - /** The end date of the current billing period. */ - fun periodEndDate(): Optional = - Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) + /** The number of projects in the workspace. */ + fun projectCount(): Long = projectCount.getRequired("projectCount") + + /** The workspace slug. */ + fun slug(): String = slug.getRequired("slug") + + fun status(): Status = status.getRequired("status") + + /** The workspace invite code. */ + fun inviteCode(): Optional = + Optional.ofNullable(inviteCode.getNullable("inviteCode")) + + fun monthlyUsage(): Optional> = + Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) /** Whether the workspace only allows SAML authentication. */ fun samlOnlyAccess(): Optional = Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) - fun status(): Status = status.getRequired("status") + fun wildcardDomains(): Optional> = + Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) /** The workspace id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The workspace name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name - - /** The workspace slug. */ - @JsonProperty("slug") @ExcludeMissing fun _slug() = slug + /** The workspace creator id. */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId /** The workspace creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated /** The workspace last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - /** The workspace creator id. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + /** The number of invites in the workspace. */ + @JsonProperty("inviteCount") + @ExcludeMissing + fun _inviteCount(): JsonField = inviteCount - /** The workspace invite code. */ - @JsonProperty("inviteCode") @ExcludeMissing fun _inviteCode() = inviteCode + /** The number of members in the workspace. */ + @JsonProperty("memberCount") + @ExcludeMissing + fun _memberCount(): JsonField = memberCount - @JsonProperty("wildcardDomains") @ExcludeMissing fun _wildcardDomains() = wildcardDomains + /** The workspace name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The number of projects in the workspace. */ - @JsonProperty("projectCount") @ExcludeMissing fun _projectCount() = projectCount + /** The end date of the current billing period. */ + @JsonProperty("periodEndDate") + @ExcludeMissing + fun _periodEndDate(): JsonField = periodEndDate - /** The number of members in the workspace. */ - @JsonProperty("memberCount") @ExcludeMissing fun _memberCount() = memberCount + /** The start date of the current billing period. */ + @JsonProperty("periodStartDate") + @ExcludeMissing + fun _periodStartDate(): JsonField = periodStartDate - @JsonProperty("monthlyUsage") @ExcludeMissing fun _monthlyUsage() = monthlyUsage + /** The number of projects in the workspace. */ + @JsonProperty("projectCount") + @ExcludeMissing + fun _projectCount(): JsonField = projectCount - /** The number of invites in the workspace. */ - @JsonProperty("inviteCount") @ExcludeMissing fun _inviteCount() = inviteCount + /** The workspace slug. */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - /** The start date of the current billing period. */ - @JsonProperty("periodStartDate") @ExcludeMissing fun _periodStartDate() = periodStartDate + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The end date of the current billing period. */ - @JsonProperty("periodEndDate") @ExcludeMissing fun _periodEndDate() = periodEndDate + /** The workspace invite code. */ + @JsonProperty("inviteCode") + @ExcludeMissing + fun _inviteCode(): JsonField = inviteCode + + @JsonProperty("monthlyUsage") + @ExcludeMissing + fun _monthlyUsage(): JsonField> = monthlyUsage /** Whether the workspace only allows SAML authentication. */ - @JsonProperty("samlOnlyAccess") @ExcludeMissing fun _samlOnlyAccess() = samlOnlyAccess + @JsonProperty("samlOnlyAccess") + @ExcludeMissing + fun _samlOnlyAccess(): JsonField = samlOnlyAccess - @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonProperty("wildcardDomains") + @ExcludeMissing + fun _wildcardDomains(): JsonField> = wildcardDomains @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Workspace = apply { - if (!validated) { - id() - name() - slug() - dateCreated() - dateUpdated() - creatorId() - inviteCode() - wildcardDomains() - projectCount() - memberCount() - monthlyUsage().map { it.forEach { it.validate() } } - inviteCount() - periodStartDate() - periodEndDate() - samlOnlyAccess() - status() - validated = true + if (validated) { + return@apply } + + id() + creatorId() + dateCreated() + dateUpdated() + inviteCount() + memberCount() + name() + periodEndDate() + periodStartDate() + projectCount() + slug() + status() + inviteCode() + monthlyUsage().ifPresent { it.forEach { it.validate() } } + samlOnlyAccess() + wildcardDomains() + validated = true } fun toBuilder() = Builder().from(this) @@ -1637,75 +1804,64 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var slug: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() - private var creatorId: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var inviteCount: JsonField? = null + private var memberCount: JsonField? = null + private var name: JsonField? = null + private var periodEndDate: JsonField? = null + private var periodStartDate: JsonField? = null + private var projectCount: JsonField? = null + private var slug: JsonField? = null + private var status: JsonField? = null private var inviteCode: JsonField = JsonMissing.of() - private var wildcardDomains: JsonField> = JsonMissing.of() - private var projectCount: JsonField = JsonMissing.of() - private var memberCount: JsonField = JsonMissing.of() - private var monthlyUsage: JsonField> = JsonMissing.of() - private var inviteCount: JsonField = JsonMissing.of() - private var periodStartDate: JsonField = JsonMissing.of() - private var periodEndDate: JsonField = JsonMissing.of() + private var monthlyUsage: JsonField>? = null private var samlOnlyAccess: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() + private var wildcardDomains: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(workspace: Workspace) = apply { - this.id = workspace.id - this.name = workspace.name - this.slug = workspace.slug - this.dateCreated = workspace.dateCreated - this.dateUpdated = workspace.dateUpdated - this.creatorId = workspace.creatorId - this.inviteCode = workspace.inviteCode - this.wildcardDomains = workspace.wildcardDomains - this.projectCount = workspace.projectCount - this.memberCount = workspace.memberCount - this.monthlyUsage = workspace.monthlyUsage - this.inviteCount = workspace.inviteCount - this.periodStartDate = workspace.periodStartDate - this.periodEndDate = workspace.periodEndDate - this.samlOnlyAccess = workspace.samlOnlyAccess - this.status = workspace.status - additionalProperties(workspace.additionalProperties) + id = workspace.id + creatorId = workspace.creatorId + dateCreated = workspace.dateCreated + dateUpdated = workspace.dateUpdated + inviteCount = workspace.inviteCount + memberCount = workspace.memberCount + name = workspace.name + periodEndDate = workspace.periodEndDate + periodStartDate = workspace.periodStartDate + projectCount = workspace.projectCount + slug = workspace.slug + status = workspace.status + inviteCode = workspace.inviteCode + monthlyUsage = workspace.monthlyUsage.map { it.toMutableList() } + samlOnlyAccess = workspace.samlOnlyAccess + wildcardDomains = workspace.wildcardDomains.map { it.toMutableList() } + additionalProperties = workspace.additionalProperties.toMutableMap() } /** The workspace id. */ fun id(id: String) = id(JsonField.of(id)) /** The workspace id. */ - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - /** The workspace name. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The workspace name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + /** The workspace creator id. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The workspace slug. */ - fun slug(slug: String) = slug(JsonField.of(slug)) + /** The workspace creator id. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) - /** The workspace slug. */ - @JsonProperty("slug") - @ExcludeMissing - fun slug(slug: JsonField) = apply { this.slug = slug } + /** The workspace creator id. */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The workspace creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) /** The workspace creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -1714,92 +1870,96 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) /** The workspace last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - /** The workspace creator id. */ - fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) + /** The number of invites in the workspace. */ + fun inviteCount(inviteCount: Long) = inviteCount(JsonField.of(inviteCount)) - /** The workspace creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + /** The number of invites in the workspace. */ + fun inviteCount(inviteCount: JsonField) = apply { this.inviteCount = inviteCount } - /** The workspace invite code. */ - fun inviteCode(inviteCode: String) = inviteCode(JsonField.of(inviteCode)) + /** The number of members in the workspace. */ + fun memberCount(memberCount: Long) = memberCount(JsonField.of(memberCount)) - /** The workspace invite code. */ - @JsonProperty("inviteCode") - @ExcludeMissing - fun inviteCode(inviteCode: JsonField) = apply { this.inviteCode = inviteCode } + /** The number of members in the workspace. */ + fun memberCount(memberCount: JsonField) = apply { this.memberCount = memberCount } - fun wildcardDomains(wildcardDomains: List) = - wildcardDomains(JsonField.of(wildcardDomains)) + /** The workspace name. */ + fun name(name: String) = name(JsonField.of(name)) - @JsonProperty("wildcardDomains") - @ExcludeMissing - fun wildcardDomains(wildcardDomains: JsonField>) = apply { - this.wildcardDomains = wildcardDomains + /** The workspace name. */ + fun name(name: JsonField) = apply { this.name = name } + + /** The end date of the current billing period. */ + fun periodEndDate(periodEndDate: OffsetDateTime?) = + periodEndDate(JsonField.ofNullable(periodEndDate)) + + /** The end date of the current billing period. */ + fun periodEndDate(periodEndDate: Optional) = + periodEndDate(periodEndDate.orElse(null)) + + /** The end date of the current billing period. */ + fun periodEndDate(periodEndDate: JsonField) = apply { + this.periodEndDate = periodEndDate + } + + /** The start date of the current billing period. */ + fun periodStartDate(periodStartDate: OffsetDateTime?) = + periodStartDate(JsonField.ofNullable(periodStartDate)) + + /** The start date of the current billing period. */ + fun periodStartDate(periodStartDate: Optional) = + periodStartDate(periodStartDate.orElse(null)) + + /** The start date of the current billing period. */ + fun periodStartDate(periodStartDate: JsonField) = apply { + this.periodStartDate = periodStartDate } /** The number of projects in the workspace. */ fun projectCount(projectCount: Long) = projectCount(JsonField.of(projectCount)) /** The number of projects in the workspace. */ - @JsonProperty("projectCount") - @ExcludeMissing fun projectCount(projectCount: JsonField) = apply { this.projectCount = projectCount } - /** The number of members in the workspace. */ - fun memberCount(memberCount: Long) = memberCount(JsonField.of(memberCount)) + /** The workspace slug. */ + fun slug(slug: String) = slug(JsonField.of(slug)) - /** The number of members in the workspace. */ - @JsonProperty("memberCount") - @ExcludeMissing - fun memberCount(memberCount: JsonField) = apply { this.memberCount = memberCount } + /** The workspace slug. */ + fun slug(slug: JsonField) = apply { this.slug = slug } - fun monthlyUsage(monthlyUsage: List) = - monthlyUsage(JsonField.of(monthlyUsage)) + fun status(status: Status) = status(JsonField.of(status)) - @JsonProperty("monthlyUsage") - @ExcludeMissing - fun monthlyUsage(monthlyUsage: JsonField>) = apply { - this.monthlyUsage = monthlyUsage - } + fun status(status: JsonField) = apply { this.status = status } - /** The number of invites in the workspace. */ - fun inviteCount(inviteCount: Long) = inviteCount(JsonField.of(inviteCount)) + /** The workspace invite code. */ + fun inviteCode(inviteCode: String) = inviteCode(JsonField.of(inviteCode)) - /** The number of invites in the workspace. */ - @JsonProperty("inviteCount") - @ExcludeMissing - fun inviteCount(inviteCount: JsonField) = apply { this.inviteCount = inviteCount } + /** The workspace invite code. */ + fun inviteCode(inviteCode: JsonField) = apply { this.inviteCode = inviteCode } - /** The start date of the current billing period. */ - fun periodStartDate(periodStartDate: OffsetDateTime) = - periodStartDate(JsonField.of(periodStartDate)) + fun monthlyUsage(monthlyUsage: List) = + monthlyUsage(JsonField.of(monthlyUsage)) - /** The start date of the current billing period. */ - @JsonProperty("periodStartDate") - @ExcludeMissing - fun periodStartDate(periodStartDate: JsonField) = apply { - this.periodStartDate = periodStartDate + fun monthlyUsage(monthlyUsage: JsonField>) = apply { + this.monthlyUsage = monthlyUsage.map { it.toMutableList() } } - /** The end date of the current billing period. */ - fun periodEndDate(periodEndDate: OffsetDateTime) = - periodEndDate(JsonField.of(periodEndDate)) - - /** The end date of the current billing period. */ - @JsonProperty("periodEndDate") - @ExcludeMissing - fun periodEndDate(periodEndDate: JsonField) = apply { - this.periodEndDate = periodEndDate + fun addMonthlyUsage(monthlyUsage: MonthlyUsage) = apply { + this.monthlyUsage = + (this.monthlyUsage ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(monthlyUsage) + } } /** Whether the workspace only allows SAML authentication. */ @@ -1807,50 +1967,67 @@ private constructor( samlOnlyAccess(JsonField.of(samlOnlyAccess)) /** Whether the workspace only allows SAML authentication. */ - @JsonProperty("samlOnlyAccess") - @ExcludeMissing fun samlOnlyAccess(samlOnlyAccess: JsonField) = apply { this.samlOnlyAccess = samlOnlyAccess } - fun status(status: Status) = status(JsonField.of(status)) + fun wildcardDomains(wildcardDomains: List) = + wildcardDomains(JsonField.of(wildcardDomains)) - @JsonProperty("status") - @ExcludeMissing - fun status(status: JsonField) = apply { this.status = status } + fun wildcardDomains(wildcardDomains: JsonField>) = apply { + this.wildcardDomains = wildcardDomains.map { it.toMutableList() } + } + + fun addWildcardDomain(wildcardDomain: String) = apply { + wildcardDomains = + (wildcardDomains ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(wildcardDomain) + } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Workspace = Workspace( - id, - name, - slug, - dateCreated, - dateUpdated, - creatorId, + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("inviteCount", inviteCount), + checkRequired("memberCount", memberCount), + checkRequired("name", name), + checkRequired("periodEndDate", periodEndDate), + checkRequired("periodStartDate", periodStartDate), + checkRequired("projectCount", projectCount), + checkRequired("slug", slug), + checkRequired("status", status), inviteCode, - wildcardDomains.map { it.toImmutable() }, - projectCount, - memberCount, - monthlyUsage.map { it.toImmutable() }, - inviteCount, - periodStartDate, - periodEndDate, + (monthlyUsage ?: JsonMissing.of()).map { it.toImmutable() }, samlOnlyAccess, - status, + (wildcardDomains ?: JsonMissing.of()).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -1948,17 +2125,25 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = MonthlyUsage.Builder::class) @NoAutoDetect class MonthlyUsage + @JsonCreator private constructor( - private val monthYear: JsonField, - private val predictionCount: JsonField, - private val executionTimeMs: JsonField, - private val additionalProperties: Map, + @JsonProperty("executionTimeMs") + @ExcludeMissing + private val executionTimeMs: JsonField = JsonMissing.of(), + @JsonProperty("monthYear") + @ExcludeMissing + private val monthYear: JsonField = JsonMissing.of(), + @JsonProperty("predictionCount") + @ExcludeMissing + private val predictionCount: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + fun executionTimeMs(): Optional = + Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) fun monthYear(): Optional = Optional.ofNullable(monthYear.getNullable("monthYear")) @@ -1966,30 +2151,33 @@ private constructor( fun predictionCount(): Optional = Optional.ofNullable(predictionCount.getNullable("predictionCount")) - fun executionTimeMs(): Optional = - Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) - - @JsonProperty("monthYear") @ExcludeMissing fun _monthYear() = monthYear + @JsonProperty("executionTimeMs") + @ExcludeMissing + fun _executionTimeMs(): JsonField = executionTimeMs - @JsonProperty("predictionCount") + @JsonProperty("monthYear") @ExcludeMissing - fun _predictionCount() = predictionCount + fun _monthYear(): JsonField = monthYear - @JsonProperty("executionTimeMs") + @JsonProperty("predictionCount") @ExcludeMissing - fun _executionTimeMs() = executionTimeMs + fun _predictionCount(): JsonField = predictionCount @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): MonthlyUsage = apply { - if (!validated) { - monthYear() - predictionCount() - executionTimeMs() - validated = true + if (validated) { + return@apply } + + executionTimeMs() + monthYear() + predictionCount() + validated = true } fun toBuilder() = Builder().from(this) @@ -2001,23 +2189,35 @@ private constructor( class Builder { + private var executionTimeMs: JsonField = JsonMissing.of() private var monthYear: JsonField = JsonMissing.of() private var predictionCount: JsonField = JsonMissing.of() - private var executionTimeMs: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(monthlyUsage: MonthlyUsage) = apply { - this.monthYear = monthlyUsage.monthYear - this.predictionCount = monthlyUsage.predictionCount - this.executionTimeMs = monthlyUsage.executionTimeMs - additionalProperties(monthlyUsage.additionalProperties) + executionTimeMs = monthlyUsage.executionTimeMs + monthYear = monthlyUsage.monthYear + predictionCount = monthlyUsage.predictionCount + additionalProperties = monthlyUsage.additionalProperties.toMutableMap() + } + + fun executionTimeMs(executionTimeMs: Long?) = + executionTimeMs(JsonField.ofNullable(executionTimeMs)) + + fun executionTimeMs(executionTimeMs: Long) = + executionTimeMs(executionTimeMs as Long?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun executionTimeMs(executionTimeMs: Optional) = + executionTimeMs(executionTimeMs.orElse(null) as Long?) + + fun executionTimeMs(executionTimeMs: JsonField) = apply { + this.executionTimeMs = executionTimeMs } fun monthYear(monthYear: LocalDate) = monthYear(JsonField.of(monthYear)) - @JsonProperty("monthYear") - @ExcludeMissing fun monthYear(monthYear: JsonField) = apply { this.monthYear = monthYear } @@ -2025,29 +2225,17 @@ private constructor( fun predictionCount(predictionCount: Long) = predictionCount(JsonField.of(predictionCount)) - @JsonProperty("predictionCount") - @ExcludeMissing fun predictionCount(predictionCount: JsonField) = apply { this.predictionCount = predictionCount } - fun executionTimeMs(executionTimeMs: Long) = - executionTimeMs(JsonField.of(executionTimeMs)) - - @JsonProperty("executionTimeMs") - @ExcludeMissing - fun executionTimeMs(executionTimeMs: JsonField) = apply { - this.executionTimeMs = executionTimeMs - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -2055,11 +2243,19 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): MonthlyUsage = MonthlyUsage( + executionTimeMs, monthYear, predictionCount, - executionTimeMs, additionalProperties.toImmutable(), ) } @@ -2069,17 +2265,17 @@ private constructor( return true } - return /* spotless:off */ other is MonthlyUsage && monthYear == other.monthYear && predictionCount == other.predictionCount && executionTimeMs == other.executionTimeMs && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MonthlyUsage && executionTimeMs == other.executionTimeMs && monthYear == other.monthYear && predictionCount == other.predictionCount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(monthYear, predictionCount, executionTimeMs, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(executionTimeMs, monthYear, predictionCount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MonthlyUsage{monthYear=$monthYear, predictionCount=$predictionCount, executionTimeMs=$executionTimeMs, additionalProperties=$additionalProperties}" + "MonthlyUsage{executionTimeMs=$executionTimeMs, monthYear=$monthYear, predictionCount=$predictionCount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2087,17 +2283,17 @@ private constructor( return true } - return /* spotless:off */ other is Workspace && id == other.id && name == other.name && slug == other.slug && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && creatorId == other.creatorId && inviteCode == other.inviteCode && wildcardDomains == other.wildcardDomains && projectCount == other.projectCount && memberCount == other.memberCount && monthlyUsage == other.monthlyUsage && inviteCount == other.inviteCount && periodStartDate == other.periodStartDate && periodEndDate == other.periodEndDate && samlOnlyAccess == other.samlOnlyAccess && status == other.status && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Workspace && id == other.id && creatorId == other.creatorId && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && inviteCount == other.inviteCount && memberCount == other.memberCount && name == other.name && periodEndDate == other.periodEndDate && periodStartDate == other.periodStartDate && projectCount == other.projectCount && slug == other.slug && status == other.status && inviteCode == other.inviteCode && monthlyUsage == other.monthlyUsage && samlOnlyAccess == other.samlOnlyAccess && wildcardDomains == other.wildcardDomains && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, name, slug, dateCreated, dateUpdated, creatorId, inviteCode, wildcardDomains, projectCount, memberCount, monthlyUsage, inviteCount, periodStartDate, periodEndDate, samlOnlyAccess, status, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, creatorId, dateCreated, dateUpdated, inviteCount, memberCount, name, periodEndDate, periodStartDate, projectCount, slug, status, inviteCode, monthlyUsage, samlOnlyAccess, wildcardDomains, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Workspace{id=$id, name=$name, slug=$slug, dateCreated=$dateCreated, dateUpdated=$dateUpdated, creatorId=$creatorId, inviteCode=$inviteCode, wildcardDomains=$wildcardDomains, projectCount=$projectCount, memberCount=$memberCount, monthlyUsage=$monthlyUsage, inviteCount=$inviteCount, periodStartDate=$periodStartDate, periodEndDate=$periodEndDate, samlOnlyAccess=$samlOnlyAccess, status=$status, additionalProperties=$additionalProperties}" + "Workspace{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, inviteCount=$inviteCount, memberCount=$memberCount, name=$name, periodEndDate=$periodEndDate, periodStartDate=$periodStartDate, projectCount=$projectCount, slug=$slug, status=$status, inviteCode=$inviteCode, monthlyUsage=$monthlyUsage, samlOnlyAccess=$samlOnlyAccess, wildcardDomains=$wildcardDomains, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2105,15 +2301,15 @@ private constructor( return true } - return /* spotless:off */ other is InferencePipelineUpdateResponse && id == other.id && projectId == other.projectId && workspaceId == other.workspaceId && project == other.project && workspace == other.workspace && name == other.name && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && dateLastSampleReceived == other.dateLastSampleReceived && description == other.description && dateLastEvaluated == other.dateLastEvaluated && dateOfNextEvaluation == other.dateOfNextEvaluation && passingGoalCount == other.passingGoalCount && failingGoalCount == other.failingGoalCount && totalGoalCount == other.totalGoalCount && status == other.status && statusMessage == other.statusMessage && links == other.links && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is InferencePipelineUpdateResponse && id == other.id && dateCreated == other.dateCreated && dateLastEvaluated == other.dateLastEvaluated && dateLastSampleReceived == other.dateLastSampleReceived && dateOfNextEvaluation == other.dateOfNextEvaluation && dateUpdated == other.dateUpdated && description == other.description && failingGoalCount == other.failingGoalCount && links == other.links && name == other.name && passingGoalCount == other.passingGoalCount && projectId == other.projectId && status == other.status && statusMessage == other.statusMessage && totalGoalCount == other.totalGoalCount && project == other.project && workspace == other.workspace && workspaceId == other.workspaceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, projectId, workspaceId, project, workspace, name, dateCreated, dateUpdated, dateLastSampleReceived, description, dateLastEvaluated, dateOfNextEvaluation, passingGoalCount, failingGoalCount, totalGoalCount, status, statusMessage, links, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dateCreated, dateLastEvaluated, dateLastSampleReceived, dateOfNextEvaluation, dateUpdated, description, failingGoalCount, links, name, passingGoalCount, projectId, status, statusMessage, totalGoalCount, project, workspace, workspaceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InferencePipelineUpdateResponse{id=$id, projectId=$projectId, workspaceId=$workspaceId, project=$project, workspace=$workspace, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, dateLastSampleReceived=$dateLastSampleReceived, description=$description, dateLastEvaluated=$dateLastEvaluated, dateOfNextEvaluation=$dateOfNextEvaluation, passingGoalCount=$passingGoalCount, failingGoalCount=$failingGoalCount, totalGoalCount=$totalGoalCount, status=$status, statusMessage=$statusMessage, links=$links, additionalProperties=$additionalProperties}" + "InferencePipelineUpdateResponse{id=$id, dateCreated=$dateCreated, dateLastEvaluated=$dateLastEvaluated, dateLastSampleReceived=$dateLastSampleReceived, dateOfNextEvaluation=$dateOfNextEvaluation, dateUpdated=$dateUpdated, description=$description, failingGoalCount=$failingGoalCount, links=$links, name=$name, passingGoalCount=$passingGoalCount, projectId=$projectId, status=$status, statusMessage=$statusMessage, totalGoalCount=$totalGoalCount, project=$project, workspace=$workspace, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt index ebdccfca..1aebe85c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt @@ -6,58 +6,64 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.Enum import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional +/** Create a new commit (project version) in a project. */ class ProjectCommitCreateParams constructor( private val projectId: String, - private val commit: Commit, - private val storageUri: String, - private val archived: Boolean?, - private val deploymentStatus: String?, + private val body: ProjectCommitCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun projectId(): String = projectId - fun commit(): Commit = commit + /** The details of a commit (project version). */ + fun commit(): Commit = body.commit() + + /** The storage URI where the commit bundle is stored. */ + fun storageUri(): String = body.storageUri() + + /** Whether the commit is archived. */ + fun archived(): Optional = body.archived() + + /** The deployment status associated with the commit's model. */ + fun deploymentStatus(): Optional = body.deploymentStatus() + + /** The details of a commit (project version). */ + fun _commit(): JsonField = body._commit() + + /** The storage URI where the commit bundle is stored. */ + fun _storageUri(): JsonField = body._storageUri() - fun storageUri(): String = storageUri + /** Whether the commit is archived. */ + fun _archived(): JsonField = body._archived() - fun archived(): Optional = Optional.ofNullable(archived) + /** The deployment status associated with the commit's model. */ + fun _deploymentStatus(): JsonField = body._deploymentStatus() - fun deploymentStatus(): Optional = Optional.ofNullable(deploymentStatus) + fun _additionalBodyProperties(): Map = body._additionalProperties() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): ProjectCommitCreateBody { - return ProjectCommitCreateBody( - commit, - storageUri, - archived, - deploymentStatus, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): ProjectCommitCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -70,33 +76,73 @@ constructor( } } - @JsonDeserialize(builder = ProjectCommitCreateBody.Builder::class) @NoAutoDetect class ProjectCommitCreateBody + @JsonCreator internal constructor( - private val commit: Commit?, - private val storageUri: String?, - private val archived: Boolean?, - private val deploymentStatus: String?, - private val additionalProperties: Map, + @JsonProperty("commit") + @ExcludeMissing + private val commit: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + private val storageUri: JsonField = JsonMissing.of(), + @JsonProperty("archived") + @ExcludeMissing + private val archived: JsonField = JsonMissing.of(), + @JsonProperty("deploymentStatus") + @ExcludeMissing + private val deploymentStatus: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** The details of a commit (project version). */ - @JsonProperty("commit") fun commit(): Commit? = commit + fun commit(): Commit = commit.getRequired("commit") /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") fun storageUri(): String? = storageUri + fun storageUri(): String = storageUri.getRequired("storageUri") /** Whether the commit is archived. */ - @JsonProperty("archived") fun archived(): Boolean? = archived + fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) /** The deployment status associated with the commit's model. */ - @JsonProperty("deploymentStatus") fun deploymentStatus(): String? = deploymentStatus + fun deploymentStatus(): Optional = + Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + + /** The details of a commit (project version). */ + @JsonProperty("commit") @ExcludeMissing fun _commit(): JsonField = commit + + /** The storage URI where the commit bundle is stored. */ + @JsonProperty("storageUri") + @ExcludeMissing + fun _storageUri(): JsonField = storageUri + + /** Whether the commit is archived. */ + @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived + + /** The deployment status associated with the commit's model. */ + @JsonProperty("deploymentStatus") + @ExcludeMissing + fun _deploymentStatus(): JsonField = deploymentStatus @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + + fun validate(): ProjectCommitCreateBody = apply { + if (validated) { + return@apply + } + + commit().validate() + storageUri() + archived() + deploymentStatus() + validated = true + } + fun toBuilder() = Builder().from(this) companion object { @@ -106,56 +152,78 @@ constructor( class Builder { - private var commit: Commit? = null - private var storageUri: String? = null - private var archived: Boolean? = null - private var deploymentStatus: String? = null + private var commit: JsonField? = null + private var storageUri: JsonField? = null + private var archived: JsonField = JsonMissing.of() + private var deploymentStatus: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(projectCommitCreateBody: ProjectCommitCreateBody) = apply { - this.commit = projectCommitCreateBody.commit - this.storageUri = projectCommitCreateBody.storageUri - this.archived = projectCommitCreateBody.archived - this.deploymentStatus = projectCommitCreateBody.deploymentStatus - additionalProperties(projectCommitCreateBody.additionalProperties) + commit = projectCommitCreateBody.commit + storageUri = projectCommitCreateBody.storageUri + archived = projectCommitCreateBody.archived + deploymentStatus = projectCommitCreateBody.deploymentStatus + additionalProperties = projectCommitCreateBody.additionalProperties.toMutableMap() } /** The details of a commit (project version). */ - @JsonProperty("commit") fun commit(commit: Commit) = apply { this.commit = commit } + fun commit(commit: Commit) = commit(JsonField.of(commit)) + + /** The details of a commit (project version). */ + fun commit(commit: JsonField) = apply { this.commit = commit } /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") - fun storageUri(storageUri: String) = apply { this.storageUri = storageUri } + fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) + + /** The storage URI where the commit bundle is stored. */ + fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } + + /** Whether the commit is archived. */ + fun archived(archived: Boolean?) = archived(JsonField.ofNullable(archived)) /** Whether the commit is archived. */ - @JsonProperty("archived") - fun archived(archived: Boolean) = apply { this.archived = archived } + fun archived(archived: Boolean) = archived(archived as Boolean?) + + /** Whether the commit is archived. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun archived(archived: Optional) = archived(archived.orElse(null) as Boolean?) + + /** Whether the commit is archived. */ + fun archived(archived: JsonField) = apply { this.archived = archived } + + /** The deployment status associated with the commit's model. */ + fun deploymentStatus(deploymentStatus: String) = + deploymentStatus(JsonField.of(deploymentStatus)) /** The deployment status associated with the commit's model. */ - @JsonProperty("deploymentStatus") - fun deploymentStatus(deploymentStatus: String) = apply { + fun deploymentStatus(deploymentStatus: JsonField) = apply { this.deploymentStatus = deploymentStatus } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): ProjectCommitCreateBody = ProjectCommitCreateBody( - checkNotNull(commit) { "`commit` is required but was not set" }, - checkNotNull(storageUri) { "`storageUri` is required but was not set" }, + checkRequired("commit", commit), + checkRequired("storageUri", storageUri), archived, deploymentStatus, additionalProperties.toImmutable(), @@ -191,41 +259,72 @@ constructor( class Builder { private var projectId: String? = null - private var commit: Commit? = null - private var storageUri: String? = null - private var archived: Boolean? = null - private var deploymentStatus: String? = null + private var body: ProjectCommitCreateBody.Builder = ProjectCommitCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(projectCommitCreateParams: ProjectCommitCreateParams) = apply { projectId = projectCommitCreateParams.projectId - commit = projectCommitCreateParams.commit - storageUri = projectCommitCreateParams.storageUri - archived = projectCommitCreateParams.archived - deploymentStatus = projectCommitCreateParams.deploymentStatus + body = projectCommitCreateParams.body.toBuilder() additionalHeaders = projectCommitCreateParams.additionalHeaders.toBuilder() additionalQueryParams = projectCommitCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - projectCommitCreateParams.additionalBodyProperties.toMutableMap() } fun projectId(projectId: String) = apply { this.projectId = projectId } /** The details of a commit (project version). */ - fun commit(commit: Commit) = apply { this.commit = commit } + fun commit(commit: Commit) = apply { body.commit(commit) } + + /** The details of a commit (project version). */ + fun commit(commit: JsonField) = apply { body.commit(commit) } /** The storage URI where the commit bundle is stored. */ - fun storageUri(storageUri: String) = apply { this.storageUri = storageUri } + fun storageUri(storageUri: String) = apply { body.storageUri(storageUri) } + + /** The storage URI where the commit bundle is stored. */ + fun storageUri(storageUri: JsonField) = apply { body.storageUri(storageUri) } + + /** Whether the commit is archived. */ + fun archived(archived: Boolean?) = apply { body.archived(archived) } /** Whether the commit is archived. */ - fun archived(archived: Boolean) = apply { this.archived = archived } + fun archived(archived: Boolean) = archived(archived as Boolean?) + + /** Whether the commit is archived. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun archived(archived: Optional) = archived(archived.orElse(null) as Boolean?) + + /** Whether the commit is archived. */ + fun archived(archived: JsonField) = apply { body.archived(archived) } /** The deployment status associated with the commit's model. */ fun deploymentStatus(deploymentStatus: String) = apply { - this.deploymentStatus = deploymentStatus + body.deploymentStatus(deploymentStatus) + } + + /** The deployment status associated with the commit's model. */ + fun deploymentStatus(deploymentStatus: JsonField) = apply { + body.deploymentStatus(deploymentStatus) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) } fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -326,102 +425,176 @@ constructor( additionalQueryParams.removeAll(keys) } - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) - } - fun build(): ProjectCommitCreateParams = ProjectCommitCreateParams( - checkNotNull(projectId) { "`projectId` is required but was not set" }, - checkNotNull(commit) { "`commit` is required but was not set" }, - checkNotNull(storageUri) { "`storageUri` is required but was not set" }, - archived, - deploymentStatus, + checkRequired("projectId", projectId), + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } /** The details of a commit (project version). */ - @JsonDeserialize(builder = Commit.Builder::class) @NoAutoDetect class Commit + @JsonCreator private constructor( - private val id: String?, - private val authorId: String?, - private val dateCreated: OffsetDateTime?, - private val fileSize: Long?, - private val message: String?, - private val mlModelId: String?, - private val validationDatasetId: String?, - private val trainingDatasetId: String?, - private val storageUri: String?, - private val gitCommitSha: Long?, - private val gitCommitRef: String?, - private val gitCommitUrl: String?, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("authorId") + @ExcludeMissing + private val authorId: JsonField = JsonMissing.of(), + @JsonProperty("fileSize") + @ExcludeMissing + private val fileSize: JsonField = JsonMissing.of(), + @JsonProperty("message") + @ExcludeMissing + private val message: JsonField = JsonMissing.of(), + @JsonProperty("mlModelId") + @ExcludeMissing + private val mlModelId: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + private val storageUri: JsonField = JsonMissing.of(), + @JsonProperty("trainingDatasetId") + @ExcludeMissing + private val trainingDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("validationDatasetId") + @ExcludeMissing + private val validationDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitRef") + @ExcludeMissing + private val gitCommitRef: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitSha") + @ExcludeMissing + private val gitCommitSha: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitUrl") + @ExcludeMissing + private val gitCommitUrl: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** The commit id. */ - @JsonProperty("id") fun id(): String? = id + fun id(): String = id.getRequired("id") /** The author id of the commit. */ - @JsonProperty("authorId") fun authorId(): String? = authorId + fun authorId(): String = authorId.getRequired("authorId") + + /** The size of the commit bundle in bytes. */ + fun fileSize(): Optional = Optional.ofNullable(fileSize.getNullable("fileSize")) + + /** The commit message. */ + fun message(): String = message.getRequired("message") + + /** The model id. */ + fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + + /** The storage URI where the commit bundle is stored. */ + fun storageUri(): String = storageUri.getRequired("storageUri") + + /** The training dataset id. */ + fun trainingDatasetId(): Optional = + Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + + /** The validation dataset id. */ + fun validationDatasetId(): Optional = + Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) /** The commit creation date. */ - @JsonProperty("dateCreated") fun dateCreated(): OffsetDateTime? = dateCreated + fun dateCreated(): Optional = + Optional.ofNullable(dateCreated.getNullable("dateCreated")) + + /** The ref of the corresponding git commit. */ + fun gitCommitRef(): Optional = + Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) + + /** The SHA of the corresponding git commit. */ + fun gitCommitSha(): Optional = + Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) + + /** The URL of the corresponding git commit. */ + fun gitCommitUrl(): Optional = + Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) + + /** The commit id. */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** The author id of the commit. */ + @JsonProperty("authorId") @ExcludeMissing fun _authorId(): JsonField = authorId /** The size of the commit bundle in bytes. */ - @JsonProperty("fileSize") fun fileSize(): Long? = fileSize + @JsonProperty("fileSize") @ExcludeMissing fun _fileSize(): JsonField = fileSize /** The commit message. */ - @JsonProperty("message") fun message(): String? = message + @JsonProperty("message") @ExcludeMissing fun _message(): JsonField = message /** The model id. */ - @JsonProperty("mlModelId") fun mlModelId(): String? = mlModelId + @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId(): JsonField = mlModelId - /** The validation dataset id. */ - @JsonProperty("validationDatasetId") - fun validationDatasetId(): String? = validationDatasetId + /** The storage URI where the commit bundle is stored. */ + @JsonProperty("storageUri") + @ExcludeMissing + fun _storageUri(): JsonField = storageUri /** The training dataset id. */ - @JsonProperty("trainingDatasetId") fun trainingDatasetId(): String? = trainingDatasetId + @JsonProperty("trainingDatasetId") + @ExcludeMissing + fun _trainingDatasetId(): JsonField = trainingDatasetId - /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") fun storageUri(): String? = storageUri + /** The validation dataset id. */ + @JsonProperty("validationDatasetId") + @ExcludeMissing + fun _validationDatasetId(): JsonField = validationDatasetId - /** The SHA of the corresponding git commit. */ - @JsonProperty("gitCommitSha") fun gitCommitSha(): Long? = gitCommitSha + /** The commit creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated /** The ref of the corresponding git commit. */ - @JsonProperty("gitCommitRef") fun gitCommitRef(): String? = gitCommitRef + @JsonProperty("gitCommitRef") + @ExcludeMissing + fun _gitCommitRef(): JsonField = gitCommitRef + + /** The SHA of the corresponding git commit. */ + @JsonProperty("gitCommitSha") + @ExcludeMissing + fun _gitCommitSha(): JsonField = gitCommitSha /** The URL of the corresponding git commit. */ - @JsonProperty("gitCommitUrl") fun gitCommitUrl(): String? = gitCommitUrl + @JsonProperty("gitCommitUrl") + @ExcludeMissing + fun _gitCommitUrl(): JsonField = gitCommitUrl @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + + fun validate(): Commit = apply { + if (validated) { + return@apply + } + + id() + authorId() + fileSize() + message() + mlModelId() + storageUri() + trainingDatasetId() + validationDatasetId() + dateCreated() + gitCommitRef() + gitCommitSha() + gitCommitUrl() + validated = true + } + fun toBuilder() = Builder().from(this) companion object { @@ -431,114 +604,173 @@ constructor( class Builder { - private var id: String? = null - private var authorId: String? = null - private var dateCreated: OffsetDateTime? = null - private var fileSize: Long? = null - private var message: String? = null - private var mlModelId: String? = null - private var validationDatasetId: String? = null - private var trainingDatasetId: String? = null - private var storageUri: String? = null - private var gitCommitSha: Long? = null - private var gitCommitRef: String? = null - private var gitCommitUrl: String? = null + private var id: JsonField? = null + private var authorId: JsonField? = null + private var fileSize: JsonField? = null + private var message: JsonField? = null + private var mlModelId: JsonField? = null + private var storageUri: JsonField? = null + private var trainingDatasetId: JsonField? = null + private var validationDatasetId: JsonField? = null + private var dateCreated: JsonField = JsonMissing.of() + private var gitCommitRef: JsonField = JsonMissing.of() + private var gitCommitSha: JsonField = JsonMissing.of() + private var gitCommitUrl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(commit: Commit) = apply { - this.id = commit.id - this.authorId = commit.authorId - this.dateCreated = commit.dateCreated - this.fileSize = commit.fileSize - this.message = commit.message - this.mlModelId = commit.mlModelId - this.validationDatasetId = commit.validationDatasetId - this.trainingDatasetId = commit.trainingDatasetId - this.storageUri = commit.storageUri - this.gitCommitSha = commit.gitCommitSha - this.gitCommitRef = commit.gitCommitRef - this.gitCommitUrl = commit.gitCommitUrl - additionalProperties(commit.additionalProperties) + id = commit.id + authorId = commit.authorId + fileSize = commit.fileSize + message = commit.message + mlModelId = commit.mlModelId + storageUri = commit.storageUri + trainingDatasetId = commit.trainingDatasetId + validationDatasetId = commit.validationDatasetId + dateCreated = commit.dateCreated + gitCommitRef = commit.gitCommitRef + gitCommitSha = commit.gitCommitSha + gitCommitUrl = commit.gitCommitUrl + additionalProperties = commit.additionalProperties.toMutableMap() } /** The commit id. */ - @JsonProperty("id") fun id(id: String) = apply { this.id = id } + fun id(id: String) = id(JsonField.of(id)) + + /** The commit id. */ + fun id(id: JsonField) = apply { this.id = id } /** The author id of the commit. */ - @JsonProperty("authorId") - fun authorId(authorId: String) = apply { this.authorId = authorId } + fun authorId(authorId: String) = authorId(JsonField.of(authorId)) - /** The commit creation date. */ - @JsonProperty("dateCreated") - fun dateCreated(dateCreated: OffsetDateTime) = apply { this.dateCreated = dateCreated } + /** The author id of the commit. */ + fun authorId(authorId: JsonField) = apply { this.authorId = authorId } + + /** The size of the commit bundle in bytes. */ + fun fileSize(fileSize: Long?) = fileSize(JsonField.ofNullable(fileSize)) /** The size of the commit bundle in bytes. */ - @JsonProperty("fileSize") - fun fileSize(fileSize: Long) = apply { this.fileSize = fileSize } + fun fileSize(fileSize: Long) = fileSize(fileSize as Long?) + + /** The size of the commit bundle in bytes. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fileSize(fileSize: Optional) = fileSize(fileSize.orElse(null) as Long?) + + /** The size of the commit bundle in bytes. */ + fun fileSize(fileSize: JsonField) = apply { this.fileSize = fileSize } + + /** The commit message. */ + fun message(message: String) = message(JsonField.of(message)) /** The commit message. */ - @JsonProperty("message") fun message(message: String) = apply { this.message = message } + fun message(message: JsonField) = apply { this.message = message } /** The model id. */ - @JsonProperty("mlModelId") - fun mlModelId(mlModelId: String) = apply { this.mlModelId = mlModelId } + fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) + + /** The model id. */ + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.orElse(null)) + + /** The model id. */ + fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } + + /** The storage URI where the commit bundle is stored. */ + fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) + + /** The storage URI where the commit bundle is stored. */ + fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } + + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: String?) = + trainingDatasetId(JsonField.ofNullable(trainingDatasetId)) + + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: Optional) = + trainingDatasetId(trainingDatasetId.orElse(null)) + + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: JsonField) = apply { + this.trainingDatasetId = trainingDatasetId + } /** The validation dataset id. */ - @JsonProperty("validationDatasetId") - fun validationDatasetId(validationDatasetId: String) = apply { + fun validationDatasetId(validationDatasetId: String?) = + validationDatasetId(JsonField.ofNullable(validationDatasetId)) + + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: Optional) = + validationDatasetId(validationDatasetId.orElse(null)) + + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: JsonField) = apply { this.validationDatasetId = validationDatasetId } - /** The training dataset id. */ - @JsonProperty("trainingDatasetId") - fun trainingDatasetId(trainingDatasetId: String) = apply { - this.trainingDatasetId = trainingDatasetId + /** The commit creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** The commit creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated } - /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") - fun storageUri(storageUri: String) = apply { this.storageUri = storageUri } + /** The ref of the corresponding git commit. */ + fun gitCommitRef(gitCommitRef: String) = gitCommitRef(JsonField.of(gitCommitRef)) + + /** The ref of the corresponding git commit. */ + fun gitCommitRef(gitCommitRef: JsonField) = apply { + this.gitCommitRef = gitCommitRef + } /** The SHA of the corresponding git commit. */ - @JsonProperty("gitCommitSha") - fun gitCommitSha(gitCommitSha: Long) = apply { this.gitCommitSha = gitCommitSha } + fun gitCommitSha(gitCommitSha: Long) = gitCommitSha(JsonField.of(gitCommitSha)) - /** The ref of the corresponding git commit. */ - @JsonProperty("gitCommitRef") - fun gitCommitRef(gitCommitRef: String) = apply { this.gitCommitRef = gitCommitRef } + /** The SHA of the corresponding git commit. */ + fun gitCommitSha(gitCommitSha: JsonField) = apply { + this.gitCommitSha = gitCommitSha + } /** The URL of the corresponding git commit. */ - @JsonProperty("gitCommitUrl") - fun gitCommitUrl(gitCommitUrl: String) = apply { this.gitCommitUrl = gitCommitUrl } + fun gitCommitUrl(gitCommitUrl: String) = gitCommitUrl(JsonField.of(gitCommitUrl)) + + /** The URL of the corresponding git commit. */ + fun gitCommitUrl(gitCommitUrl: JsonField) = apply { + this.gitCommitUrl = gitCommitUrl + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Commit = Commit( - checkNotNull(id) { "`id` is required but was not set" }, - checkNotNull(authorId) { "`authorId` is required but was not set" }, + checkRequired("id", id), + checkRequired("authorId", authorId), + checkRequired("fileSize", fileSize), + checkRequired("message", message), + checkRequired("mlModelId", mlModelId), + checkRequired("storageUri", storageUri), + checkRequired("trainingDatasetId", trainingDatasetId), + checkRequired("validationDatasetId", validationDatasetId), dateCreated, - fileSize, - checkNotNull(message) { "`message` is required but was not set" }, - mlModelId, - validationDatasetId, - trainingDatasetId, - checkNotNull(storageUri) { "`storageUri` is required but was not set" }, - gitCommitSha, gitCommitRef, + gitCommitSha, gitCommitUrl, additionalProperties.toImmutable(), ) @@ -549,19 +781,23 @@ constructor( return true } - return /* spotless:off */ other is Commit && id == other.id && authorId == other.authorId && dateCreated == other.dateCreated && fileSize == other.fileSize && message == other.message && mlModelId == other.mlModelId && validationDatasetId == other.validationDatasetId && trainingDatasetId == other.trainingDatasetId && storageUri == other.storageUri && gitCommitSha == other.gitCommitSha && gitCommitRef == other.gitCommitRef && gitCommitUrl == other.gitCommitUrl && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Commit && id == other.id && authorId == other.authorId && fileSize == other.fileSize && message == other.message && mlModelId == other.mlModelId && storageUri == other.storageUri && trainingDatasetId == other.trainingDatasetId && validationDatasetId == other.validationDatasetId && dateCreated == other.dateCreated && gitCommitRef == other.gitCommitRef && gitCommitSha == other.gitCommitSha && gitCommitUrl == other.gitCommitUrl && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, authorId, dateCreated, fileSize, message, mlModelId, validationDatasetId, trainingDatasetId, storageUri, gitCommitSha, gitCommitRef, gitCommitUrl, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, authorId, fileSize, message, mlModelId, storageUri, trainingDatasetId, validationDatasetId, dateCreated, gitCommitRef, gitCommitSha, gitCommitUrl, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Commit{id=$id, authorId=$authorId, dateCreated=$dateCreated, fileSize=$fileSize, message=$message, mlModelId=$mlModelId, validationDatasetId=$validationDatasetId, trainingDatasetId=$trainingDatasetId, storageUri=$storageUri, gitCommitSha=$gitCommitSha, gitCommitRef=$gitCommitRef, gitCommitUrl=$gitCommitUrl, additionalProperties=$additionalProperties}" + "Commit{id=$id, authorId=$authorId, fileSize=$fileSize, message=$message, mlModelId=$mlModelId, storageUri=$storageUri, trainingDatasetId=$trainingDatasetId, validationDatasetId=$validationDatasetId, dateCreated=$dateCreated, gitCommitRef=$gitCommitRef, gitCommitSha=$gitCommitSha, gitCommitUrl=$gitCommitUrl, additionalProperties=$additionalProperties}" } + /** + * The commit status. Initially, the commit is `queued`, then, it switches to `running`. + * Finally, it can be `paused`, `failed`, or `completed`. + */ class Status @JsonCreator private constructor( @@ -643,20 +879,34 @@ constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect class Links + @JsonCreator private constructor( - private val app: String?, - private val additionalProperties: Map, + @JsonProperty("app") @ExcludeMissing private val app: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("app") fun app(): String? = app + fun app(): String = app.getRequired("app") + + @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true + } + fun toBuilder() = Builder().from(this) companion object { @@ -666,36 +916,40 @@ constructor( class Builder { - private var app: String? = null + private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) + app = links.app + additionalProperties = links.additionalProperties.toMutableMap() } - @JsonProperty("app") fun app(app: String) = apply { this.app = app } + fun app(app: String) = app(JsonField.of(app)) + + fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Links = - Links( - checkNotNull(app) { "`app` is required but was not set" }, - additionalProperties.toImmutable() - ) + Links(checkRequired("app", app), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -720,11 +974,11 @@ constructor( return true } - return /* spotless:off */ other is ProjectCommitCreateParams && projectId == other.projectId && commit == other.commit && storageUri == other.storageUri && archived == other.archived && deploymentStatus == other.deploymentStatus && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is ProjectCommitCreateParams && projectId == other.projectId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(projectId, commit, storageUri, archived, deploymentStatus, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(projectId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "ProjectCommitCreateParams{projectId=$projectId, commit=$commit, storageUri=$storageUri, archived=$archived, deploymentStatus=$deploymentStatus, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "ProjectCommitCreateParams{projectId=$projectId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt index 70d132a7..94035610 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt @@ -6,51 +6,99 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.Enum import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = ProjectCommitCreateResponse.Builder::class) @NoAutoDetect class ProjectCommitCreateResponse +@JsonCreator private constructor( - private val id: JsonField, - private val dateCreated: JsonField, - private val status: JsonField, - private val statusMessage: JsonField, - private val projectId: JsonField, - private val storageUri: JsonField, - private val commit: JsonField, - private val deploymentStatus: JsonField, - private val mlModelId: JsonField, - private val validationDatasetId: JsonField, - private val trainingDatasetId: JsonField, - private val archived: JsonField, - private val dateArchived: JsonField, - private val passingGoalCount: JsonField, - private val failingGoalCount: JsonField, - private val totalGoalCount: JsonField, - private val links: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("commit") + @ExcludeMissing + private val commit: JsonField = JsonMissing.of(), + @JsonProperty("dateArchived") + @ExcludeMissing + private val dateArchived: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("failingGoalCount") + @ExcludeMissing + private val failingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("mlModelId") + @ExcludeMissing + private val mlModelId: JsonField = JsonMissing.of(), + @JsonProperty("passingGoalCount") + @ExcludeMissing + private val passingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + private val projectId: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + private val statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + private val storageUri: JsonField = JsonMissing.of(), + @JsonProperty("totalGoalCount") + @ExcludeMissing + private val totalGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("trainingDatasetId") + @ExcludeMissing + private val trainingDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("validationDatasetId") + @ExcludeMissing + private val validationDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("archived") + @ExcludeMissing + private val archived: JsonField = JsonMissing.of(), + @JsonProperty("deploymentStatus") + @ExcludeMissing + private val deploymentStatus: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing private val links: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The project version (commit) id. */ fun id(): String = id.getRequired("id") + /** The details of a commit (project version). */ + fun commit(): Commit = commit.getRequired("commit") + + /** The commit archive date. */ + fun dateArchived(): Optional = + Optional.ofNullable(dateArchived.getNullable("dateArchived")) + /** The project version (commit) creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + /** The number of tests that are failing for the commit. */ + fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") + + /** The model id. */ + fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + + /** The number of tests that are passing for the commit. */ + fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") + + /** The project id. */ + fun projectId(): String = projectId.getRequired("projectId") + /** * The commit status. Initially, the commit is `queued`, then, it switches to `running`. * Finally, it can be `paused`, `failed`, or `completed`. @@ -61,128 +109,129 @@ private constructor( fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) - /** The project id. */ - fun projectId(): String = projectId.getRequired("projectId") - /** The storage URI where the commit bundle is stored. */ fun storageUri(): String = storageUri.getRequired("storageUri") - /** The details of a commit (project version). */ - fun commit(): Commit = commit.getRequired("commit") - - /** The deployment status associated with the commit's model. */ - fun deploymentStatus(): Optional = - Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + /** The total number of tests for the commit. */ + fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") - /** The model id. */ - fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + /** The training dataset id. */ + fun trainingDatasetId(): Optional = + Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) /** The validation dataset id. */ fun validationDatasetId(): Optional = Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) - /** The training dataset id. */ - fun trainingDatasetId(): Optional = - Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) - /** Whether the commit is archived. */ fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) + /** The deployment status associated with the commit's model. */ + fun deploymentStatus(): Optional = + Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + + fun links(): Optional = Optional.ofNullable(links.getNullable("links")) + + /** The project version (commit) id. */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** The details of a commit (project version). */ + @JsonProperty("commit") @ExcludeMissing fun _commit(): JsonField = commit + /** The commit archive date. */ - fun dateArchived(): Optional = - Optional.ofNullable(dateArchived.getNullable("dateArchived")) + @JsonProperty("dateArchived") + @ExcludeMissing + fun _dateArchived(): JsonField = dateArchived - /** The number of tests that are passing for the commit. */ - fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") + /** The project version (commit) creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated /** The number of tests that are failing for the commit. */ - fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") - - /** The total number of tests for the commit. */ - fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") + @JsonProperty("failingGoalCount") + @ExcludeMissing + fun _failingGoalCount(): JsonField = failingGoalCount - fun links(): Optional = Optional.ofNullable(links.getNullable("links")) + /** The model id. */ + @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId(): JsonField = mlModelId - /** The project version (commit) id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The number of tests that are passing for the commit. */ + @JsonProperty("passingGoalCount") + @ExcludeMissing + fun _passingGoalCount(): JsonField = passingGoalCount - /** The project version (commit) creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + /** The project id. */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId /** * The commit status. Initially, the commit is `queued`, then, it switches to `running`. * Finally, it can be `paused`, `failed`, or `completed`. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status /** The commit status message. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage - - /** The project id. */ - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") @ExcludeMissing fun _storageUri() = storageUri + @JsonProperty("storageUri") @ExcludeMissing fun _storageUri(): JsonField = storageUri - /** The details of a commit (project version). */ - @JsonProperty("commit") @ExcludeMissing fun _commit() = commit - - /** The deployment status associated with the commit's model. */ - @JsonProperty("deploymentStatus") @ExcludeMissing fun _deploymentStatus() = deploymentStatus + /** The total number of tests for the commit. */ + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun _totalGoalCount(): JsonField = totalGoalCount - /** The model id. */ - @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId() = mlModelId + /** The training dataset id. */ + @JsonProperty("trainingDatasetId") + @ExcludeMissing + fun _trainingDatasetId(): JsonField = trainingDatasetId /** The validation dataset id. */ @JsonProperty("validationDatasetId") @ExcludeMissing - fun _validationDatasetId() = validationDatasetId - - /** The training dataset id. */ - @JsonProperty("trainingDatasetId") @ExcludeMissing fun _trainingDatasetId() = trainingDatasetId + fun _validationDatasetId(): JsonField = validationDatasetId /** Whether the commit is archived. */ - @JsonProperty("archived") @ExcludeMissing fun _archived() = archived - - /** The commit archive date. */ - @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived() = dateArchived - - /** The number of tests that are passing for the commit. */ - @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount - - /** The number of tests that are failing for the commit. */ - @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount + @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived - /** The total number of tests for the commit. */ - @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount + /** The deployment status associated with the commit's model. */ + @JsonProperty("deploymentStatus") + @ExcludeMissing + fun _deploymentStatus(): JsonField = deploymentStatus - @JsonProperty("links") @ExcludeMissing fun _links() = links + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): ProjectCommitCreateResponse = apply { - if (!validated) { - id() - dateCreated() - status() - statusMessage() - projectId() - storageUri() - commit().validate() - deploymentStatus() - mlModelId() - validationDatasetId() - trainingDatasetId() - archived() - dateArchived() - passingGoalCount() - failingGoalCount() - totalGoalCount() - links().map { it.validate() } - validated = true + if (validated) { + return@apply } + + id() + commit().validate() + dateArchived() + dateCreated() + failingGoalCount() + mlModelId() + passingGoalCount() + projectId() + status() + statusMessage() + storageUri() + totalGoalCount() + trainingDatasetId() + validationDatasetId() + archived() + deploymentStatus() + links().ifPresent { it.validate() } + validated = true } fun toBuilder() = Builder().from(this) @@ -194,63 +243,113 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var statusMessage: JsonField = JsonMissing.of() - private var projectId: JsonField = JsonMissing.of() - private var storageUri: JsonField = JsonMissing.of() - private var commit: JsonField = JsonMissing.of() - private var deploymentStatus: JsonField = JsonMissing.of() - private var mlModelId: JsonField = JsonMissing.of() - private var validationDatasetId: JsonField = JsonMissing.of() - private var trainingDatasetId: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var commit: JsonField? = null + private var dateArchived: JsonField? = null + private var dateCreated: JsonField? = null + private var failingGoalCount: JsonField? = null + private var mlModelId: JsonField? = null + private var passingGoalCount: JsonField? = null + private var projectId: JsonField? = null + private var status: JsonField? = null + private var statusMessage: JsonField? = null + private var storageUri: JsonField? = null + private var totalGoalCount: JsonField? = null + private var trainingDatasetId: JsonField? = null + private var validationDatasetId: JsonField? = null private var archived: JsonField = JsonMissing.of() - private var dateArchived: JsonField = JsonMissing.of() - private var passingGoalCount: JsonField = JsonMissing.of() - private var failingGoalCount: JsonField = JsonMissing.of() - private var totalGoalCount: JsonField = JsonMissing.of() + private var deploymentStatus: JsonField = JsonMissing.of() private var links: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(projectCommitCreateResponse: ProjectCommitCreateResponse) = apply { - this.id = projectCommitCreateResponse.id - this.dateCreated = projectCommitCreateResponse.dateCreated - this.status = projectCommitCreateResponse.status - this.statusMessage = projectCommitCreateResponse.statusMessage - this.projectId = projectCommitCreateResponse.projectId - this.storageUri = projectCommitCreateResponse.storageUri - this.commit = projectCommitCreateResponse.commit - this.deploymentStatus = projectCommitCreateResponse.deploymentStatus - this.mlModelId = projectCommitCreateResponse.mlModelId - this.validationDatasetId = projectCommitCreateResponse.validationDatasetId - this.trainingDatasetId = projectCommitCreateResponse.trainingDatasetId - this.archived = projectCommitCreateResponse.archived - this.dateArchived = projectCommitCreateResponse.dateArchived - this.passingGoalCount = projectCommitCreateResponse.passingGoalCount - this.failingGoalCount = projectCommitCreateResponse.failingGoalCount - this.totalGoalCount = projectCommitCreateResponse.totalGoalCount - this.links = projectCommitCreateResponse.links - additionalProperties(projectCommitCreateResponse.additionalProperties) + id = projectCommitCreateResponse.id + commit = projectCommitCreateResponse.commit + dateArchived = projectCommitCreateResponse.dateArchived + dateCreated = projectCommitCreateResponse.dateCreated + failingGoalCount = projectCommitCreateResponse.failingGoalCount + mlModelId = projectCommitCreateResponse.mlModelId + passingGoalCount = projectCommitCreateResponse.passingGoalCount + projectId = projectCommitCreateResponse.projectId + status = projectCommitCreateResponse.status + statusMessage = projectCommitCreateResponse.statusMessage + storageUri = projectCommitCreateResponse.storageUri + totalGoalCount = projectCommitCreateResponse.totalGoalCount + trainingDatasetId = projectCommitCreateResponse.trainingDatasetId + validationDatasetId = projectCommitCreateResponse.validationDatasetId + archived = projectCommitCreateResponse.archived + deploymentStatus = projectCommitCreateResponse.deploymentStatus + links = projectCommitCreateResponse.links + additionalProperties = projectCommitCreateResponse.additionalProperties.toMutableMap() } /** The project version (commit) id. */ fun id(id: String) = id(JsonField.of(id)) /** The project version (commit) id. */ - @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + fun id(id: JsonField) = apply { this.id = id } + + /** The details of a commit (project version). */ + fun commit(commit: Commit) = commit(JsonField.of(commit)) + + /** The details of a commit (project version). */ + fun commit(commit: JsonField) = apply { this.commit = commit } + + /** The commit archive date. */ + fun dateArchived(dateArchived: OffsetDateTime?) = + dateArchived(JsonField.ofNullable(dateArchived)) + + /** The commit archive date. */ + fun dateArchived(dateArchived: Optional) = + dateArchived(dateArchived.orElse(null)) + + /** The commit archive date. */ + fun dateArchived(dateArchived: JsonField) = apply { + this.dateArchived = dateArchived + } /** The project version (commit) creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) /** The project version (commit) creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } + /** The number of tests that are failing for the commit. */ + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) + + /** The number of tests that are failing for the commit. */ + fun failingGoalCount(failingGoalCount: JsonField) = apply { + this.failingGoalCount = failingGoalCount + } + + /** The model id. */ + fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) + + /** The model id. */ + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.orElse(null)) + + /** The model id. */ + fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } + + /** The number of tests that are passing for the commit. */ + fun passingGoalCount(passingGoalCount: Long) = + passingGoalCount(JsonField.of(passingGoalCount)) + + /** The number of tests that are passing for the commit. */ + fun passingGoalCount(passingGoalCount: JsonField) = apply { + this.passingGoalCount = passingGoalCount + } + + /** The project id. */ + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + + /** The project id. */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + /** * The commit status. Initially, the commit is `queued`, then, it switches to `running`. * Finally, it can be `paused`, `failed`, or `completed`. @@ -261,210 +360,178 @@ private constructor( * The commit status. Initially, the commit is `queued`, then, it switches to `running`. * Finally, it can be `paused`, `failed`, or `completed`. */ - @JsonProperty("status") - @ExcludeMissing fun status(status: JsonField) = apply { this.status = status } /** The commit status message. */ - fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** The commit status message. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.orElse(null)) /** The commit status message. */ - @JsonProperty("statusMessage") - @ExcludeMissing fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } - /** The project id. */ - fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - - /** The project id. */ - @JsonProperty("projectId") - @ExcludeMissing - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } - /** The storage URI where the commit bundle is stored. */ fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") - @ExcludeMissing fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } - /** The details of a commit (project version). */ - fun commit(commit: Commit) = commit(JsonField.of(commit)) + /** The total number of tests for the commit. */ + fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - /** The details of a commit (project version). */ - @JsonProperty("commit") - @ExcludeMissing - fun commit(commit: JsonField) = apply { this.commit = commit } + /** The total number of tests for the commit. */ + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount + } - /** The deployment status associated with the commit's model. */ - fun deploymentStatus(deploymentStatus: String) = - deploymentStatus(JsonField.of(deploymentStatus)) + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: String?) = + trainingDatasetId(JsonField.ofNullable(trainingDatasetId)) - /** The deployment status associated with the commit's model. */ - @JsonProperty("deploymentStatus") - @ExcludeMissing - fun deploymentStatus(deploymentStatus: JsonField) = apply { - this.deploymentStatus = deploymentStatus - } + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: Optional) = + trainingDatasetId(trainingDatasetId.orElse(null)) - /** The model id. */ - fun mlModelId(mlModelId: String) = mlModelId(JsonField.of(mlModelId)) + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: JsonField) = apply { + this.trainingDatasetId = trainingDatasetId + } - /** The model id. */ - @JsonProperty("mlModelId") - @ExcludeMissing - fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: String?) = + validationDatasetId(JsonField.ofNullable(validationDatasetId)) /** The validation dataset id. */ - fun validationDatasetId(validationDatasetId: String) = - validationDatasetId(JsonField.of(validationDatasetId)) + fun validationDatasetId(validationDatasetId: Optional) = + validationDatasetId(validationDatasetId.orElse(null)) /** The validation dataset id. */ - @JsonProperty("validationDatasetId") - @ExcludeMissing fun validationDatasetId(validationDatasetId: JsonField) = apply { this.validationDatasetId = validationDatasetId } - /** The training dataset id. */ - fun trainingDatasetId(trainingDatasetId: String) = - trainingDatasetId(JsonField.of(trainingDatasetId)) + /** Whether the commit is archived. */ + fun archived(archived: Boolean?) = archived(JsonField.ofNullable(archived)) - /** The training dataset id. */ - @JsonProperty("trainingDatasetId") - @ExcludeMissing - fun trainingDatasetId(trainingDatasetId: JsonField) = apply { - this.trainingDatasetId = trainingDatasetId - } + /** Whether the commit is archived. */ + fun archived(archived: Boolean) = archived(archived as Boolean?) /** Whether the commit is archived. */ - fun archived(archived: Boolean) = archived(JsonField.of(archived)) + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun archived(archived: Optional) = archived(archived.orElse(null) as Boolean?) /** Whether the commit is archived. */ - @JsonProperty("archived") - @ExcludeMissing fun archived(archived: JsonField) = apply { this.archived = archived } - /** The commit archive date. */ - fun dateArchived(dateArchived: OffsetDateTime) = dateArchived(JsonField.of(dateArchived)) - - /** The commit archive date. */ - @JsonProperty("dateArchived") - @ExcludeMissing - fun dateArchived(dateArchived: JsonField) = apply { - this.dateArchived = dateArchived - } - - /** The number of tests that are passing for the commit. */ - fun passingGoalCount(passingGoalCount: Long) = - passingGoalCount(JsonField.of(passingGoalCount)) - - /** The number of tests that are passing for the commit. */ - @JsonProperty("passingGoalCount") - @ExcludeMissing - fun passingGoalCount(passingGoalCount: JsonField) = apply { - this.passingGoalCount = passingGoalCount - } - - /** The number of tests that are failing for the commit. */ - fun failingGoalCount(failingGoalCount: Long) = - failingGoalCount(JsonField.of(failingGoalCount)) - - /** The number of tests that are failing for the commit. */ - @JsonProperty("failingGoalCount") - @ExcludeMissing - fun failingGoalCount(failingGoalCount: JsonField) = apply { - this.failingGoalCount = failingGoalCount - } - - /** The total number of tests for the commit. */ - fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) + /** The deployment status associated with the commit's model. */ + fun deploymentStatus(deploymentStatus: String) = + deploymentStatus(JsonField.of(deploymentStatus)) - /** The total number of tests for the commit. */ - @JsonProperty("totalGoalCount") - @ExcludeMissing - fun totalGoalCount(totalGoalCount: JsonField) = apply { - this.totalGoalCount = totalGoalCount + /** The deployment status associated with the commit's model. */ + fun deploymentStatus(deploymentStatus: JsonField) = apply { + this.deploymentStatus = deploymentStatus } fun links(links: Links) = links(JsonField.of(links)) - @JsonProperty("links") - @ExcludeMissing fun links(links: JsonField) = apply { this.links = links } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): ProjectCommitCreateResponse = ProjectCommitCreateResponse( - id, - dateCreated, - status, - statusMessage, - projectId, - storageUri, - commit, - deploymentStatus, - mlModelId, - validationDatasetId, - trainingDatasetId, + checkRequired("id", id), + checkRequired("commit", commit), + checkRequired("dateArchived", dateArchived), + checkRequired("dateCreated", dateCreated), + checkRequired("failingGoalCount", failingGoalCount), + checkRequired("mlModelId", mlModelId), + checkRequired("passingGoalCount", passingGoalCount), + checkRequired("projectId", projectId), + checkRequired("status", status), + checkRequired("statusMessage", statusMessage), + checkRequired("storageUri", storageUri), + checkRequired("totalGoalCount", totalGoalCount), + checkRequired("trainingDatasetId", trainingDatasetId), + checkRequired("validationDatasetId", validationDatasetId), archived, - dateArchived, - passingGoalCount, - failingGoalCount, - totalGoalCount, + deploymentStatus, links, additionalProperties.toImmutable(), ) } /** The details of a commit (project version). */ - @JsonDeserialize(builder = Commit.Builder::class) @NoAutoDetect class Commit + @JsonCreator private constructor( - private val id: JsonField, - private val authorId: JsonField, - private val dateCreated: JsonField, - private val fileSize: JsonField, - private val message: JsonField, - private val mlModelId: JsonField, - private val validationDatasetId: JsonField, - private val trainingDatasetId: JsonField, - private val storageUri: JsonField, - private val gitCommitSha: JsonField, - private val gitCommitRef: JsonField, - private val gitCommitUrl: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("authorId") + @ExcludeMissing + private val authorId: JsonField = JsonMissing.of(), + @JsonProperty("fileSize") + @ExcludeMissing + private val fileSize: JsonField = JsonMissing.of(), + @JsonProperty("message") + @ExcludeMissing + private val message: JsonField = JsonMissing.of(), + @JsonProperty("mlModelId") + @ExcludeMissing + private val mlModelId: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + private val storageUri: JsonField = JsonMissing.of(), + @JsonProperty("trainingDatasetId") + @ExcludeMissing + private val trainingDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("validationDatasetId") + @ExcludeMissing + private val validationDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitRef") + @ExcludeMissing + private val gitCommitRef: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitSha") + @ExcludeMissing + private val gitCommitSha: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitUrl") + @ExcludeMissing + private val gitCommitUrl: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The commit id. */ fun id(): String = id.getRequired("id") /** The author id of the commit. */ fun authorId(): String = authorId.getRequired("authorId") - /** The commit creation date. */ - fun dateCreated(): Optional = - Optional.ofNullable(dateCreated.getNullable("dateCreated")) - /** The size of the commit bundle in bytes. */ fun fileSize(): Optional = Optional.ofNullable(fileSize.getNullable("fileSize")) @@ -474,89 +541,107 @@ private constructor( /** The model id. */ fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) - /** The validation dataset id. */ - fun validationDatasetId(): Optional = - Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + /** The storage URI where the commit bundle is stored. */ + fun storageUri(): String = storageUri.getRequired("storageUri") /** The training dataset id. */ fun trainingDatasetId(): Optional = Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) - /** The storage URI where the commit bundle is stored. */ - fun storageUri(): String = storageUri.getRequired("storageUri") + /** The validation dataset id. */ + fun validationDatasetId(): Optional = + Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) - /** The SHA of the corresponding git commit. */ - fun gitCommitSha(): Optional = - Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) + /** The commit creation date. */ + fun dateCreated(): Optional = + Optional.ofNullable(dateCreated.getNullable("dateCreated")) /** The ref of the corresponding git commit. */ fun gitCommitRef(): Optional = Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) + /** The SHA of the corresponding git commit. */ + fun gitCommitSha(): Optional = + Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) + /** The URL of the corresponding git commit. */ fun gitCommitUrl(): Optional = Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) /** The commit id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The author id of the commit. */ - @JsonProperty("authorId") @ExcludeMissing fun _authorId() = authorId - - /** The commit creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("authorId") @ExcludeMissing fun _authorId(): JsonField = authorId /** The size of the commit bundle in bytes. */ - @JsonProperty("fileSize") @ExcludeMissing fun _fileSize() = fileSize + @JsonProperty("fileSize") @ExcludeMissing fun _fileSize(): JsonField = fileSize /** The commit message. */ - @JsonProperty("message") @ExcludeMissing fun _message() = message + @JsonProperty("message") @ExcludeMissing fun _message(): JsonField = message /** The model id. */ - @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId() = mlModelId + @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId(): JsonField = mlModelId - /** The validation dataset id. */ - @JsonProperty("validationDatasetId") + /** The storage URI where the commit bundle is stored. */ + @JsonProperty("storageUri") @ExcludeMissing - fun _validationDatasetId() = validationDatasetId + fun _storageUri(): JsonField = storageUri /** The training dataset id. */ @JsonProperty("trainingDatasetId") @ExcludeMissing - fun _trainingDatasetId() = trainingDatasetId + fun _trainingDatasetId(): JsonField = trainingDatasetId - /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") @ExcludeMissing fun _storageUri() = storageUri + /** The validation dataset id. */ + @JsonProperty("validationDatasetId") + @ExcludeMissing + fun _validationDatasetId(): JsonField = validationDatasetId - /** The SHA of the corresponding git commit. */ - @JsonProperty("gitCommitSha") @ExcludeMissing fun _gitCommitSha() = gitCommitSha + /** The commit creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated /** The ref of the corresponding git commit. */ - @JsonProperty("gitCommitRef") @ExcludeMissing fun _gitCommitRef() = gitCommitRef + @JsonProperty("gitCommitRef") + @ExcludeMissing + fun _gitCommitRef(): JsonField = gitCommitRef + + /** The SHA of the corresponding git commit. */ + @JsonProperty("gitCommitSha") + @ExcludeMissing + fun _gitCommitSha(): JsonField = gitCommitSha /** The URL of the corresponding git commit. */ - @JsonProperty("gitCommitUrl") @ExcludeMissing fun _gitCommitUrl() = gitCommitUrl + @JsonProperty("gitCommitUrl") + @ExcludeMissing + fun _gitCommitUrl(): JsonField = gitCommitUrl @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Commit = apply { - if (!validated) { - id() - authorId() - dateCreated() - fileSize() - message() - mlModelId() - validationDatasetId() - trainingDatasetId() - storageUri() - gitCommitSha() - gitCommitRef() - gitCommitUrl() - validated = true + if (validated) { + return@apply } + + id() + authorId() + fileSize() + message() + mlModelId() + storageUri() + trainingDatasetId() + validationDatasetId() + dateCreated() + gitCommitRef() + gitCommitSha() + gitCommitUrl() + validated = true } fun toBuilder() = Builder().from(this) @@ -568,174 +653,173 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var authorId: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var authorId: JsonField? = null + private var fileSize: JsonField? = null + private var message: JsonField? = null + private var mlModelId: JsonField? = null + private var storageUri: JsonField? = null + private var trainingDatasetId: JsonField? = null + private var validationDatasetId: JsonField? = null private var dateCreated: JsonField = JsonMissing.of() - private var fileSize: JsonField = JsonMissing.of() - private var message: JsonField = JsonMissing.of() - private var mlModelId: JsonField = JsonMissing.of() - private var validationDatasetId: JsonField = JsonMissing.of() - private var trainingDatasetId: JsonField = JsonMissing.of() - private var storageUri: JsonField = JsonMissing.of() - private var gitCommitSha: JsonField = JsonMissing.of() private var gitCommitRef: JsonField = JsonMissing.of() + private var gitCommitSha: JsonField = JsonMissing.of() private var gitCommitUrl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(commit: Commit) = apply { - this.id = commit.id - this.authorId = commit.authorId - this.dateCreated = commit.dateCreated - this.fileSize = commit.fileSize - this.message = commit.message - this.mlModelId = commit.mlModelId - this.validationDatasetId = commit.validationDatasetId - this.trainingDatasetId = commit.trainingDatasetId - this.storageUri = commit.storageUri - this.gitCommitSha = commit.gitCommitSha - this.gitCommitRef = commit.gitCommitRef - this.gitCommitUrl = commit.gitCommitUrl - additionalProperties(commit.additionalProperties) + id = commit.id + authorId = commit.authorId + fileSize = commit.fileSize + message = commit.message + mlModelId = commit.mlModelId + storageUri = commit.storageUri + trainingDatasetId = commit.trainingDatasetId + validationDatasetId = commit.validationDatasetId + dateCreated = commit.dateCreated + gitCommitRef = commit.gitCommitRef + gitCommitSha = commit.gitCommitSha + gitCommitUrl = commit.gitCommitUrl + additionalProperties = commit.additionalProperties.toMutableMap() } /** The commit id. */ fun id(id: String) = id(JsonField.of(id)) /** The commit id. */ - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } /** The author id of the commit. */ fun authorId(authorId: String) = authorId(JsonField.of(authorId)) /** The author id of the commit. */ - @JsonProperty("authorId") - @ExcludeMissing fun authorId(authorId: JsonField) = apply { this.authorId = authorId } - /** The commit creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + /** The size of the commit bundle in bytes. */ + fun fileSize(fileSize: Long?) = fileSize(JsonField.ofNullable(fileSize)) - /** The commit creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun dateCreated(dateCreated: JsonField) = apply { - this.dateCreated = dateCreated - } + /** The size of the commit bundle in bytes. */ + fun fileSize(fileSize: Long) = fileSize(fileSize as Long?) /** The size of the commit bundle in bytes. */ - fun fileSize(fileSize: Long) = fileSize(JsonField.of(fileSize)) + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fileSize(fileSize: Optional) = fileSize(fileSize.orElse(null) as Long?) /** The size of the commit bundle in bytes. */ - @JsonProperty("fileSize") - @ExcludeMissing fun fileSize(fileSize: JsonField) = apply { this.fileSize = fileSize } /** The commit message. */ fun message(message: String) = message(JsonField.of(message)) /** The commit message. */ - @JsonProperty("message") - @ExcludeMissing fun message(message: JsonField) = apply { this.message = message } /** The model id. */ - fun mlModelId(mlModelId: String) = mlModelId(JsonField.of(mlModelId)) + fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) + + /** The model id. */ + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.orElse(null)) /** The model id. */ - @JsonProperty("mlModelId") - @ExcludeMissing fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } - /** The validation dataset id. */ - fun validationDatasetId(validationDatasetId: String) = - validationDatasetId(JsonField.of(validationDatasetId)) + /** The storage URI where the commit bundle is stored. */ + fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) - /** The validation dataset id. */ - @JsonProperty("validationDatasetId") - @ExcludeMissing - fun validationDatasetId(validationDatasetId: JsonField) = apply { - this.validationDatasetId = validationDatasetId - } + /** The storage URI where the commit bundle is stored. */ + fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } + + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: String?) = + trainingDatasetId(JsonField.ofNullable(trainingDatasetId)) /** The training dataset id. */ - fun trainingDatasetId(trainingDatasetId: String) = - trainingDatasetId(JsonField.of(trainingDatasetId)) + fun trainingDatasetId(trainingDatasetId: Optional) = + trainingDatasetId(trainingDatasetId.orElse(null)) /** The training dataset id. */ - @JsonProperty("trainingDatasetId") - @ExcludeMissing fun trainingDatasetId(trainingDatasetId: JsonField) = apply { this.trainingDatasetId = trainingDatasetId } - /** The storage URI where the commit bundle is stored. */ - fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: String?) = + validationDatasetId(JsonField.ofNullable(validationDatasetId)) - /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") - @ExcludeMissing - fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: Optional) = + validationDatasetId(validationDatasetId.orElse(null)) - /** The SHA of the corresponding git commit. */ - fun gitCommitSha(gitCommitSha: Long) = gitCommitSha(JsonField.of(gitCommitSha)) + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: JsonField) = apply { + this.validationDatasetId = validationDatasetId + } - /** The SHA of the corresponding git commit. */ - @JsonProperty("gitCommitSha") - @ExcludeMissing - fun gitCommitSha(gitCommitSha: JsonField) = apply { - this.gitCommitSha = gitCommitSha + /** The commit creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** The commit creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated } /** The ref of the corresponding git commit. */ fun gitCommitRef(gitCommitRef: String) = gitCommitRef(JsonField.of(gitCommitRef)) /** The ref of the corresponding git commit. */ - @JsonProperty("gitCommitRef") - @ExcludeMissing fun gitCommitRef(gitCommitRef: JsonField) = apply { this.gitCommitRef = gitCommitRef } + /** The SHA of the corresponding git commit. */ + fun gitCommitSha(gitCommitSha: Long) = gitCommitSha(JsonField.of(gitCommitSha)) + + /** The SHA of the corresponding git commit. */ + fun gitCommitSha(gitCommitSha: JsonField) = apply { + this.gitCommitSha = gitCommitSha + } + /** The URL of the corresponding git commit. */ fun gitCommitUrl(gitCommitUrl: String) = gitCommitUrl(JsonField.of(gitCommitUrl)) /** The URL of the corresponding git commit. */ - @JsonProperty("gitCommitUrl") - @ExcludeMissing fun gitCommitUrl(gitCommitUrl: JsonField) = apply { this.gitCommitUrl = gitCommitUrl } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Commit = Commit( - id, - authorId, + checkRequired("id", id), + checkRequired("authorId", authorId), + checkRequired("fileSize", fileSize), + checkRequired("message", message), + checkRequired("mlModelId", mlModelId), + checkRequired("storageUri", storageUri), + checkRequired("trainingDatasetId", trainingDatasetId), + checkRequired("validationDatasetId", validationDatasetId), dateCreated, - fileSize, - message, - mlModelId, - validationDatasetId, - trainingDatasetId, - storageUri, - gitCommitSha, gitCommitRef, + gitCommitSha, gitCommitUrl, additionalProperties.toImmutable(), ) @@ -746,19 +830,23 @@ private constructor( return true } - return /* spotless:off */ other is Commit && id == other.id && authorId == other.authorId && dateCreated == other.dateCreated && fileSize == other.fileSize && message == other.message && mlModelId == other.mlModelId && validationDatasetId == other.validationDatasetId && trainingDatasetId == other.trainingDatasetId && storageUri == other.storageUri && gitCommitSha == other.gitCommitSha && gitCommitRef == other.gitCommitRef && gitCommitUrl == other.gitCommitUrl && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Commit && id == other.id && authorId == other.authorId && fileSize == other.fileSize && message == other.message && mlModelId == other.mlModelId && storageUri == other.storageUri && trainingDatasetId == other.trainingDatasetId && validationDatasetId == other.validationDatasetId && dateCreated == other.dateCreated && gitCommitRef == other.gitCommitRef && gitCommitSha == other.gitCommitSha && gitCommitUrl == other.gitCommitUrl && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, authorId, dateCreated, fileSize, message, mlModelId, validationDatasetId, trainingDatasetId, storageUri, gitCommitSha, gitCommitRef, gitCommitUrl, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, authorId, fileSize, message, mlModelId, storageUri, trainingDatasetId, validationDatasetId, dateCreated, gitCommitRef, gitCommitSha, gitCommitUrl, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Commit{id=$id, authorId=$authorId, dateCreated=$dateCreated, fileSize=$fileSize, message=$message, mlModelId=$mlModelId, validationDatasetId=$validationDatasetId, trainingDatasetId=$trainingDatasetId, storageUri=$storageUri, gitCommitSha=$gitCommitSha, gitCommitRef=$gitCommitRef, gitCommitUrl=$gitCommitUrl, additionalProperties=$additionalProperties}" + "Commit{id=$id, authorId=$authorId, fileSize=$fileSize, message=$message, mlModelId=$mlModelId, storageUri=$storageUri, trainingDatasetId=$trainingDatasetId, validationDatasetId=$validationDatasetId, dateCreated=$dateCreated, gitCommitRef=$gitCommitRef, gitCommitSha=$gitCommitSha, gitCommitUrl=$gitCommitUrl, additionalProperties=$additionalProperties}" } + /** + * The commit status. Initially, the commit is `queued`, then, it switches to `running`. + * Finally, it can be `paused`, `failed`, or `completed`. + */ class Status @JsonCreator private constructor( @@ -840,29 +928,32 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect class Links + @JsonCreator private constructor( - private val app: JsonField, - private val additionalProperties: Map, + @JsonProperty("app") @ExcludeMissing private val app: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun app(): String = app.getRequired("app") - @JsonProperty("app") @ExcludeMissing fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Links = apply { - if (!validated) { - app() - validated = true + if (validated) { + return@apply } + + app() + validated = true } fun toBuilder() = Builder().from(this) @@ -874,36 +965,40 @@ private constructor( class Builder { - private var app: JsonField = JsonMissing.of() + private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) + app = links.app + additionalProperties = links.additionalProperties.toMutableMap() } fun app(app: String) = app(JsonField.of(app)) - @JsonProperty("app") - @ExcludeMissing fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toImmutable()) + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Links = + Links(checkRequired("app", app), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -928,15 +1023,15 @@ private constructor( return true } - return /* spotless:off */ other is ProjectCommitCreateResponse && id == other.id && dateCreated == other.dateCreated && status == other.status && statusMessage == other.statusMessage && projectId == other.projectId && storageUri == other.storageUri && commit == other.commit && deploymentStatus == other.deploymentStatus && mlModelId == other.mlModelId && validationDatasetId == other.validationDatasetId && trainingDatasetId == other.trainingDatasetId && archived == other.archived && dateArchived == other.dateArchived && passingGoalCount == other.passingGoalCount && failingGoalCount == other.failingGoalCount && totalGoalCount == other.totalGoalCount && links == other.links && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ProjectCommitCreateResponse && id == other.id && commit == other.commit && dateArchived == other.dateArchived && dateCreated == other.dateCreated && failingGoalCount == other.failingGoalCount && mlModelId == other.mlModelId && passingGoalCount == other.passingGoalCount && projectId == other.projectId && status == other.status && statusMessage == other.statusMessage && storageUri == other.storageUri && totalGoalCount == other.totalGoalCount && trainingDatasetId == other.trainingDatasetId && validationDatasetId == other.validationDatasetId && archived == other.archived && deploymentStatus == other.deploymentStatus && links == other.links && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, dateCreated, status, statusMessage, projectId, storageUri, commit, deploymentStatus, mlModelId, validationDatasetId, trainingDatasetId, archived, dateArchived, passingGoalCount, failingGoalCount, totalGoalCount, links, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, commit, dateArchived, dateCreated, failingGoalCount, mlModelId, passingGoalCount, projectId, status, statusMessage, storageUri, totalGoalCount, trainingDatasetId, validationDatasetId, archived, deploymentStatus, links, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ProjectCommitCreateResponse{id=$id, dateCreated=$dateCreated, status=$status, statusMessage=$statusMessage, projectId=$projectId, storageUri=$storageUri, commit=$commit, deploymentStatus=$deploymentStatus, mlModelId=$mlModelId, validationDatasetId=$validationDatasetId, trainingDatasetId=$trainingDatasetId, archived=$archived, dateArchived=$dateArchived, passingGoalCount=$passingGoalCount, failingGoalCount=$failingGoalCount, totalGoalCount=$totalGoalCount, links=$links, additionalProperties=$additionalProperties}" + "ProjectCommitCreateResponse{id=$id, commit=$commit, dateArchived=$dateArchived, dateCreated=$dateCreated, failingGoalCount=$failingGoalCount, mlModelId=$mlModelId, passingGoalCount=$passingGoalCount, projectId=$projectId, status=$status, statusMessage=$statusMessage, storageUri=$storageUri, totalGoalCount=$totalGoalCount, trainingDatasetId=$trainingDatasetId, validationDatasetId=$validationDatasetId, archived=$archived, deploymentStatus=$deploymentStatus, links=$links, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt index ac2859d3..f2bdc7f2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt @@ -3,11 +3,13 @@ package com.openlayer.api.models import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams import java.util.Objects import java.util.Optional +/** List the commits (project versions) in a project. */ class ProjectCommitListParams constructor( private val projectId: String, @@ -19,8 +21,10 @@ constructor( fun projectId(): String = projectId + /** The page to return in a paginated query. */ fun page(): Optional = Optional.ofNullable(page) + /** Maximum number of items to return per page. */ fun perPage(): Optional = Optional.ofNullable(perPage) fun _additionalHeaders(): Headers = additionalHeaders @@ -73,10 +77,24 @@ constructor( fun projectId(projectId: String) = apply { this.projectId = projectId } /** The page to return in a paginated query. */ - fun page(page: Long) = apply { this.page = page } + fun page(page: Long?) = apply { this.page = page } + + /** The page to return in a paginated query. */ + fun page(page: Long) = page(page as Long?) + + /** The page to return in a paginated query. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun page(page: Optional) = page(page.orElse(null) as Long?) + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long?) = apply { this.perPage = perPage } + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long) = perPage(perPage as Long?) /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { this.perPage = perPage } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun perPage(perPage: Optional) = perPage(perPage.orElse(null) as Long?) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -178,7 +196,7 @@ constructor( fun build(): ProjectCommitListParams = ProjectCommitListParams( - checkNotNull(projectId) { "`projectId` is required but was not set" }, + checkRequired("projectId", projectId), page, perPage, additionalHeaders.build(), diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt index 757b7f13..fe718fa4 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt @@ -6,42 +6,47 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.Enum import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = ProjectCommitListResponse.Builder::class) @NoAutoDetect class ProjectCommitListResponse +@JsonCreator private constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") + @ExcludeMissing + private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun items(): List = items.getRequired("items") - @JsonProperty("items") @ExcludeMissing fun _items() = items + @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): ProjectCommitListResponse = apply { - if (!validated) { - items().forEach { it.validate() } - validated = true + if (validated) { + return@apply } + + items().forEach { it.validate() } + validated = true } fun toBuilder() = Builder().from(this) @@ -53,74 +58,142 @@ private constructor( class Builder { - private var items: JsonField> = JsonMissing.of() + private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(projectCommitListResponse: ProjectCommitListResponse) = apply { - this.items = projectCommitListResponse.items - additionalProperties(projectCommitListResponse.additionalProperties) + items = projectCommitListResponse.items.map { it.toMutableList() } + additionalProperties = projectCommitListResponse.additionalProperties.toMutableMap() } fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") - @ExcludeMissing - fun items(items: JsonField>) = apply { this.items = items } + fun items(items: JsonField>) = apply { + this.items = items.map { it.toMutableList() } + } + + fun addItem(item: Item) = apply { + items = + (items ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(item) + } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): ProjectCommitListResponse = ProjectCommitListResponse( - items.map { it.toImmutable() }, + checkRequired("items", items).map { it.toImmutable() }, additionalProperties.toImmutable() ) } - @JsonDeserialize(builder = Item.Builder::class) @NoAutoDetect class Item + @JsonCreator private constructor( - private val id: JsonField, - private val dateCreated: JsonField, - private val status: JsonField, - private val statusMessage: JsonField, - private val projectId: JsonField, - private val storageUri: JsonField, - private val commit: JsonField, - private val deploymentStatus: JsonField, - private val mlModelId: JsonField, - private val validationDatasetId: JsonField, - private val trainingDatasetId: JsonField, - private val archived: JsonField, - private val dateArchived: JsonField, - private val passingGoalCount: JsonField, - private val failingGoalCount: JsonField, - private val totalGoalCount: JsonField, - private val links: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("commit") + @ExcludeMissing + private val commit: JsonField = JsonMissing.of(), + @JsonProperty("dateArchived") + @ExcludeMissing + private val dateArchived: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("failingGoalCount") + @ExcludeMissing + private val failingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("mlModelId") + @ExcludeMissing + private val mlModelId: JsonField = JsonMissing.of(), + @JsonProperty("passingGoalCount") + @ExcludeMissing + private val passingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + private val projectId: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + private val statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + private val storageUri: JsonField = JsonMissing.of(), + @JsonProperty("totalGoalCount") + @ExcludeMissing + private val totalGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("trainingDatasetId") + @ExcludeMissing + private val trainingDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("validationDatasetId") + @ExcludeMissing + private val validationDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("archived") + @ExcludeMissing + private val archived: JsonField = JsonMissing.of(), + @JsonProperty("deploymentStatus") + @ExcludeMissing + private val deploymentStatus: JsonField = JsonMissing.of(), + @JsonProperty("links") + @ExcludeMissing + private val links: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The project version (commit) id. */ fun id(): String = id.getRequired("id") + /** The details of a commit (project version). */ + fun commit(): Commit = commit.getRequired("commit") + + /** The commit archive date. */ + fun dateArchived(): Optional = + Optional.ofNullable(dateArchived.getNullable("dateArchived")) + /** The project version (commit) creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + /** The number of tests that are failing for the commit. */ + fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") + + /** The model id. */ + fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + + /** The number of tests that are passing for the commit. */ + fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") + + /** The project id. */ + fun projectId(): String = projectId.getRequired("projectId") + /** * The commit status. Initially, the commit is `queued`, then, it switches to `running`. * Finally, it can be `paused`, `failed`, or `completed`. @@ -131,130 +204,131 @@ private constructor( fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) - /** The project id. */ - fun projectId(): String = projectId.getRequired("projectId") - /** The storage URI where the commit bundle is stored. */ fun storageUri(): String = storageUri.getRequired("storageUri") - /** The details of a commit (project version). */ - fun commit(): Commit = commit.getRequired("commit") - - /** The deployment status associated with the commit's model. */ - fun deploymentStatus(): Optional = - Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + /** The total number of tests for the commit. */ + fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") - /** The model id. */ - fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + /** The training dataset id. */ + fun trainingDatasetId(): Optional = + Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) /** The validation dataset id. */ fun validationDatasetId(): Optional = Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) - /** The training dataset id. */ - fun trainingDatasetId(): Optional = - Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) - /** Whether the commit is archived. */ fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) + /** The deployment status associated with the commit's model. */ + fun deploymentStatus(): Optional = + Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + + fun links(): Optional = Optional.ofNullable(links.getNullable("links")) + + /** The project version (commit) id. */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** The details of a commit (project version). */ + @JsonProperty("commit") @ExcludeMissing fun _commit(): JsonField = commit + /** The commit archive date. */ - fun dateArchived(): Optional = - Optional.ofNullable(dateArchived.getNullable("dateArchived")) + @JsonProperty("dateArchived") + @ExcludeMissing + fun _dateArchived(): JsonField = dateArchived - /** The number of tests that are passing for the commit. */ - fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") + /** The project version (commit) creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated /** The number of tests that are failing for the commit. */ - fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") - - /** The total number of tests for the commit. */ - fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") + @JsonProperty("failingGoalCount") + @ExcludeMissing + fun _failingGoalCount(): JsonField = failingGoalCount - fun links(): Optional = Optional.ofNullable(links.getNullable("links")) + /** The model id. */ + @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId(): JsonField = mlModelId - /** The project version (commit) id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The number of tests that are passing for the commit. */ + @JsonProperty("passingGoalCount") + @ExcludeMissing + fun _passingGoalCount(): JsonField = passingGoalCount - /** The project version (commit) creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + /** The project id. */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId /** * The commit status. Initially, the commit is `queued`, then, it switches to `running`. * Finally, it can be `paused`, `failed`, or `completed`. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status /** The commit status message. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage - - /** The project id. */ - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") @ExcludeMissing fun _storageUri() = storageUri - - /** The details of a commit (project version). */ - @JsonProperty("commit") @ExcludeMissing fun _commit() = commit - - /** The deployment status associated with the commit's model. */ - @JsonProperty("deploymentStatus") @ExcludeMissing fun _deploymentStatus() = deploymentStatus - - /** The model id. */ - @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId() = mlModelId + @JsonProperty("storageUri") + @ExcludeMissing + fun _storageUri(): JsonField = storageUri - /** The validation dataset id. */ - @JsonProperty("validationDatasetId") + /** The total number of tests for the commit. */ + @JsonProperty("totalGoalCount") @ExcludeMissing - fun _validationDatasetId() = validationDatasetId + fun _totalGoalCount(): JsonField = totalGoalCount /** The training dataset id. */ @JsonProperty("trainingDatasetId") @ExcludeMissing - fun _trainingDatasetId() = trainingDatasetId - - /** Whether the commit is archived. */ - @JsonProperty("archived") @ExcludeMissing fun _archived() = archived + fun _trainingDatasetId(): JsonField = trainingDatasetId - /** The commit archive date. */ - @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived() = dateArchived - - /** The number of tests that are passing for the commit. */ - @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount + /** The validation dataset id. */ + @JsonProperty("validationDatasetId") + @ExcludeMissing + fun _validationDatasetId(): JsonField = validationDatasetId - /** The number of tests that are failing for the commit. */ - @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount + /** Whether the commit is archived. */ + @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived - /** The total number of tests for the commit. */ - @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount + /** The deployment status associated with the commit's model. */ + @JsonProperty("deploymentStatus") + @ExcludeMissing + fun _deploymentStatus(): JsonField = deploymentStatus - @JsonProperty("links") @ExcludeMissing fun _links() = links + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Item = apply { - if (!validated) { - id() - dateCreated() - status() - statusMessage() - projectId() - storageUri() - commit().validate() - deploymentStatus() - mlModelId() - validationDatasetId() - trainingDatasetId() - archived() - dateArchived() - passingGoalCount() - failingGoalCount() - totalGoalCount() - links().map { it.validate() } - validated = true + if (validated) { + return@apply } + + id() + commit().validate() + dateArchived() + dateCreated() + failingGoalCount() + mlModelId() + passingGoalCount() + projectId() + status() + statusMessage() + storageUri() + totalGoalCount() + trainingDatasetId() + validationDatasetId() + archived() + deploymentStatus() + links().ifPresent { it.validate() } + validated = true } fun toBuilder() = Builder().from(this) @@ -266,65 +340,113 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var statusMessage: JsonField = JsonMissing.of() - private var projectId: JsonField = JsonMissing.of() - private var storageUri: JsonField = JsonMissing.of() - private var commit: JsonField = JsonMissing.of() - private var deploymentStatus: JsonField = JsonMissing.of() - private var mlModelId: JsonField = JsonMissing.of() - private var validationDatasetId: JsonField = JsonMissing.of() - private var trainingDatasetId: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var commit: JsonField? = null + private var dateArchived: JsonField? = null + private var dateCreated: JsonField? = null + private var failingGoalCount: JsonField? = null + private var mlModelId: JsonField? = null + private var passingGoalCount: JsonField? = null + private var projectId: JsonField? = null + private var status: JsonField? = null + private var statusMessage: JsonField? = null + private var storageUri: JsonField? = null + private var totalGoalCount: JsonField? = null + private var trainingDatasetId: JsonField? = null + private var validationDatasetId: JsonField? = null private var archived: JsonField = JsonMissing.of() - private var dateArchived: JsonField = JsonMissing.of() - private var passingGoalCount: JsonField = JsonMissing.of() - private var failingGoalCount: JsonField = JsonMissing.of() - private var totalGoalCount: JsonField = JsonMissing.of() + private var deploymentStatus: JsonField = JsonMissing.of() private var links: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(item: Item) = apply { - this.id = item.id - this.dateCreated = item.dateCreated - this.status = item.status - this.statusMessage = item.statusMessage - this.projectId = item.projectId - this.storageUri = item.storageUri - this.commit = item.commit - this.deploymentStatus = item.deploymentStatus - this.mlModelId = item.mlModelId - this.validationDatasetId = item.validationDatasetId - this.trainingDatasetId = item.trainingDatasetId - this.archived = item.archived - this.dateArchived = item.dateArchived - this.passingGoalCount = item.passingGoalCount - this.failingGoalCount = item.failingGoalCount - this.totalGoalCount = item.totalGoalCount - this.links = item.links - additionalProperties(item.additionalProperties) + id = item.id + commit = item.commit + dateArchived = item.dateArchived + dateCreated = item.dateCreated + failingGoalCount = item.failingGoalCount + mlModelId = item.mlModelId + passingGoalCount = item.passingGoalCount + projectId = item.projectId + status = item.status + statusMessage = item.statusMessage + storageUri = item.storageUri + totalGoalCount = item.totalGoalCount + trainingDatasetId = item.trainingDatasetId + validationDatasetId = item.validationDatasetId + archived = item.archived + deploymentStatus = item.deploymentStatus + links = item.links + additionalProperties = item.additionalProperties.toMutableMap() } /** The project version (commit) id. */ fun id(id: String) = id(JsonField.of(id)) /** The project version (commit) id. */ - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + /** The details of a commit (project version). */ + fun commit(commit: Commit) = commit(JsonField.of(commit)) + + /** The details of a commit (project version). */ + fun commit(commit: JsonField) = apply { this.commit = commit } + + /** The commit archive date. */ + fun dateArchived(dateArchived: OffsetDateTime?) = + dateArchived(JsonField.ofNullable(dateArchived)) + + /** The commit archive date. */ + fun dateArchived(dateArchived: Optional) = + dateArchived(dateArchived.orElse(null)) + + /** The commit archive date. */ + fun dateArchived(dateArchived: JsonField) = apply { + this.dateArchived = dateArchived + } + /** The project version (commit) creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) /** The project version (commit) creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } + /** The number of tests that are failing for the commit. */ + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) + + /** The number of tests that are failing for the commit. */ + fun failingGoalCount(failingGoalCount: JsonField) = apply { + this.failingGoalCount = failingGoalCount + } + + /** The model id. */ + fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) + + /** The model id. */ + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.orElse(null)) + + /** The model id. */ + fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } + + /** The number of tests that are passing for the commit. */ + fun passingGoalCount(passingGoalCount: Long) = + passingGoalCount(JsonField.of(passingGoalCount)) + + /** The number of tests that are passing for the commit. */ + fun passingGoalCount(passingGoalCount: JsonField) = apply { + this.passingGoalCount = passingGoalCount + } + + /** The project id. */ + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + + /** The project id. */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + /** * The commit status. Initially, the commit is `queued`, then, it switches to `running`. * Finally, it can be `paused`, `failed`, or `completed`. @@ -335,211 +457,180 @@ private constructor( * The commit status. Initially, the commit is `queued`, then, it switches to `running`. * Finally, it can be `paused`, `failed`, or `completed`. */ - @JsonProperty("status") - @ExcludeMissing fun status(status: JsonField) = apply { this.status = status } /** The commit status message. */ - fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** The commit status message. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.orElse(null)) /** The commit status message. */ - @JsonProperty("statusMessage") - @ExcludeMissing fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } - /** The project id. */ - fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - - /** The project id. */ - @JsonProperty("projectId") - @ExcludeMissing - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } - /** The storage URI where the commit bundle is stored. */ fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") - @ExcludeMissing fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } - /** The details of a commit (project version). */ - fun commit(commit: Commit) = commit(JsonField.of(commit)) + /** The total number of tests for the commit. */ + fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - /** The details of a commit (project version). */ - @JsonProperty("commit") - @ExcludeMissing - fun commit(commit: JsonField) = apply { this.commit = commit } + /** The total number of tests for the commit. */ + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount + } - /** The deployment status associated with the commit's model. */ - fun deploymentStatus(deploymentStatus: String) = - deploymentStatus(JsonField.of(deploymentStatus)) + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: String?) = + trainingDatasetId(JsonField.ofNullable(trainingDatasetId)) - /** The deployment status associated with the commit's model. */ - @JsonProperty("deploymentStatus") - @ExcludeMissing - fun deploymentStatus(deploymentStatus: JsonField) = apply { - this.deploymentStatus = deploymentStatus - } + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: Optional) = + trainingDatasetId(trainingDatasetId.orElse(null)) - /** The model id. */ - fun mlModelId(mlModelId: String) = mlModelId(JsonField.of(mlModelId)) + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: JsonField) = apply { + this.trainingDatasetId = trainingDatasetId + } - /** The model id. */ - @JsonProperty("mlModelId") - @ExcludeMissing - fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: String?) = + validationDatasetId(JsonField.ofNullable(validationDatasetId)) /** The validation dataset id. */ - fun validationDatasetId(validationDatasetId: String) = - validationDatasetId(JsonField.of(validationDatasetId)) + fun validationDatasetId(validationDatasetId: Optional) = + validationDatasetId(validationDatasetId.orElse(null)) /** The validation dataset id. */ - @JsonProperty("validationDatasetId") - @ExcludeMissing fun validationDatasetId(validationDatasetId: JsonField) = apply { this.validationDatasetId = validationDatasetId } - /** The training dataset id. */ - fun trainingDatasetId(trainingDatasetId: String) = - trainingDatasetId(JsonField.of(trainingDatasetId)) + /** Whether the commit is archived. */ + fun archived(archived: Boolean?) = archived(JsonField.ofNullable(archived)) - /** The training dataset id. */ - @JsonProperty("trainingDatasetId") - @ExcludeMissing - fun trainingDatasetId(trainingDatasetId: JsonField) = apply { - this.trainingDatasetId = trainingDatasetId - } + /** Whether the commit is archived. */ + fun archived(archived: Boolean) = archived(archived as Boolean?) /** Whether the commit is archived. */ - fun archived(archived: Boolean) = archived(JsonField.of(archived)) + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun archived(archived: Optional) = archived(archived.orElse(null) as Boolean?) /** Whether the commit is archived. */ - @JsonProperty("archived") - @ExcludeMissing fun archived(archived: JsonField) = apply { this.archived = archived } - /** The commit archive date. */ - fun dateArchived(dateArchived: OffsetDateTime) = - dateArchived(JsonField.of(dateArchived)) - - /** The commit archive date. */ - @JsonProperty("dateArchived") - @ExcludeMissing - fun dateArchived(dateArchived: JsonField) = apply { - this.dateArchived = dateArchived - } - - /** The number of tests that are passing for the commit. */ - fun passingGoalCount(passingGoalCount: Long) = - passingGoalCount(JsonField.of(passingGoalCount)) - - /** The number of tests that are passing for the commit. */ - @JsonProperty("passingGoalCount") - @ExcludeMissing - fun passingGoalCount(passingGoalCount: JsonField) = apply { - this.passingGoalCount = passingGoalCount - } - - /** The number of tests that are failing for the commit. */ - fun failingGoalCount(failingGoalCount: Long) = - failingGoalCount(JsonField.of(failingGoalCount)) - - /** The number of tests that are failing for the commit. */ - @JsonProperty("failingGoalCount") - @ExcludeMissing - fun failingGoalCount(failingGoalCount: JsonField) = apply { - this.failingGoalCount = failingGoalCount - } - - /** The total number of tests for the commit. */ - fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) + /** The deployment status associated with the commit's model. */ + fun deploymentStatus(deploymentStatus: String) = + deploymentStatus(JsonField.of(deploymentStatus)) - /** The total number of tests for the commit. */ - @JsonProperty("totalGoalCount") - @ExcludeMissing - fun totalGoalCount(totalGoalCount: JsonField) = apply { - this.totalGoalCount = totalGoalCount + /** The deployment status associated with the commit's model. */ + fun deploymentStatus(deploymentStatus: JsonField) = apply { + this.deploymentStatus = deploymentStatus } fun links(links: Links) = links(JsonField.of(links)) - @JsonProperty("links") - @ExcludeMissing fun links(links: JsonField) = apply { this.links = links } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Item = Item( - id, - dateCreated, - status, - statusMessage, - projectId, - storageUri, - commit, - deploymentStatus, - mlModelId, - validationDatasetId, - trainingDatasetId, + checkRequired("id", id), + checkRequired("commit", commit), + checkRequired("dateArchived", dateArchived), + checkRequired("dateCreated", dateCreated), + checkRequired("failingGoalCount", failingGoalCount), + checkRequired("mlModelId", mlModelId), + checkRequired("passingGoalCount", passingGoalCount), + checkRequired("projectId", projectId), + checkRequired("status", status), + checkRequired("statusMessage", statusMessage), + checkRequired("storageUri", storageUri), + checkRequired("totalGoalCount", totalGoalCount), + checkRequired("trainingDatasetId", trainingDatasetId), + checkRequired("validationDatasetId", validationDatasetId), archived, - dateArchived, - passingGoalCount, - failingGoalCount, - totalGoalCount, + deploymentStatus, links, additionalProperties.toImmutable(), ) } /** The details of a commit (project version). */ - @JsonDeserialize(builder = Commit.Builder::class) @NoAutoDetect class Commit + @JsonCreator private constructor( - private val id: JsonField, - private val authorId: JsonField, - private val dateCreated: JsonField, - private val fileSize: JsonField, - private val message: JsonField, - private val mlModelId: JsonField, - private val validationDatasetId: JsonField, - private val trainingDatasetId: JsonField, - private val storageUri: JsonField, - private val gitCommitSha: JsonField, - private val gitCommitRef: JsonField, - private val gitCommitUrl: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("authorId") + @ExcludeMissing + private val authorId: JsonField = JsonMissing.of(), + @JsonProperty("fileSize") + @ExcludeMissing + private val fileSize: JsonField = JsonMissing.of(), + @JsonProperty("message") + @ExcludeMissing + private val message: JsonField = JsonMissing.of(), + @JsonProperty("mlModelId") + @ExcludeMissing + private val mlModelId: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + private val storageUri: JsonField = JsonMissing.of(), + @JsonProperty("trainingDatasetId") + @ExcludeMissing + private val trainingDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("validationDatasetId") + @ExcludeMissing + private val validationDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitRef") + @ExcludeMissing + private val gitCommitRef: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitSha") + @ExcludeMissing + private val gitCommitSha: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitUrl") + @ExcludeMissing + private val gitCommitUrl: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The commit id. */ fun id(): String = id.getRequired("id") /** The author id of the commit. */ fun authorId(): String = authorId.getRequired("authorId") - /** The commit creation date. */ - fun dateCreated(): Optional = - Optional.ofNullable(dateCreated.getNullable("dateCreated")) - /** The size of the commit bundle in bytes. */ fun fileSize(): Optional = Optional.ofNullable(fileSize.getNullable("fileSize")) @@ -550,89 +641,109 @@ private constructor( fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) - /** The validation dataset id. */ - fun validationDatasetId(): Optional = - Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + /** The storage URI where the commit bundle is stored. */ + fun storageUri(): String = storageUri.getRequired("storageUri") /** The training dataset id. */ fun trainingDatasetId(): Optional = Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) - /** The storage URI where the commit bundle is stored. */ - fun storageUri(): String = storageUri.getRequired("storageUri") + /** The validation dataset id. */ + fun validationDatasetId(): Optional = + Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) - /** The SHA of the corresponding git commit. */ - fun gitCommitSha(): Optional = - Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) + /** The commit creation date. */ + fun dateCreated(): Optional = + Optional.ofNullable(dateCreated.getNullable("dateCreated")) /** The ref of the corresponding git commit. */ fun gitCommitRef(): Optional = Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) + /** The SHA of the corresponding git commit. */ + fun gitCommitSha(): Optional = + Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) + /** The URL of the corresponding git commit. */ fun gitCommitUrl(): Optional = Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) /** The commit id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The author id of the commit. */ - @JsonProperty("authorId") @ExcludeMissing fun _authorId() = authorId - - /** The commit creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("authorId") @ExcludeMissing fun _authorId(): JsonField = authorId /** The size of the commit bundle in bytes. */ - @JsonProperty("fileSize") @ExcludeMissing fun _fileSize() = fileSize + @JsonProperty("fileSize") @ExcludeMissing fun _fileSize(): JsonField = fileSize /** The commit message. */ - @JsonProperty("message") @ExcludeMissing fun _message() = message + @JsonProperty("message") @ExcludeMissing fun _message(): JsonField = message /** The model id. */ - @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId() = mlModelId + @JsonProperty("mlModelId") + @ExcludeMissing + fun _mlModelId(): JsonField = mlModelId - /** The validation dataset id. */ - @JsonProperty("validationDatasetId") + /** The storage URI where the commit bundle is stored. */ + @JsonProperty("storageUri") @ExcludeMissing - fun _validationDatasetId() = validationDatasetId + fun _storageUri(): JsonField = storageUri /** The training dataset id. */ @JsonProperty("trainingDatasetId") @ExcludeMissing - fun _trainingDatasetId() = trainingDatasetId + fun _trainingDatasetId(): JsonField = trainingDatasetId - /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") @ExcludeMissing fun _storageUri() = storageUri + /** The validation dataset id. */ + @JsonProperty("validationDatasetId") + @ExcludeMissing + fun _validationDatasetId(): JsonField = validationDatasetId - /** The SHA of the corresponding git commit. */ - @JsonProperty("gitCommitSha") @ExcludeMissing fun _gitCommitSha() = gitCommitSha + /** The commit creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated /** The ref of the corresponding git commit. */ - @JsonProperty("gitCommitRef") @ExcludeMissing fun _gitCommitRef() = gitCommitRef + @JsonProperty("gitCommitRef") + @ExcludeMissing + fun _gitCommitRef(): JsonField = gitCommitRef + + /** The SHA of the corresponding git commit. */ + @JsonProperty("gitCommitSha") + @ExcludeMissing + fun _gitCommitSha(): JsonField = gitCommitSha /** The URL of the corresponding git commit. */ - @JsonProperty("gitCommitUrl") @ExcludeMissing fun _gitCommitUrl() = gitCommitUrl + @JsonProperty("gitCommitUrl") + @ExcludeMissing + fun _gitCommitUrl(): JsonField = gitCommitUrl @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Commit = apply { - if (!validated) { - id() - authorId() - dateCreated() - fileSize() - message() - mlModelId() - validationDatasetId() - trainingDatasetId() - storageUri() - gitCommitSha() - gitCommitRef() - gitCommitUrl() - validated = true + if (validated) { + return@apply } + + id() + authorId() + fileSize() + message() + mlModelId() + storageUri() + trainingDatasetId() + validationDatasetId() + dateCreated() + gitCommitRef() + gitCommitSha() + gitCommitUrl() + validated = true } fun toBuilder() = Builder().from(this) @@ -644,158 +755,151 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var authorId: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var authorId: JsonField? = null + private var fileSize: JsonField? = null + private var message: JsonField? = null + private var mlModelId: JsonField? = null + private var storageUri: JsonField? = null + private var trainingDatasetId: JsonField? = null + private var validationDatasetId: JsonField? = null private var dateCreated: JsonField = JsonMissing.of() - private var fileSize: JsonField = JsonMissing.of() - private var message: JsonField = JsonMissing.of() - private var mlModelId: JsonField = JsonMissing.of() - private var validationDatasetId: JsonField = JsonMissing.of() - private var trainingDatasetId: JsonField = JsonMissing.of() - private var storageUri: JsonField = JsonMissing.of() - private var gitCommitSha: JsonField = JsonMissing.of() private var gitCommitRef: JsonField = JsonMissing.of() + private var gitCommitSha: JsonField = JsonMissing.of() private var gitCommitUrl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(commit: Commit) = apply { - this.id = commit.id - this.authorId = commit.authorId - this.dateCreated = commit.dateCreated - this.fileSize = commit.fileSize - this.message = commit.message - this.mlModelId = commit.mlModelId - this.validationDatasetId = commit.validationDatasetId - this.trainingDatasetId = commit.trainingDatasetId - this.storageUri = commit.storageUri - this.gitCommitSha = commit.gitCommitSha - this.gitCommitRef = commit.gitCommitRef - this.gitCommitUrl = commit.gitCommitUrl - additionalProperties(commit.additionalProperties) + id = commit.id + authorId = commit.authorId + fileSize = commit.fileSize + message = commit.message + mlModelId = commit.mlModelId + storageUri = commit.storageUri + trainingDatasetId = commit.trainingDatasetId + validationDatasetId = commit.validationDatasetId + dateCreated = commit.dateCreated + gitCommitRef = commit.gitCommitRef + gitCommitSha = commit.gitCommitSha + gitCommitUrl = commit.gitCommitUrl + additionalProperties = commit.additionalProperties.toMutableMap() } /** The commit id. */ fun id(id: String) = id(JsonField.of(id)) /** The commit id. */ - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } /** The author id of the commit. */ fun authorId(authorId: String) = authorId(JsonField.of(authorId)) /** The author id of the commit. */ - @JsonProperty("authorId") - @ExcludeMissing fun authorId(authorId: JsonField) = apply { this.authorId = authorId } - /** The commit creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = - dateCreated(JsonField.of(dateCreated)) + /** The size of the commit bundle in bytes. */ + fun fileSize(fileSize: Long?) = fileSize(JsonField.ofNullable(fileSize)) - /** The commit creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun dateCreated(dateCreated: JsonField) = apply { - this.dateCreated = dateCreated - } + /** The size of the commit bundle in bytes. */ + fun fileSize(fileSize: Long) = fileSize(fileSize as Long?) /** The size of the commit bundle in bytes. */ - fun fileSize(fileSize: Long) = fileSize(JsonField.of(fileSize)) + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fileSize(fileSize: Optional) = fileSize(fileSize.orElse(null) as Long?) /** The size of the commit bundle in bytes. */ - @JsonProperty("fileSize") - @ExcludeMissing fun fileSize(fileSize: JsonField) = apply { this.fileSize = fileSize } /** The commit message. */ fun message(message: String) = message(JsonField.of(message)) /** The commit message. */ - @JsonProperty("message") - @ExcludeMissing fun message(message: JsonField) = apply { this.message = message } /** The model id. */ - fun mlModelId(mlModelId: String) = mlModelId(JsonField.of(mlModelId)) + fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) + + /** The model id. */ + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.orElse(null)) /** The model id. */ - @JsonProperty("mlModelId") - @ExcludeMissing fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } - /** The validation dataset id. */ - fun validationDatasetId(validationDatasetId: String) = - validationDatasetId(JsonField.of(validationDatasetId)) + /** The storage URI where the commit bundle is stored. */ + fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) - /** The validation dataset id. */ - @JsonProperty("validationDatasetId") - @ExcludeMissing - fun validationDatasetId(validationDatasetId: JsonField) = apply { - this.validationDatasetId = validationDatasetId + /** The storage URI where the commit bundle is stored. */ + fun storageUri(storageUri: JsonField) = apply { + this.storageUri = storageUri } /** The training dataset id. */ - fun trainingDatasetId(trainingDatasetId: String) = - trainingDatasetId(JsonField.of(trainingDatasetId)) + fun trainingDatasetId(trainingDatasetId: String?) = + trainingDatasetId(JsonField.ofNullable(trainingDatasetId)) + + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: Optional) = + trainingDatasetId(trainingDatasetId.orElse(null)) /** The training dataset id. */ - @JsonProperty("trainingDatasetId") - @ExcludeMissing fun trainingDatasetId(trainingDatasetId: JsonField) = apply { this.trainingDatasetId = trainingDatasetId } - /** The storage URI where the commit bundle is stored. */ - fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: String?) = + validationDatasetId(JsonField.ofNullable(validationDatasetId)) - /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") - @ExcludeMissing - fun storageUri(storageUri: JsonField) = apply { - this.storageUri = storageUri + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: Optional) = + validationDatasetId(validationDatasetId.orElse(null)) + + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: JsonField) = apply { + this.validationDatasetId = validationDatasetId } - /** The SHA of the corresponding git commit. */ - fun gitCommitSha(gitCommitSha: Long) = gitCommitSha(JsonField.of(gitCommitSha)) + /** The commit creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) - /** The SHA of the corresponding git commit. */ - @JsonProperty("gitCommitSha") - @ExcludeMissing - fun gitCommitSha(gitCommitSha: JsonField) = apply { - this.gitCommitSha = gitCommitSha + /** The commit creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated } /** The ref of the corresponding git commit. */ fun gitCommitRef(gitCommitRef: String) = gitCommitRef(JsonField.of(gitCommitRef)) /** The ref of the corresponding git commit. */ - @JsonProperty("gitCommitRef") - @ExcludeMissing fun gitCommitRef(gitCommitRef: JsonField) = apply { this.gitCommitRef = gitCommitRef } + /** The SHA of the corresponding git commit. */ + fun gitCommitSha(gitCommitSha: Long) = gitCommitSha(JsonField.of(gitCommitSha)) + + /** The SHA of the corresponding git commit. */ + fun gitCommitSha(gitCommitSha: JsonField) = apply { + this.gitCommitSha = gitCommitSha + } + /** The URL of the corresponding git commit. */ fun gitCommitUrl(gitCommitUrl: String) = gitCommitUrl(JsonField.of(gitCommitUrl)) /** The URL of the corresponding git commit. */ - @JsonProperty("gitCommitUrl") - @ExcludeMissing fun gitCommitUrl(gitCommitUrl: JsonField) = apply { this.gitCommitUrl = gitCommitUrl } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -803,19 +907,27 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Commit = Commit( - id, - authorId, + checkRequired("id", id), + checkRequired("authorId", authorId), + checkRequired("fileSize", fileSize), + checkRequired("message", message), + checkRequired("mlModelId", mlModelId), + checkRequired("storageUri", storageUri), + checkRequired("trainingDatasetId", trainingDatasetId), + checkRequired("validationDatasetId", validationDatasetId), dateCreated, - fileSize, - message, - mlModelId, - validationDatasetId, - trainingDatasetId, - storageUri, - gitCommitSha, gitCommitRef, + gitCommitSha, gitCommitUrl, additionalProperties.toImmutable(), ) @@ -826,19 +938,23 @@ private constructor( return true } - return /* spotless:off */ other is Commit && id == other.id && authorId == other.authorId && dateCreated == other.dateCreated && fileSize == other.fileSize && message == other.message && mlModelId == other.mlModelId && validationDatasetId == other.validationDatasetId && trainingDatasetId == other.trainingDatasetId && storageUri == other.storageUri && gitCommitSha == other.gitCommitSha && gitCommitRef == other.gitCommitRef && gitCommitUrl == other.gitCommitUrl && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Commit && id == other.id && authorId == other.authorId && fileSize == other.fileSize && message == other.message && mlModelId == other.mlModelId && storageUri == other.storageUri && trainingDatasetId == other.trainingDatasetId && validationDatasetId == other.validationDatasetId && dateCreated == other.dateCreated && gitCommitRef == other.gitCommitRef && gitCommitSha == other.gitCommitSha && gitCommitUrl == other.gitCommitUrl && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, authorId, dateCreated, fileSize, message, mlModelId, validationDatasetId, trainingDatasetId, storageUri, gitCommitSha, gitCommitRef, gitCommitUrl, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, authorId, fileSize, message, mlModelId, storageUri, trainingDatasetId, validationDatasetId, dateCreated, gitCommitRef, gitCommitSha, gitCommitUrl, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Commit{id=$id, authorId=$authorId, dateCreated=$dateCreated, fileSize=$fileSize, message=$message, mlModelId=$mlModelId, validationDatasetId=$validationDatasetId, trainingDatasetId=$trainingDatasetId, storageUri=$storageUri, gitCommitSha=$gitCommitSha, gitCommitRef=$gitCommitRef, gitCommitUrl=$gitCommitUrl, additionalProperties=$additionalProperties}" + "Commit{id=$id, authorId=$authorId, fileSize=$fileSize, message=$message, mlModelId=$mlModelId, storageUri=$storageUri, trainingDatasetId=$trainingDatasetId, validationDatasetId=$validationDatasetId, dateCreated=$dateCreated, gitCommitRef=$gitCommitRef, gitCommitSha=$gitCommitSha, gitCommitUrl=$gitCommitUrl, additionalProperties=$additionalProperties}" } + /** + * The commit status. Initially, the commit is `queued`, then, it switches to `running`. + * Finally, it can be `paused`, `failed`, or `completed`. + */ class Status @JsonCreator private constructor( @@ -920,29 +1036,34 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect class Links + @JsonCreator private constructor( - private val app: JsonField, - private val additionalProperties: Map, + @JsonProperty("app") + @ExcludeMissing + private val app: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun app(): String = app.getRequired("app") - @JsonProperty("app") @ExcludeMissing fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Links = apply { - if (!validated) { - app() - validated = true + if (validated) { + return@apply } + + app() + validated = true } fun toBuilder() = Builder().from(this) @@ -954,29 +1075,26 @@ private constructor( class Builder { - private var app: JsonField = JsonMissing.of() + private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) + app = links.app + additionalProperties = links.additionalProperties.toMutableMap() } fun app(app: String) = app(JsonField.of(app)) - @JsonProperty("app") - @ExcludeMissing fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -984,7 +1102,16 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toImmutable()) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Links = + Links(checkRequired("app", app), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -1009,17 +1136,17 @@ private constructor( return true } - return /* spotless:off */ other is Item && id == other.id && dateCreated == other.dateCreated && status == other.status && statusMessage == other.statusMessage && projectId == other.projectId && storageUri == other.storageUri && commit == other.commit && deploymentStatus == other.deploymentStatus && mlModelId == other.mlModelId && validationDatasetId == other.validationDatasetId && trainingDatasetId == other.trainingDatasetId && archived == other.archived && dateArchived == other.dateArchived && passingGoalCount == other.passingGoalCount && failingGoalCount == other.failingGoalCount && totalGoalCount == other.totalGoalCount && links == other.links && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Item && id == other.id && commit == other.commit && dateArchived == other.dateArchived && dateCreated == other.dateCreated && failingGoalCount == other.failingGoalCount && mlModelId == other.mlModelId && passingGoalCount == other.passingGoalCount && projectId == other.projectId && status == other.status && statusMessage == other.statusMessage && storageUri == other.storageUri && totalGoalCount == other.totalGoalCount && trainingDatasetId == other.trainingDatasetId && validationDatasetId == other.validationDatasetId && archived == other.archived && deploymentStatus == other.deploymentStatus && links == other.links && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, dateCreated, status, statusMessage, projectId, storageUri, commit, deploymentStatus, mlModelId, validationDatasetId, trainingDatasetId, archived, dateArchived, passingGoalCount, failingGoalCount, totalGoalCount, links, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, commit, dateArchived, dateCreated, failingGoalCount, mlModelId, passingGoalCount, projectId, status, statusMessage, storageUri, totalGoalCount, trainingDatasetId, validationDatasetId, archived, deploymentStatus, links, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Item{id=$id, dateCreated=$dateCreated, status=$status, statusMessage=$statusMessage, projectId=$projectId, storageUri=$storageUri, commit=$commit, deploymentStatus=$deploymentStatus, mlModelId=$mlModelId, validationDatasetId=$validationDatasetId, trainingDatasetId=$trainingDatasetId, archived=$archived, dateArchived=$dateArchived, passingGoalCount=$passingGoalCount, failingGoalCount=$failingGoalCount, totalGoalCount=$totalGoalCount, links=$links, additionalProperties=$additionalProperties}" + "Item{id=$id, commit=$commit, dateArchived=$dateArchived, dateCreated=$dateCreated, failingGoalCount=$failingGoalCount, mlModelId=$mlModelId, passingGoalCount=$passingGoalCount, projectId=$projectId, status=$status, statusMessage=$statusMessage, storageUri=$storageUri, totalGoalCount=$totalGoalCount, trainingDatasetId=$trainingDatasetId, validationDatasetId=$validationDatasetId, archived=$archived, deploymentStatus=$deploymentStatus, links=$links, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt index d4130bdd..aeacc396 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt @@ -6,79 +6,115 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.Enum import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional +/** Create a project in your workspace. */ class ProjectCreateParams constructor( - private val name: String, - private val taskType: TaskType, - private val description: String?, + private val body: ProjectCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun name(): String = name + /** The project name. */ + fun name(): String = body.name() - fun taskType(): TaskType = taskType + /** The task type of the project. */ + fun taskType(): TaskType = body.taskType() - fun description(): Optional = Optional.ofNullable(description) + /** The project description. */ + fun description(): Optional = body.description() + + /** The project name. */ + fun _name(): JsonField = body._name() + + /** The task type of the project. */ + fun _taskType(): JsonField = body._taskType() + + /** The project description. */ + fun _description(): JsonField = body._description() + + fun _additionalBodyProperties(): Map = body._additionalProperties() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): ProjectCreateBody { - return ProjectCreateBody( - name, - taskType, - description, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): ProjectCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams - @JsonDeserialize(builder = ProjectCreateBody.Builder::class) @NoAutoDetect class ProjectCreateBody + @JsonCreator internal constructor( - private val name: String?, - private val taskType: TaskType?, - private val description: String?, - private val additionalProperties: Map, + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("taskType") + @ExcludeMissing + private val taskType: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** The project name. */ - @JsonProperty("name") fun name(): String? = name + fun name(): String = name.getRequired("name") /** The task type of the project. */ - @JsonProperty("taskType") fun taskType(): TaskType? = taskType + fun taskType(): TaskType = taskType.getRequired("taskType") /** The project description. */ - @JsonProperty("description") fun description(): String? = description + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) + + /** The project name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** The task type of the project. */ + @JsonProperty("taskType") @ExcludeMissing fun _taskType(): JsonField = taskType + + /** The project description. */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + + fun validate(): ProjectCreateBody = apply { + if (validated) { + return@apply + } + + name() + taskType() + description() + validated = true + } + fun toBuilder() = Builder().from(this) companion object { @@ -88,48 +124,65 @@ constructor( class Builder { - private var name: String? = null - private var taskType: TaskType? = null - private var description: String? = null + private var name: JsonField? = null + private var taskType: JsonField? = null + private var description: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(projectCreateBody: ProjectCreateBody) = apply { - this.name = projectCreateBody.name - this.taskType = projectCreateBody.taskType - this.description = projectCreateBody.description - additionalProperties(projectCreateBody.additionalProperties) + name = projectCreateBody.name + taskType = projectCreateBody.taskType + description = projectCreateBody.description + additionalProperties = projectCreateBody.additionalProperties.toMutableMap() } /** The project name. */ - @JsonProperty("name") fun name(name: String) = apply { this.name = name } + fun name(name: String) = name(JsonField.of(name)) + + /** The project name. */ + fun name(name: JsonField) = apply { this.name = name } + + /** The task type of the project. */ + fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) /** The task type of the project. */ - @JsonProperty("taskType") - fun taskType(taskType: TaskType) = apply { this.taskType = taskType } + fun taskType(taskType: JsonField) = apply { this.taskType = taskType } /** The project description. */ - @JsonProperty("description") - fun description(description: String) = apply { this.description = description } + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** The project description. */ + fun description(description: Optional) = description(description.orElse(null)) + + /** The project description. */ + fun description(description: JsonField) = apply { + this.description = description + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): ProjectCreateBody = ProjectCreateBody( - checkNotNull(name) { "`name` is required but was not set" }, - checkNotNull(taskType) { "`taskType` is required but was not set" }, + checkRequired("name", name), + checkRequired("taskType", taskType), description, additionalProperties.toImmutable(), ) @@ -163,31 +216,56 @@ constructor( @NoAutoDetect class Builder { - private var name: String? = null - private var taskType: TaskType? = null - private var description: String? = null + private var body: ProjectCreateBody.Builder = ProjectCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(projectCreateParams: ProjectCreateParams) = apply { - name = projectCreateParams.name - taskType = projectCreateParams.taskType - description = projectCreateParams.description + body = projectCreateParams.body.toBuilder() additionalHeaders = projectCreateParams.additionalHeaders.toBuilder() additionalQueryParams = projectCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = projectCreateParams.additionalBodyProperties.toMutableMap() } /** The project name. */ - fun name(name: String) = apply { this.name = name } + fun name(name: String) = apply { body.name(name) } + + /** The project name. */ + fun name(name: JsonField) = apply { body.name(name) } /** The task type of the project. */ - fun taskType(taskType: TaskType) = apply { this.taskType = taskType } + fun taskType(taskType: TaskType) = apply { body.taskType(taskType) } + + /** The task type of the project. */ + fun taskType(taskType: JsonField) = apply { body.taskType(taskType) } /** The project description. */ - fun description(description: String) = apply { this.description = description } + fun description(description: String?) = apply { body.description(description) } + + /** The project description. */ + fun description(description: Optional) = description(description.orElse(null)) + + /** The project description. */ + fun description(description: JsonField) = apply { body.description(description) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -287,54 +365,43 @@ constructor( additionalQueryParams.removeAll(keys) } - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) - } - fun build(): ProjectCreateParams = ProjectCreateParams( - checkNotNull(name) { "`name` is required but was not set" }, - checkNotNull(taskType) { "`taskType` is required but was not set" }, - description, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } /** Links to the project. */ - @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect class Links + @JsonCreator private constructor( - private val app: String?, - private val additionalProperties: Map, + @JsonProperty("app") @ExcludeMissing private val app: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("app") fun app(): String? = app + fun app(): String = app.getRequired("app") + + @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true + } + fun toBuilder() = Builder().from(this) companion object { @@ -344,36 +411,40 @@ constructor( class Builder { - private var app: String? = null + private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) + app = links.app + additionalProperties = links.additionalProperties.toMutableMap() } - @JsonProperty("app") fun app(app: String) = apply { this.app = app } + fun app(app: String) = app(JsonField.of(app)) + + fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Links = - Links( - checkNotNull(app) { "`app` is required but was not set" }, - additionalProperties.toImmutable() - ) + Links(checkRequired("app", app), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -393,6 +464,7 @@ constructor( override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } + /** The source of the project. */ class Source @JsonCreator private constructor( @@ -456,6 +528,7 @@ constructor( override fun toString() = value.toString() } + /** The task type of the project. */ class TaskType @JsonCreator private constructor( @@ -525,53 +598,126 @@ constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = GitRepo.Builder::class) @NoAutoDetect class GitRepo + @JsonCreator private constructor( - private val id: String?, - private val gitId: Long?, - private val dateConnected: OffsetDateTime?, - private val dateUpdated: OffsetDateTime?, - private val branch: String?, - private val name: String?, - private val private_: Boolean?, - private val slug: String?, - private val url: String?, - private val rootDir: String?, - private val projectId: String?, - private val gitAccountId: String?, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("dateConnected") + @ExcludeMissing + private val dateConnected: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("gitAccountId") + @ExcludeMissing + private val gitAccountId: JsonField = JsonMissing.of(), + @JsonProperty("gitId") + @ExcludeMissing + private val gitId: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("private") + @ExcludeMissing + private val private_: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + private val projectId: JsonField = JsonMissing.of(), + @JsonProperty("slug") + @ExcludeMissing + private val slug: JsonField = JsonMissing.of(), + @JsonProperty("url") @ExcludeMissing private val url: JsonField = JsonMissing.of(), + @JsonProperty("branch") + @ExcludeMissing + private val branch: JsonField = JsonMissing.of(), + @JsonProperty("rootDir") + @ExcludeMissing + private val rootDir: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("id") fun id(): String? = id + fun id(): String = id.getRequired("id") - @JsonProperty("gitId") fun gitId(): Long? = gitId + fun dateConnected(): OffsetDateTime = dateConnected.getRequired("dateConnected") - @JsonProperty("dateConnected") fun dateConnected(): OffsetDateTime? = dateConnected + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - @JsonProperty("dateUpdated") fun dateUpdated(): OffsetDateTime? = dateUpdated + fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") - @JsonProperty("branch") fun branch(): String? = branch + fun gitId(): Long = gitId.getRequired("gitId") - @JsonProperty("name") fun name(): String? = name + fun name(): String = name.getRequired("name") - @JsonProperty("private") fun private_(): Boolean? = private_ + fun private_(): Boolean = private_.getRequired("private") - @JsonProperty("slug") fun slug(): String? = slug + fun projectId(): String = projectId.getRequired("projectId") - @JsonProperty("url") fun url(): String? = url + fun slug(): String = slug.getRequired("slug") - @JsonProperty("rootDir") fun rootDir(): String? = rootDir + fun url(): String = url.getRequired("url") - @JsonProperty("projectId") fun projectId(): String? = projectId + fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + + fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) + + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + @JsonProperty("dateConnected") + @ExcludeMissing + fun _dateConnected(): JsonField = dateConnected + + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + @JsonProperty("gitAccountId") + @ExcludeMissing + fun _gitAccountId(): JsonField = gitAccountId - @JsonProperty("gitAccountId") fun gitAccountId(): String? = gitAccountId + @JsonProperty("gitId") @ExcludeMissing fun _gitId(): JsonField = gitId + + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonProperty("private") @ExcludeMissing fun _private_(): JsonField = private_ + + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url + + @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch + + @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + + fun validate(): GitRepo = apply { + if (validated) { + return@apply + } + + id() + dateConnected() + dateUpdated() + gitAccountId() + gitId() + name() + private_() + projectId() + slug() + url() + branch() + rootDir() + validated = true + } + fun toBuilder() = Builder().from(this) companion object { @@ -581,96 +727,125 @@ constructor( class Builder { - private var id: String? = null - private var gitId: Long? = null - private var dateConnected: OffsetDateTime? = null - private var dateUpdated: OffsetDateTime? = null - private var branch: String? = null - private var name: String? = null - private var private_: Boolean? = null - private var slug: String? = null - private var url: String? = null - private var rootDir: String? = null - private var projectId: String? = null - private var gitAccountId: String? = null + private var id: JsonField? = null + private var dateConnected: JsonField? = null + private var dateUpdated: JsonField? = null + private var gitAccountId: JsonField? = null + private var gitId: JsonField? = null + private var name: JsonField? = null + private var private_: JsonField? = null + private var projectId: JsonField? = null + private var slug: JsonField? = null + private var url: JsonField? = null + private var branch: JsonField = JsonMissing.of() + private var rootDir: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(gitRepo: GitRepo) = apply { - this.id = gitRepo.id - this.gitId = gitRepo.gitId - this.dateConnected = gitRepo.dateConnected - this.dateUpdated = gitRepo.dateUpdated - this.branch = gitRepo.branch - this.name = gitRepo.name - this.private_ = gitRepo.private_ - this.slug = gitRepo.slug - this.url = gitRepo.url - this.rootDir = gitRepo.rootDir - this.projectId = gitRepo.projectId - this.gitAccountId = gitRepo.gitAccountId - additionalProperties(gitRepo.additionalProperties) - } - - @JsonProperty("id") fun id(id: String) = apply { this.id = id } - - @JsonProperty("gitId") fun gitId(gitId: Long) = apply { this.gitId = gitId } - - @JsonProperty("dateConnected") - fun dateConnected(dateConnected: OffsetDateTime) = apply { + id = gitRepo.id + dateConnected = gitRepo.dateConnected + dateUpdated = gitRepo.dateUpdated + gitAccountId = gitRepo.gitAccountId + gitId = gitRepo.gitId + name = gitRepo.name + private_ = gitRepo.private_ + projectId = gitRepo.projectId + slug = gitRepo.slug + url = gitRepo.url + branch = gitRepo.branch + rootDir = gitRepo.rootDir + additionalProperties = gitRepo.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + + fun dateConnected(dateConnected: OffsetDateTime) = + dateConnected(JsonField.of(dateConnected)) + + fun dateConnected(dateConnected: JsonField) = apply { this.dateConnected = dateConnected } - @JsonProperty("dateUpdated") - fun dateUpdated(dateUpdated: OffsetDateTime) = apply { this.dateUpdated = dateUpdated } + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - @JsonProperty("branch") fun branch(branch: String) = apply { this.branch = branch } + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) + + fun gitAccountId(gitAccountId: JsonField) = apply { + this.gitAccountId = gitAccountId + } + + fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) + + fun gitId(gitId: JsonField) = apply { this.gitId = gitId } + + fun name(name: String) = name(JsonField.of(name)) + + fun name(name: JsonField) = apply { this.name = name } + + fun private_(private_: Boolean) = private_(JsonField.of(private_)) - @JsonProperty("name") fun name(name: String) = apply { this.name = name } + fun private_(private_: JsonField) = apply { this.private_ = private_ } - @JsonProperty("private") - fun private_(private_: Boolean) = apply { this.private_ = private_ } + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - @JsonProperty("slug") fun slug(slug: String) = apply { this.slug = slug } + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } - @JsonProperty("url") fun url(url: String) = apply { this.url = url } + fun slug(slug: String) = slug(JsonField.of(slug)) - @JsonProperty("rootDir") fun rootDir(rootDir: String) = apply { this.rootDir = rootDir } + fun slug(slug: JsonField) = apply { this.slug = slug } - @JsonProperty("projectId") - fun projectId(projectId: String) = apply { this.projectId = projectId } + fun url(url: String) = url(JsonField.of(url)) - @JsonProperty("gitAccountId") - fun gitAccountId(gitAccountId: String) = apply { this.gitAccountId = gitAccountId } + fun url(url: JsonField) = apply { this.url = url } + + fun branch(branch: String) = branch(JsonField.of(branch)) + + fun branch(branch: JsonField) = apply { this.branch = branch } + + fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) + + fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): GitRepo = GitRepo( - checkNotNull(id) { "`id` is required but was not set" }, - checkNotNull(gitId) { "`gitId` is required but was not set" }, - checkNotNull(dateConnected) { "`dateConnected` is required but was not set" }, - checkNotNull(dateUpdated) { "`dateUpdated` is required but was not set" }, + checkRequired("id", id), + checkRequired("dateConnected", dateConnected), + checkRequired("dateUpdated", dateUpdated), + checkRequired("gitAccountId", gitAccountId), + checkRequired("gitId", gitId), + checkRequired("name", name), + checkRequired("private_", private_), + checkRequired("projectId", projectId), + checkRequired("slug", slug), + checkRequired("url", url), branch, - checkNotNull(name) { "`name` is required but was not set" }, - checkNotNull(private_) { "`private_` is required but was not set" }, - checkNotNull(slug) { "`slug` is required but was not set" }, - checkNotNull(url) { "`url` is required but was not set" }, rootDir, - checkNotNull(projectId) { "`projectId` is required but was not set" }, - checkNotNull(gitAccountId) { "`gitAccountId` is required but was not set" }, additionalProperties.toImmutable(), ) } @@ -680,17 +855,17 @@ constructor( return true } - return /* spotless:off */ other is GitRepo && id == other.id && gitId == other.gitId && dateConnected == other.dateConnected && dateUpdated == other.dateUpdated && branch == other.branch && name == other.name && private_ == other.private_ && slug == other.slug && url == other.url && rootDir == other.rootDir && projectId == other.projectId && gitAccountId == other.gitAccountId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GitRepo && id == other.id && dateConnected == other.dateConnected && dateUpdated == other.dateUpdated && gitAccountId == other.gitAccountId && gitId == other.gitId && name == other.name && private_ == other.private_ && projectId == other.projectId && slug == other.slug && url == other.url && branch == other.branch && rootDir == other.rootDir && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, gitId, dateConnected, dateUpdated, branch, name, private_, slug, url, rootDir, projectId, gitAccountId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dateConnected, dateUpdated, gitAccountId, gitId, name, private_, projectId, slug, url, branch, rootDir, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GitRepo{id=$id, gitId=$gitId, dateConnected=$dateConnected, dateUpdated=$dateUpdated, branch=$branch, name=$name, private_=$private_, slug=$slug, url=$url, rootDir=$rootDir, projectId=$projectId, gitAccountId=$gitAccountId, additionalProperties=$additionalProperties}" + "GitRepo{id=$id, dateConnected=$dateConnected, dateUpdated=$dateUpdated, gitAccountId=$gitAccountId, gitId=$gitId, name=$name, private_=$private_, projectId=$projectId, slug=$slug, url=$url, branch=$branch, rootDir=$rootDir, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -698,11 +873,11 @@ constructor( return true } - return /* spotless:off */ other is ProjectCreateParams && name == other.name && taskType == other.taskType && description == other.description && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is ProjectCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(name, taskType, description, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "ProjectCreateParams{name=$name, taskType=$taskType, description=$description, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "ProjectCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt index 284779d0..42d2d38e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt @@ -6,66 +6,99 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.Enum import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = ProjectCreateResponse.Builder::class) @NoAutoDetect class ProjectCreateResponse +@JsonCreator private constructor( - private val id: JsonField, - private val workspaceId: JsonField, - private val creatorId: JsonField, - private val name: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val description: JsonField, - private val source: JsonField, - private val taskType: JsonField, - private val versionCount: JsonField, - private val inferencePipelineCount: JsonField, - private val goalCount: JsonField, - private val developmentGoalCount: JsonField, - private val monitoringGoalCount: JsonField, - private val links: JsonField, - private val gitRepo: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + private val creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("developmentGoalCount") + @ExcludeMissing + private val developmentGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("goalCount") + @ExcludeMissing + private val goalCount: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + private val inferencePipelineCount: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing private val links: JsonField = JsonMissing.of(), + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + private val monitoringGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), + @JsonProperty("source") + @ExcludeMissing + private val source: JsonField = JsonMissing.of(), + @JsonProperty("taskType") + @ExcludeMissing + private val taskType: JsonField = JsonMissing.of(), + @JsonProperty("versionCount") + @ExcludeMissing + private val versionCount: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + private val workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("gitRepo") + @ExcludeMissing + private val gitRepo: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The project id. */ fun id(): String = id.getRequired("id") - /** The workspace id. */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The project creator id. */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The project name. */ - fun name(): String = name.getRequired("name") - /** The project creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") /** The project last updated date. */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The project description. */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") + + /** The total number of tests in the project. */ + fun goalCount(): Long = goalCount.getRequired("goalCount") + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(): Long = + inferencePipelineCount.getRequired("inferencePipelineCount") + + /** Links to the project. */ + fun links(): Links = links.getRequired("links") + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") + + /** The project name. */ + fun name(): String = name.getRequired("name") /** The source of the project. */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) @@ -76,101 +109,103 @@ private constructor( /** The number of versions (commits) in the project. */ fun versionCount(): Long = versionCount.getRequired("versionCount") - /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(): Long = - inferencePipelineCount.getRequired("inferencePipelineCount") - - /** The total number of tests in the project. */ - fun goalCount(): Long = goalCount.getRequired("goalCount") - - /** The number of tests in the development mode of the project. */ - fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") - - /** The number of tests in the monitoring mode of the project. */ - fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") + /** The workspace id. */ + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** Links to the project. */ - fun links(): Links = links.getRequired("links") + /** The project description. */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) /** The project id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id - - /** The workspace id. */ - @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId() = workspaceId + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The project creator id. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId - - /** The project name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId /** The project creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated /** The project last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated - - /** The project description. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description - - /** The source of the project. */ - @JsonProperty("source") @ExcludeMissing fun _source() = source + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - /** The task type of the project. */ - @JsonProperty("taskType") @ExcludeMissing fun _taskType() = taskType + /** The number of tests in the development mode of the project. */ + @JsonProperty("developmentGoalCount") + @ExcludeMissing + fun _developmentGoalCount(): JsonField = developmentGoalCount - /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") @ExcludeMissing fun _versionCount() = versionCount + /** The total number of tests in the project. */ + @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount /** The number of inference pipelines in the project. */ @JsonProperty("inferencePipelineCount") @ExcludeMissing - fun _inferencePipelineCount() = inferencePipelineCount + fun _inferencePipelineCount(): JsonField = inferencePipelineCount - /** The total number of tests in the project. */ - @JsonProperty("goalCount") @ExcludeMissing fun _goalCount() = goalCount - - /** The number of tests in the development mode of the project. */ - @JsonProperty("developmentGoalCount") - @ExcludeMissing - fun _developmentGoalCount() = developmentGoalCount + /** Links to the project. */ + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links /** The number of tests in the monitoring mode of the project. */ @JsonProperty("monitoringGoalCount") @ExcludeMissing - fun _monitoringGoalCount() = monitoringGoalCount + fun _monitoringGoalCount(): JsonField = monitoringGoalCount - /** Links to the project. */ - @JsonProperty("links") @ExcludeMissing fun _links() = links + /** The project name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** The source of the project. */ + @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source + + /** The task type of the project. */ + @JsonProperty("taskType") @ExcludeMissing fun _taskType(): JsonField = taskType + + /** The number of versions (commits) in the project. */ + @JsonProperty("versionCount") + @ExcludeMissing + fun _versionCount(): JsonField = versionCount + + /** The workspace id. */ + @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId + + /** The project description. */ + @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo() = gitRepo + @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): ProjectCreateResponse = apply { - if (!validated) { - id() - workspaceId() - creatorId() - name() - dateCreated() - dateUpdated() - description() - source() - taskType() - versionCount() - inferencePipelineCount() - goalCount() - developmentGoalCount() - monitoringGoalCount() - links().validate() - gitRepo().map { it.validate() } - validated = true + if (validated) { + return@apply } + + id() + creatorId() + dateCreated() + dateUpdated() + developmentGoalCount() + goalCount() + inferencePipelineCount() + links().validate() + monitoringGoalCount() + name() + source() + taskType() + versionCount() + workspaceId() + description() + gitRepo().ifPresent { it.validate() } + validated = true } fun toBuilder() = Builder().from(this) @@ -182,81 +217,64 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var workspaceId: JsonField = JsonMissing.of() - private var creatorId: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var developmentGoalCount: JsonField? = null + private var goalCount: JsonField? = null + private var inferencePipelineCount: JsonField? = null + private var links: JsonField? = null + private var monitoringGoalCount: JsonField? = null + private var name: JsonField? = null + private var source: JsonField? = null + private var taskType: JsonField? = null + private var versionCount: JsonField? = null + private var workspaceId: JsonField? = null private var description: JsonField = JsonMissing.of() - private var source: JsonField = JsonMissing.of() - private var taskType: JsonField = JsonMissing.of() - private var versionCount: JsonField = JsonMissing.of() - private var inferencePipelineCount: JsonField = JsonMissing.of() - private var goalCount: JsonField = JsonMissing.of() - private var developmentGoalCount: JsonField = JsonMissing.of() - private var monitoringGoalCount: JsonField = JsonMissing.of() - private var links: JsonField = JsonMissing.of() private var gitRepo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(projectCreateResponse: ProjectCreateResponse) = apply { - this.id = projectCreateResponse.id - this.workspaceId = projectCreateResponse.workspaceId - this.creatorId = projectCreateResponse.creatorId - this.name = projectCreateResponse.name - this.dateCreated = projectCreateResponse.dateCreated - this.dateUpdated = projectCreateResponse.dateUpdated - this.description = projectCreateResponse.description - this.source = projectCreateResponse.source - this.taskType = projectCreateResponse.taskType - this.versionCount = projectCreateResponse.versionCount - this.inferencePipelineCount = projectCreateResponse.inferencePipelineCount - this.goalCount = projectCreateResponse.goalCount - this.developmentGoalCount = projectCreateResponse.developmentGoalCount - this.monitoringGoalCount = projectCreateResponse.monitoringGoalCount - this.links = projectCreateResponse.links - this.gitRepo = projectCreateResponse.gitRepo - additionalProperties(projectCreateResponse.additionalProperties) + id = projectCreateResponse.id + creatorId = projectCreateResponse.creatorId + dateCreated = projectCreateResponse.dateCreated + dateUpdated = projectCreateResponse.dateUpdated + developmentGoalCount = projectCreateResponse.developmentGoalCount + goalCount = projectCreateResponse.goalCount + inferencePipelineCount = projectCreateResponse.inferencePipelineCount + links = projectCreateResponse.links + monitoringGoalCount = projectCreateResponse.monitoringGoalCount + name = projectCreateResponse.name + source = projectCreateResponse.source + taskType = projectCreateResponse.taskType + versionCount = projectCreateResponse.versionCount + workspaceId = projectCreateResponse.workspaceId + description = projectCreateResponse.description + gitRepo = projectCreateResponse.gitRepo + additionalProperties = projectCreateResponse.additionalProperties.toMutableMap() } /** The project id. */ fun id(id: String) = id(JsonField.of(id)) /** The project id. */ - @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - - /** The workspace id. */ - fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + fun id(id: JsonField) = apply { this.id = id } - /** The workspace id. */ - @JsonProperty("workspaceId") - @ExcludeMissing - fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } + /** The project creator id. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The project creator id. */ - fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) /** The project creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } - /** The project name. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The project name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) /** The project creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -265,159 +283,168 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) /** The project last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - /** The project description. */ - fun description(description: String) = description(JsonField.of(description)) - - /** The project description. */ - @JsonProperty("description") - @ExcludeMissing - fun description(description: JsonField) = apply { this.description = description } - - /** The source of the project. */ - fun source(source: Source) = source(JsonField.of(source)) - - /** The source of the project. */ - @JsonProperty("source") - @ExcludeMissing - fun source(source: JsonField) = apply { this.source = source } - - /** The task type of the project. */ - fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: Long) = + developmentGoalCount(JsonField.of(developmentGoalCount)) - /** The task type of the project. */ - @JsonProperty("taskType") - @ExcludeMissing - fun taskType(taskType: JsonField) = apply { this.taskType = taskType } + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: JsonField) = apply { + this.developmentGoalCount = developmentGoalCount + } - /** The number of versions (commits) in the project. */ - fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) + /** The total number of tests in the project. */ + fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) - /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") - @ExcludeMissing - fun versionCount(versionCount: JsonField) = apply { this.versionCount = versionCount } + /** The total number of tests in the project. */ + fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } /** The number of inference pipelines in the project. */ fun inferencePipelineCount(inferencePipelineCount: Long) = inferencePipelineCount(JsonField.of(inferencePipelineCount)) /** The number of inference pipelines in the project. */ - @JsonProperty("inferencePipelineCount") - @ExcludeMissing fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { this.inferencePipelineCount = inferencePipelineCount } - /** The total number of tests in the project. */ - fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) - - /** The total number of tests in the project. */ - @JsonProperty("goalCount") - @ExcludeMissing - fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } - - /** The number of tests in the development mode of the project. */ - fun developmentGoalCount(developmentGoalCount: Long) = - developmentGoalCount(JsonField.of(developmentGoalCount)) + /** Links to the project. */ + fun links(links: Links) = links(JsonField.of(links)) - /** The number of tests in the development mode of the project. */ - @JsonProperty("developmentGoalCount") - @ExcludeMissing - fun developmentGoalCount(developmentGoalCount: JsonField) = apply { - this.developmentGoalCount = developmentGoalCount - } + /** Links to the project. */ + fun links(links: JsonField) = apply { this.links = links } /** The number of tests in the monitoring mode of the project. */ fun monitoringGoalCount(monitoringGoalCount: Long) = monitoringGoalCount(JsonField.of(monitoringGoalCount)) /** The number of tests in the monitoring mode of the project. */ - @JsonProperty("monitoringGoalCount") - @ExcludeMissing fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { this.monitoringGoalCount = monitoringGoalCount } - /** Links to the project. */ - fun links(links: Links) = links(JsonField.of(links)) + /** The project name. */ + fun name(name: String) = name(JsonField.of(name)) - /** Links to the project. */ - @JsonProperty("links") - @ExcludeMissing - fun links(links: JsonField) = apply { this.links = links } + /** The project name. */ + fun name(name: JsonField) = apply { this.name = name } + + /** The source of the project. */ + fun source(source: Source?) = source(JsonField.ofNullable(source)) - fun gitRepo(gitRepo: GitRepo) = gitRepo(JsonField.of(gitRepo)) + /** The source of the project. */ + fun source(source: Optional) = source(source.orElse(null)) + + /** The source of the project. */ + fun source(source: JsonField) = apply { this.source = source } + + /** The task type of the project. */ + fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) + + /** The task type of the project. */ + fun taskType(taskType: JsonField) = apply { this.taskType = taskType } + + /** The number of versions (commits) in the project. */ + fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) + + /** The number of versions (commits) in the project. */ + fun versionCount(versionCount: JsonField) = apply { this.versionCount = versionCount } + + /** The workspace id. */ + fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) + + /** The workspace id. */ + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.orElse(null)) + + /** The workspace id. */ + fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } + + /** The project description. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** The project description. */ + fun description(description: Optional) = description(description.orElse(null)) + + /** The project description. */ + fun description(description: JsonField) = apply { this.description = description } + + fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) + + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.orElse(null)) - @JsonProperty("gitRepo") - @ExcludeMissing fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): ProjectCreateResponse = ProjectCreateResponse( - id, - workspaceId, - creatorId, - name, - dateCreated, - dateUpdated, + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("developmentGoalCount", developmentGoalCount), + checkRequired("goalCount", goalCount), + checkRequired("inferencePipelineCount", inferencePipelineCount), + checkRequired("links", links), + checkRequired("monitoringGoalCount", monitoringGoalCount), + checkRequired("name", name), + checkRequired("source", source), + checkRequired("taskType", taskType), + checkRequired("versionCount", versionCount), + checkRequired("workspaceId", workspaceId), description, - source, - taskType, - versionCount, - inferencePipelineCount, - goalCount, - developmentGoalCount, - monitoringGoalCount, - links, gitRepo, additionalProperties.toImmutable(), ) } /** Links to the project. */ - @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect class Links + @JsonCreator private constructor( - private val app: JsonField, - private val additionalProperties: Map, + @JsonProperty("app") @ExcludeMissing private val app: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun app(): String = app.getRequired("app") - @JsonProperty("app") @ExcludeMissing fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Links = apply { - if (!validated) { - app() - validated = true + if (validated) { + return@apply } + + app() + validated = true } fun toBuilder() = Builder().from(this) @@ -429,36 +456,40 @@ private constructor( class Builder { - private var app: JsonField = JsonMissing.of() + private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) + app = links.app + additionalProperties = links.additionalProperties.toMutableMap() } fun app(app: String) = app(JsonField.of(app)) - @JsonProperty("app") - @ExcludeMissing fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toImmutable()) + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Links = + Links(checkRequired("app", app), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -478,6 +509,7 @@ private constructor( override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } + /** The source of the project. */ class Source @JsonCreator private constructor( @@ -541,6 +573,7 @@ private constructor( override fun toString() = value.toString() } + /** The task type of the project. */ class TaskType @JsonCreator private constructor( @@ -610,95 +643,124 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = GitRepo.Builder::class) @NoAutoDetect class GitRepo + @JsonCreator private constructor( - private val id: JsonField, - private val gitId: JsonField, - private val dateConnected: JsonField, - private val dateUpdated: JsonField, - private val branch: JsonField, - private val name: JsonField, - private val private_: JsonField, - private val slug: JsonField, - private val url: JsonField, - private val rootDir: JsonField, - private val projectId: JsonField, - private val gitAccountId: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("dateConnected") + @ExcludeMissing + private val dateConnected: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("gitAccountId") + @ExcludeMissing + private val gitAccountId: JsonField = JsonMissing.of(), + @JsonProperty("gitId") + @ExcludeMissing + private val gitId: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("private") + @ExcludeMissing + private val private_: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + private val projectId: JsonField = JsonMissing.of(), + @JsonProperty("slug") + @ExcludeMissing + private val slug: JsonField = JsonMissing.of(), + @JsonProperty("url") @ExcludeMissing private val url: JsonField = JsonMissing.of(), + @JsonProperty("branch") + @ExcludeMissing + private val branch: JsonField = JsonMissing.of(), + @JsonProperty("rootDir") + @ExcludeMissing + private val rootDir: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): String = id.getRequired("id") - fun gitId(): Long = gitId.getRequired("gitId") - fun dateConnected(): OffsetDateTime = dateConnected.getRequired("dateConnected") fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + + fun gitId(): Long = gitId.getRequired("gitId") fun name(): String = name.getRequired("name") fun private_(): Boolean = private_.getRequired("private") + fun projectId(): String = projectId.getRequired("projectId") + fun slug(): String = slug.getRequired("slug") fun url(): String = url.getRequired("url") - fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) - - fun projectId(): String = projectId.getRequired("projectId") + fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) - fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - @JsonProperty("gitId") @ExcludeMissing fun _gitId() = gitId + @JsonProperty("dateConnected") + @ExcludeMissing + fun _dateConnected(): JsonField = dateConnected - @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected() = dateConnected + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("gitAccountId") + @ExcludeMissing + fun _gitAccountId(): JsonField = gitAccountId - @JsonProperty("branch") @ExcludeMissing fun _branch() = branch + @JsonProperty("gitId") @ExcludeMissing fun _gitId(): JsonField = gitId - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - @JsonProperty("private") @ExcludeMissing fun _private_() = private_ + @JsonProperty("private") @ExcludeMissing fun _private_(): JsonField = private_ - @JsonProperty("slug") @ExcludeMissing fun _slug() = slug + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId - @JsonProperty("url") @ExcludeMissing fun _url() = url + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - @JsonProperty("rootDir") @ExcludeMissing fun _rootDir() = rootDir + @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch - @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId() = gitAccountId + @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): GitRepo = apply { - if (!validated) { - id() - gitId() - dateConnected() - dateUpdated() - branch() - name() - private_() - slug() - url() - rootDir() - projectId() - gitAccountId() - validated = true + if (validated) { + return@apply } + + id() + dateConnected() + dateUpdated() + gitAccountId() + gitId() + name() + private_() + projectId() + slug() + url() + branch() + rootDir() + validated = true } fun toBuilder() = Builder().from(this) @@ -710,144 +772,125 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var gitId: JsonField = JsonMissing.of() - private var dateConnected: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var dateConnected: JsonField? = null + private var dateUpdated: JsonField? = null + private var gitAccountId: JsonField? = null + private var gitId: JsonField? = null + private var name: JsonField? = null + private var private_: JsonField? = null + private var projectId: JsonField? = null + private var slug: JsonField? = null + private var url: JsonField? = null private var branch: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var private_: JsonField = JsonMissing.of() - private var slug: JsonField = JsonMissing.of() - private var url: JsonField = JsonMissing.of() private var rootDir: JsonField = JsonMissing.of() - private var projectId: JsonField = JsonMissing.of() - private var gitAccountId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(gitRepo: GitRepo) = apply { - this.id = gitRepo.id - this.gitId = gitRepo.gitId - this.dateConnected = gitRepo.dateConnected - this.dateUpdated = gitRepo.dateUpdated - this.branch = gitRepo.branch - this.name = gitRepo.name - this.private_ = gitRepo.private_ - this.slug = gitRepo.slug - this.url = gitRepo.url - this.rootDir = gitRepo.rootDir - this.projectId = gitRepo.projectId - this.gitAccountId = gitRepo.gitAccountId - additionalProperties(gitRepo.additionalProperties) + id = gitRepo.id + dateConnected = gitRepo.dateConnected + dateUpdated = gitRepo.dateUpdated + gitAccountId = gitRepo.gitAccountId + gitId = gitRepo.gitId + name = gitRepo.name + private_ = gitRepo.private_ + projectId = gitRepo.projectId + slug = gitRepo.slug + url = gitRepo.url + branch = gitRepo.branch + rootDir = gitRepo.rootDir + additionalProperties = gitRepo.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) - - @JsonProperty("gitId") - @ExcludeMissing - fun gitId(gitId: JsonField) = apply { this.gitId = gitId } - fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) - @JsonProperty("dateConnected") - @ExcludeMissing fun dateConnected(dateConnected: JsonField) = apply { this.dateConnected = dateConnected } fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - fun branch(branch: String) = branch(JsonField.of(branch)) + fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) - @JsonProperty("branch") - @ExcludeMissing - fun branch(branch: JsonField) = apply { this.branch = branch } + fun gitAccountId(gitAccountId: JsonField) = apply { + this.gitAccountId = gitAccountId + } + + fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) + + fun gitId(gitId: JsonField) = apply { this.gitId = gitId } fun name(name: String) = name(JsonField.of(name)) - @JsonProperty("name") - @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } fun private_(private_: Boolean) = private_(JsonField.of(private_)) - @JsonProperty("private") - @ExcludeMissing fun private_(private_: JsonField) = apply { this.private_ = private_ } + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + fun slug(slug: String) = slug(JsonField.of(slug)) - @JsonProperty("slug") - @ExcludeMissing fun slug(slug: JsonField) = apply { this.slug = slug } fun url(url: String) = url(JsonField.of(url)) - @JsonProperty("url") - @ExcludeMissing fun url(url: JsonField) = apply { this.url = url } - fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) - - @JsonProperty("rootDir") - @ExcludeMissing - fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } - - fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + fun branch(branch: String) = branch(JsonField.of(branch)) - @JsonProperty("projectId") - @ExcludeMissing - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + fun branch(branch: JsonField) = apply { this.branch = branch } - fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) + fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) - @JsonProperty("gitAccountId") - @ExcludeMissing - fun gitAccountId(gitAccountId: JsonField) = apply { - this.gitAccountId = gitAccountId - } + fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): GitRepo = GitRepo( - id, - gitId, - dateConnected, - dateUpdated, + checkRequired("id", id), + checkRequired("dateConnected", dateConnected), + checkRequired("dateUpdated", dateUpdated), + checkRequired("gitAccountId", gitAccountId), + checkRequired("gitId", gitId), + checkRequired("name", name), + checkRequired("private_", private_), + checkRequired("projectId", projectId), + checkRequired("slug", slug), + checkRequired("url", url), branch, - name, - private_, - slug, - url, rootDir, - projectId, - gitAccountId, additionalProperties.toImmutable(), ) } @@ -857,17 +900,17 @@ private constructor( return true } - return /* spotless:off */ other is GitRepo && id == other.id && gitId == other.gitId && dateConnected == other.dateConnected && dateUpdated == other.dateUpdated && branch == other.branch && name == other.name && private_ == other.private_ && slug == other.slug && url == other.url && rootDir == other.rootDir && projectId == other.projectId && gitAccountId == other.gitAccountId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GitRepo && id == other.id && dateConnected == other.dateConnected && dateUpdated == other.dateUpdated && gitAccountId == other.gitAccountId && gitId == other.gitId && name == other.name && private_ == other.private_ && projectId == other.projectId && slug == other.slug && url == other.url && branch == other.branch && rootDir == other.rootDir && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, gitId, dateConnected, dateUpdated, branch, name, private_, slug, url, rootDir, projectId, gitAccountId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dateConnected, dateUpdated, gitAccountId, gitId, name, private_, projectId, slug, url, branch, rootDir, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GitRepo{id=$id, gitId=$gitId, dateConnected=$dateConnected, dateUpdated=$dateUpdated, branch=$branch, name=$name, private_=$private_, slug=$slug, url=$url, rootDir=$rootDir, projectId=$projectId, gitAccountId=$gitAccountId, additionalProperties=$additionalProperties}" + "GitRepo{id=$id, dateConnected=$dateConnected, dateUpdated=$dateUpdated, gitAccountId=$gitAccountId, gitId=$gitId, name=$name, private_=$private_, projectId=$projectId, slug=$slug, url=$url, branch=$branch, rootDir=$rootDir, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -875,15 +918,15 @@ private constructor( return true } - return /* spotless:off */ other is ProjectCreateResponse && id == other.id && workspaceId == other.workspaceId && creatorId == other.creatorId && name == other.name && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && description == other.description && source == other.source && taskType == other.taskType && versionCount == other.versionCount && inferencePipelineCount == other.inferencePipelineCount && goalCount == other.goalCount && developmentGoalCount == other.developmentGoalCount && monitoringGoalCount == other.monitoringGoalCount && links == other.links && gitRepo == other.gitRepo && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ProjectCreateResponse && id == other.id && creatorId == other.creatorId && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && developmentGoalCount == other.developmentGoalCount && goalCount == other.goalCount && inferencePipelineCount == other.inferencePipelineCount && links == other.links && monitoringGoalCount == other.monitoringGoalCount && name == other.name && source == other.source && taskType == other.taskType && versionCount == other.versionCount && workspaceId == other.workspaceId && description == other.description && gitRepo == other.gitRepo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, workspaceId, creatorId, name, dateCreated, dateUpdated, description, source, taskType, versionCount, inferencePipelineCount, goalCount, developmentGoalCount, monitoringGoalCount, links, gitRepo, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, creatorId, dateCreated, dateUpdated, developmentGoalCount, goalCount, inferencePipelineCount, links, monitoringGoalCount, name, source, taskType, versionCount, workspaceId, description, gitRepo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ProjectCreateResponse{id=$id, workspaceId=$workspaceId, creatorId=$creatorId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, source=$source, taskType=$taskType, versionCount=$versionCount, inferencePipelineCount=$inferencePipelineCount, goalCount=$goalCount, developmentGoalCount=$developmentGoalCount, monitoringGoalCount=$monitoringGoalCount, links=$links, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" + "ProjectCreateResponse{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, developmentGoalCount=$developmentGoalCount, goalCount=$goalCount, inferencePipelineCount=$inferencePipelineCount, links=$links, monitoringGoalCount=$monitoringGoalCount, name=$name, source=$source, taskType=$taskType, versionCount=$versionCount, workspaceId=$workspaceId, description=$description, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt index 68e52c0f..ef83c6c7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt @@ -6,14 +6,16 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.Enum import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.LocalDate @@ -21,44 +23,44 @@ import java.time.OffsetDateTime import java.util.Objects import java.util.Optional +/** Create an inference pipeline in a project. */ class ProjectInferencePipelineCreateParams constructor( private val projectId: String, - private val description: String?, - private val name: String, - private val project: Project?, - private val workspace: Workspace?, + private val body: ProjectInferencePipelineCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun projectId(): String = projectId - fun description(): Optional = Optional.ofNullable(description) + /** The inference pipeline description. */ + fun description(): Optional = body.description() - fun name(): String = name + /** The inference pipeline name. */ + fun name(): String = body.name() - fun project(): Optional = Optional.ofNullable(project) + fun project(): Optional = body.project() - fun workspace(): Optional = Optional.ofNullable(workspace) + fun workspace(): Optional = body.workspace() + + /** The inference pipeline description. */ + fun _description(): JsonField = body._description() + + /** The inference pipeline name. */ + fun _name(): JsonField = body._name() + + fun _project(): JsonField = body._project() + + fun _workspace(): JsonField = body._workspace() + + fun _additionalBodyProperties(): Map = body._additionalProperties() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): ProjectInferencePipelineCreateBody { - return ProjectInferencePipelineCreateBody( - description, - name, - project, - workspace, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): ProjectInferencePipelineCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -71,31 +73,70 @@ constructor( } } - @JsonDeserialize(builder = ProjectInferencePipelineCreateBody.Builder::class) @NoAutoDetect class ProjectInferencePipelineCreateBody + @JsonCreator internal constructor( - private val description: String?, - private val name: String?, - private val project: Project?, - private val workspace: Workspace?, - private val additionalProperties: Map, + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("project") + @ExcludeMissing + private val project: JsonField = JsonMissing.of(), + @JsonProperty("workspace") + @ExcludeMissing + private val workspace: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** The inference pipeline description. */ - @JsonProperty("description") fun description(): String? = description + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) /** The inference pipeline name. */ - @JsonProperty("name") fun name(): String? = name + fun name(): String = name.getRequired("name") + + fun project(): Optional = Optional.ofNullable(project.getNullable("project")) - @JsonProperty("project") fun project(): Project? = project + fun workspace(): Optional = + Optional.ofNullable(workspace.getNullable("workspace")) - @JsonProperty("workspace") fun workspace(): Workspace? = workspace + /** The inference pipeline description. */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** The inference pipeline name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonProperty("project") @ExcludeMissing fun _project(): JsonField = project + + @JsonProperty("workspace") + @ExcludeMissing + fun _workspace(): JsonField = workspace @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + + fun validate(): ProjectInferencePipelineCreateBody = apply { + if (validated) { + return@apply + } + + description() + name() + project().ifPresent { it.validate() } + workspace().ifPresent { it.validate() } + validated = true + } + fun toBuilder() = Builder().from(this) companion object { @@ -105,54 +146,76 @@ constructor( class Builder { - private var description: String? = null - private var name: String? = null - private var project: Project? = null - private var workspace: Workspace? = null + private var description: JsonField? = null + private var name: JsonField? = null + private var project: JsonField = JsonMissing.of() + private var workspace: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( projectInferencePipelineCreateBody: ProjectInferencePipelineCreateBody ) = apply { - this.description = projectInferencePipelineCreateBody.description - this.name = projectInferencePipelineCreateBody.name - this.project = projectInferencePipelineCreateBody.project - this.workspace = projectInferencePipelineCreateBody.workspace - additionalProperties(projectInferencePipelineCreateBody.additionalProperties) + description = projectInferencePipelineCreateBody.description + name = projectInferencePipelineCreateBody.name + project = projectInferencePipelineCreateBody.project + workspace = projectInferencePipelineCreateBody.workspace + additionalProperties = + projectInferencePipelineCreateBody.additionalProperties.toMutableMap() } /** The inference pipeline description. */ - @JsonProperty("description") - fun description(description: String) = apply { this.description = description } + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** The inference pipeline description. */ + fun description(description: Optional) = description(description.orElse(null)) + + /** The inference pipeline description. */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** The inference pipeline name. */ + fun name(name: String) = name(JsonField.of(name)) /** The inference pipeline name. */ - @JsonProperty("name") fun name(name: String) = apply { this.name = name } + fun name(name: JsonField) = apply { this.name = name } - @JsonProperty("project") - fun project(project: Project) = apply { this.project = project } + fun project(project: Project?) = project(JsonField.ofNullable(project)) - @JsonProperty("workspace") - fun workspace(workspace: Workspace) = apply { this.workspace = workspace } + fun project(project: Optional) = project(project.orElse(null)) + + fun project(project: JsonField) = apply { this.project = project } + + fun workspace(workspace: Workspace?) = workspace(JsonField.ofNullable(workspace)) + + fun workspace(workspace: Optional) = workspace(workspace.orElse(null)) + + fun workspace(workspace: JsonField) = apply { this.workspace = workspace } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): ProjectInferencePipelineCreateBody = ProjectInferencePipelineCreateBody( - description, - checkNotNull(name) { "`name` is required but was not set" }, + checkRequired("description", description), + checkRequired("name", name), project, workspace, additionalProperties.toImmutable(), @@ -188,41 +251,69 @@ constructor( class Builder { private var projectId: String? = null - private var description: String? = null - private var name: String? = null - private var project: Project? = null - private var workspace: Workspace? = null + private var body: ProjectInferencePipelineCreateBody.Builder = + ProjectInferencePipelineCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( projectInferencePipelineCreateParams: ProjectInferencePipelineCreateParams ) = apply { projectId = projectInferencePipelineCreateParams.projectId - description = projectInferencePipelineCreateParams.description - name = projectInferencePipelineCreateParams.name - project = projectInferencePipelineCreateParams.project - workspace = projectInferencePipelineCreateParams.workspace + body = projectInferencePipelineCreateParams.body.toBuilder() additionalHeaders = projectInferencePipelineCreateParams.additionalHeaders.toBuilder() additionalQueryParams = projectInferencePipelineCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - projectInferencePipelineCreateParams.additionalBodyProperties.toMutableMap() } fun projectId(projectId: String) = apply { this.projectId = projectId } /** The inference pipeline description. */ - fun description(description: String) = apply { this.description = description } + fun description(description: String?) = apply { body.description(description) } + + /** The inference pipeline description. */ + fun description(description: Optional) = description(description.orElse(null)) + + /** The inference pipeline description. */ + fun description(description: JsonField) = apply { body.description(description) } + + /** The inference pipeline name. */ + fun name(name: String) = apply { body.name(name) } /** The inference pipeline name. */ - fun name(name: String) = apply { this.name = name } + fun name(name: JsonField) = apply { body.name(name) } - fun project(project: Project) = apply { this.project = project } + fun project(project: Project?) = apply { body.project(project) } + + fun project(project: Optional) = project(project.orElse(null)) + + fun project(project: JsonField) = apply { body.project(project) } + + fun workspace(workspace: Workspace?) = apply { body.workspace(workspace) } + + fun workspace(workspace: Optional) = workspace(workspace.orElse(null)) + + fun workspace(workspace: JsonField) = apply { body.workspace(workspace) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } - fun workspace(workspace: Workspace) = apply { this.workspace = workspace } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -322,55 +413,43 @@ constructor( additionalQueryParams.removeAll(keys) } - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) - } - fun build(): ProjectInferencePipelineCreateParams = ProjectInferencePipelineCreateParams( - checkNotNull(projectId) { "`projectId` is required but was not set" }, - description, - checkNotNull(name) { "`name` is required but was not set" }, - project, - workspace, + checkRequired("projectId", projectId), + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } - @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect class Links + @JsonCreator private constructor( - private val app: String?, - private val additionalProperties: Map, + @JsonProperty("app") @ExcludeMissing private val app: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("app") fun app(): String? = app + fun app(): String = app.getRequired("app") + + @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true + } + fun toBuilder() = Builder().from(this) companion object { @@ -380,36 +459,40 @@ constructor( class Builder { - private var app: String? = null + private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) + app = links.app + additionalProperties = links.additionalProperties.toMutableMap() } - @JsonProperty("app") fun app(app: String) = apply { this.app = app } + fun app(app: String) = app(JsonField.of(app)) + + fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Links = - Links( - checkNotNull(app) { "`app` is required but was not set" }, - additionalProperties.toImmutable() - ) + Links(checkRequired("app", app), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -429,6 +512,7 @@ constructor( override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } + /** The status of test evaluation for the inference pipeline. */ class Status @JsonCreator private constructor( @@ -510,82 +594,203 @@ constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = Project.Builder::class) @NoAutoDetect class Project + @JsonCreator private constructor( - private val id: String?, - private val workspaceId: String?, - private val creatorId: String?, - private val name: String?, - private val dateCreated: OffsetDateTime?, - private val dateUpdated: OffsetDateTime?, - private val description: String?, - private val source: Source?, - private val taskType: TaskType?, - private val versionCount: Long?, - private val inferencePipelineCount: Long?, - private val goalCount: Long?, - private val developmentGoalCount: Long?, - private val monitoringGoalCount: Long?, - private val links: Links?, - private val gitRepo: GitRepo?, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + private val creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("developmentGoalCount") + @ExcludeMissing + private val developmentGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("goalCount") + @ExcludeMissing + private val goalCount: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + private val inferencePipelineCount: JsonField = JsonMissing.of(), + @JsonProperty("links") + @ExcludeMissing + private val links: JsonField = JsonMissing.of(), + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + private val monitoringGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("source") + @ExcludeMissing + private val source: JsonField = JsonMissing.of(), + @JsonProperty("taskType") + @ExcludeMissing + private val taskType: JsonField = JsonMissing.of(), + @JsonProperty("versionCount") + @ExcludeMissing + private val versionCount: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + private val workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("gitRepo") + @ExcludeMissing + private val gitRepo: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** The project id. */ - @JsonProperty("id") fun id(): String? = id - - /** The workspace id. */ - @JsonProperty("workspaceId") fun workspaceId(): String? = workspaceId + fun id(): String = id.getRequired("id") /** The project creator id. */ - @JsonProperty("creatorId") fun creatorId(): String? = creatorId - - /** The project name. */ - @JsonProperty("name") fun name(): String? = name + fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) /** The project creation date. */ - @JsonProperty("dateCreated") fun dateCreated(): OffsetDateTime? = dateCreated + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") /** The project last updated date. */ - @JsonProperty("dateUpdated") fun dateUpdated(): OffsetDateTime? = dateUpdated + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The project description. */ - @JsonProperty("description") fun description(): String? = description + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") + + /** The total number of tests in the project. */ + fun goalCount(): Long = goalCount.getRequired("goalCount") + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(): Long = + inferencePipelineCount.getRequired("inferencePipelineCount") + + /** Links to the project. */ + fun links(): Links = links.getRequired("links") + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") + + /** The project name. */ + fun name(): String = name.getRequired("name") /** The source of the project. */ - @JsonProperty("source") fun source(): Source? = source + fun source(): Optional = Optional.ofNullable(source.getNullable("source")) /** The task type of the project. */ - @JsonProperty("taskType") fun taskType(): TaskType? = taskType + fun taskType(): TaskType = taskType.getRequired("taskType") /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") fun versionCount(): Long? = versionCount + fun versionCount(): Long = versionCount.getRequired("versionCount") - /** The number of inference pipelines in the project. */ - @JsonProperty("inferencePipelineCount") - fun inferencePipelineCount(): Long? = inferencePipelineCount + /** The workspace id. */ + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The total number of tests in the project. */ - @JsonProperty("goalCount") fun goalCount(): Long? = goalCount + /** The project description. */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) + + fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) + + /** The project id. */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** The project creator id. */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId + + /** The project creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** The project last updated date. */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated /** The number of tests in the development mode of the project. */ @JsonProperty("developmentGoalCount") - fun developmentGoalCount(): Long? = developmentGoalCount + @ExcludeMissing + fun _developmentGoalCount(): JsonField = developmentGoalCount - /** The number of tests in the monitoring mode of the project. */ - @JsonProperty("monitoringGoalCount") fun monitoringGoalCount(): Long? = monitoringGoalCount + /** The total number of tests in the project. */ + @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount + + /** The number of inference pipelines in the project. */ + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + fun _inferencePipelineCount(): JsonField = inferencePipelineCount /** Links to the project. */ - @JsonProperty("links") fun links(): Links? = links + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links + + /** The number of tests in the monitoring mode of the project. */ + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + fun _monitoringGoalCount(): JsonField = monitoringGoalCount - @JsonProperty("gitRepo") fun gitRepo(): GitRepo? = gitRepo + /** The project name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** The source of the project. */ + @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source + + /** The task type of the project. */ + @JsonProperty("taskType") @ExcludeMissing fun _taskType(): JsonField = taskType + + /** The number of versions (commits) in the project. */ + @JsonProperty("versionCount") + @ExcludeMissing + fun _versionCount(): JsonField = versionCount + + /** The workspace id. */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** The project description. */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + + fun validate(): Project = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + developmentGoalCount() + goalCount() + inferencePipelineCount() + links().validate() + monitoringGoalCount() + name() + source() + taskType() + versionCount() + workspaceId() + description() + gitRepo().ifPresent { it.validate() } + validated = true + } + fun toBuilder() = Builder().from(this) companion object { @@ -595,167 +800,244 @@ constructor( class Builder { - private var id: String? = null - private var workspaceId: String? = null - private var creatorId: String? = null - private var name: String? = null - private var dateCreated: OffsetDateTime? = null - private var dateUpdated: OffsetDateTime? = null - private var description: String? = null - private var source: Source? = null - private var taskType: TaskType? = null - private var versionCount: Long? = null - private var inferencePipelineCount: Long? = null - private var goalCount: Long? = null - private var developmentGoalCount: Long? = null - private var monitoringGoalCount: Long? = null - private var links: Links? = null - private var gitRepo: GitRepo? = null + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var developmentGoalCount: JsonField? = null + private var goalCount: JsonField? = null + private var inferencePipelineCount: JsonField? = null + private var links: JsonField? = null + private var monitoringGoalCount: JsonField? = null + private var name: JsonField? = null + private var source: JsonField? = null + private var taskType: JsonField? = null + private var versionCount: JsonField? = null + private var workspaceId: JsonField? = null + private var description: JsonField = JsonMissing.of() + private var gitRepo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(project: Project) = apply { - this.id = project.id - this.workspaceId = project.workspaceId - this.creatorId = project.creatorId - this.name = project.name - this.dateCreated = project.dateCreated - this.dateUpdated = project.dateUpdated - this.description = project.description - this.source = project.source - this.taskType = project.taskType - this.versionCount = project.versionCount - this.inferencePipelineCount = project.inferencePipelineCount - this.goalCount = project.goalCount - this.developmentGoalCount = project.developmentGoalCount - this.monitoringGoalCount = project.monitoringGoalCount - this.links = project.links - this.gitRepo = project.gitRepo - additionalProperties(project.additionalProperties) + id = project.id + creatorId = project.creatorId + dateCreated = project.dateCreated + dateUpdated = project.dateUpdated + developmentGoalCount = project.developmentGoalCount + goalCount = project.goalCount + inferencePipelineCount = project.inferencePipelineCount + links = project.links + monitoringGoalCount = project.monitoringGoalCount + name = project.name + source = project.source + taskType = project.taskType + versionCount = project.versionCount + workspaceId = project.workspaceId + description = project.description + gitRepo = project.gitRepo + additionalProperties = project.additionalProperties.toMutableMap() } /** The project id. */ - @JsonProperty("id") fun id(id: String) = apply { this.id = id } + fun id(id: String) = id(JsonField.of(id)) - /** The workspace id. */ - @JsonProperty("workspaceId") - fun workspaceId(workspaceId: String) = apply { this.workspaceId = workspaceId } + /** The project id. */ + fun id(id: JsonField) = apply { this.id = id } /** The project creator id. */ - @JsonProperty("creatorId") - fun creatorId(creatorId: String) = apply { this.creatorId = creatorId } + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The project name. */ - @JsonProperty("name") fun name(name: String) = apply { this.name = name } + /** The project creator id. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + + /** The project creator id. */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The project creation date. */ - @JsonProperty("dateCreated") - fun dateCreated(dateCreated: OffsetDateTime) = apply { this.dateCreated = dateCreated } + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** The project creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } /** The project last updated date. */ - @JsonProperty("dateUpdated") - fun dateUpdated(dateUpdated: OffsetDateTime) = apply { this.dateUpdated = dateUpdated } + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The project description. */ - @JsonProperty("description") - fun description(description: String) = apply { this.description = description } + /** The project last updated date. */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } - /** The source of the project. */ - @JsonProperty("source") fun source(source: Source) = apply { this.source = source } + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: Long) = + developmentGoalCount(JsonField.of(developmentGoalCount)) - /** The task type of the project. */ - @JsonProperty("taskType") - fun taskType(taskType: TaskType) = apply { this.taskType = taskType } + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: JsonField) = apply { + this.developmentGoalCount = developmentGoalCount + } - /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") - fun versionCount(versionCount: Long) = apply { this.versionCount = versionCount } + /** The total number of tests in the project. */ + fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) + + /** The total number of tests in the project. */ + fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } /** The number of inference pipelines in the project. */ - @JsonProperty("inferencePipelineCount") - fun inferencePipelineCount(inferencePipelineCount: Long) = apply { + fun inferencePipelineCount(inferencePipelineCount: Long) = + inferencePipelineCount(JsonField.of(inferencePipelineCount)) + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { this.inferencePipelineCount = inferencePipelineCount } - /** The total number of tests in the project. */ - @JsonProperty("goalCount") - fun goalCount(goalCount: Long) = apply { this.goalCount = goalCount } + /** Links to the project. */ + fun links(links: Links) = links(JsonField.of(links)) - /** The number of tests in the development mode of the project. */ - @JsonProperty("developmentGoalCount") - fun developmentGoalCount(developmentGoalCount: Long) = apply { - this.developmentGoalCount = developmentGoalCount - } + /** Links to the project. */ + fun links(links: JsonField) = apply { this.links = links } /** The number of tests in the monitoring mode of the project. */ - @JsonProperty("monitoringGoalCount") - fun monitoringGoalCount(monitoringGoalCount: Long) = apply { + fun monitoringGoalCount(monitoringGoalCount: Long) = + monitoringGoalCount(JsonField.of(monitoringGoalCount)) + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { this.monitoringGoalCount = monitoringGoalCount } - /** Links to the project. */ - @JsonProperty("links") fun links(links: Links) = apply { this.links = links } + /** The project name. */ + fun name(name: String) = name(JsonField.of(name)) - @JsonProperty("gitRepo") - fun gitRepo(gitRepo: GitRepo) = apply { this.gitRepo = gitRepo } + /** The project name. */ + fun name(name: JsonField) = apply { this.name = name } + + /** The source of the project. */ + fun source(source: Source?) = source(JsonField.ofNullable(source)) + + /** The source of the project. */ + fun source(source: Optional) = source(source.orElse(null)) + + /** The source of the project. */ + fun source(source: JsonField) = apply { this.source = source } + + /** The task type of the project. */ + fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) + + /** The task type of the project. */ + fun taskType(taskType: JsonField) = apply { this.taskType = taskType } + + /** The number of versions (commits) in the project. */ + fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) + + /** The number of versions (commits) in the project. */ + fun versionCount(versionCount: JsonField) = apply { + this.versionCount = versionCount + } + + /** The workspace id. */ + fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) + + /** The workspace id. */ + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.orElse(null)) + + /** The workspace id. */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The project description. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** The project description. */ + fun description(description: Optional) = description(description.orElse(null)) + + /** The project description. */ + fun description(description: JsonField) = apply { + this.description = description + } + + fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) + + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.orElse(null)) + + fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Project = Project( - checkNotNull(id) { "`id` is required but was not set" }, - workspaceId, - creatorId, - checkNotNull(name) { "`name` is required but was not set" }, - checkNotNull(dateCreated) { "`dateCreated` is required but was not set" }, - checkNotNull(dateUpdated) { "`dateUpdated` is required but was not set" }, + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("developmentGoalCount", developmentGoalCount), + checkRequired("goalCount", goalCount), + checkRequired("inferencePipelineCount", inferencePipelineCount), + checkRequired("links", links), + checkRequired("monitoringGoalCount", monitoringGoalCount), + checkRequired("name", name), + checkRequired("source", source), + checkRequired("taskType", taskType), + checkRequired("versionCount", versionCount), + checkRequired("workspaceId", workspaceId), description, - source, - checkNotNull(taskType) { "`taskType` is required but was not set" }, - checkNotNull(versionCount) { "`versionCount` is required but was not set" }, - checkNotNull(inferencePipelineCount) { - "`inferencePipelineCount` is required but was not set" - }, - checkNotNull(goalCount) { "`goalCount` is required but was not set" }, - checkNotNull(developmentGoalCount) { - "`developmentGoalCount` is required but was not set" - }, - checkNotNull(monitoringGoalCount) { - "`monitoringGoalCount` is required but was not set" - }, - checkNotNull(links) { "`links` is required but was not set" }, gitRepo, additionalProperties.toImmutable(), ) } /** Links to the project. */ - @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect class Links + @JsonCreator private constructor( - private val app: String?, - private val additionalProperties: Map, + @JsonProperty("app") + @ExcludeMissing + private val app: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("app") fun app(): String? = app + fun app(): String = app.getRequired("app") + + @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true + } + fun toBuilder() = Builder().from(this) companion object { @@ -765,25 +1047,26 @@ constructor( class Builder { - private var app: String? = null + private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) + app = links.app + additionalProperties = links.additionalProperties.toMutableMap() } - @JsonProperty("app") fun app(app: String) = apply { this.app = app } + fun app(app: String) = app(JsonField.of(app)) + + fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -791,11 +1074,16 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Links = - Links( - checkNotNull(app) { "`app` is required but was not set" }, - additionalProperties.toImmutable() - ) + Links(checkRequired("app", app), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -815,6 +1103,7 @@ constructor( override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } + /** The source of the project. */ class Source @JsonCreator private constructor( @@ -878,6 +1167,7 @@ constructor( override fun toString() = value.toString() } + /** The task type of the project. */ class TaskType @JsonCreator private constructor( @@ -947,53 +1237,132 @@ constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = GitRepo.Builder::class) @NoAutoDetect class GitRepo + @JsonCreator private constructor( - private val id: String?, - private val gitId: Long?, - private val dateConnected: OffsetDateTime?, - private val dateUpdated: OffsetDateTime?, - private val branch: String?, - private val name: String?, - private val private_: Boolean?, - private val slug: String?, - private val url: String?, - private val rootDir: String?, - private val projectId: String?, - private val gitAccountId: String?, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("dateConnected") + @ExcludeMissing + private val dateConnected: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("gitAccountId") + @ExcludeMissing + private val gitAccountId: JsonField = JsonMissing.of(), + @JsonProperty("gitId") + @ExcludeMissing + private val gitId: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("private") + @ExcludeMissing + private val private_: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + private val projectId: JsonField = JsonMissing.of(), + @JsonProperty("slug") + @ExcludeMissing + private val slug: JsonField = JsonMissing.of(), + @JsonProperty("url") + @ExcludeMissing + private val url: JsonField = JsonMissing.of(), + @JsonProperty("branch") + @ExcludeMissing + private val branch: JsonField = JsonMissing.of(), + @JsonProperty("rootDir") + @ExcludeMissing + private val rootDir: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("id") fun id(): String? = id + fun id(): String = id.getRequired("id") + + fun dateConnected(): OffsetDateTime = dateConnected.getRequired("dateConnected") + + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + + fun gitId(): Long = gitId.getRequired("gitId") + + fun name(): String = name.getRequired("name") + + fun private_(): Boolean = private_.getRequired("private") - @JsonProperty("gitId") fun gitId(): Long? = gitId + fun projectId(): String = projectId.getRequired("projectId") - @JsonProperty("dateConnected") fun dateConnected(): OffsetDateTime? = dateConnected + fun slug(): String = slug.getRequired("slug") - @JsonProperty("dateUpdated") fun dateUpdated(): OffsetDateTime? = dateUpdated + fun url(): String = url.getRequired("url") - @JsonProperty("branch") fun branch(): String? = branch + fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) - @JsonProperty("name") fun name(): String? = name + fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) - @JsonProperty("private") fun private_(): Boolean? = private_ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - @JsonProperty("slug") fun slug(): String? = slug + @JsonProperty("dateConnected") + @ExcludeMissing + fun _dateConnected(): JsonField = dateConnected + + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - @JsonProperty("url") fun url(): String? = url + @JsonProperty("gitAccountId") + @ExcludeMissing + fun _gitAccountId(): JsonField = gitAccountId + + @JsonProperty("gitId") @ExcludeMissing fun _gitId(): JsonField = gitId - @JsonProperty("rootDir") fun rootDir(): String? = rootDir + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - @JsonProperty("projectId") fun projectId(): String? = projectId + @JsonProperty("private") @ExcludeMissing fun _private_(): JsonField = private_ + + @JsonProperty("projectId") + @ExcludeMissing + fun _projectId(): JsonField = projectId - @JsonProperty("gitAccountId") fun gitAccountId(): String? = gitAccountId + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url + + @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch + + @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + + fun validate(): GitRepo = apply { + if (validated) { + return@apply + } + + id() + dateConnected() + dateUpdated() + gitAccountId() + gitId() + name() + private_() + projectId() + slug() + url() + branch() + rootDir() + validated = true + } + fun toBuilder() = Builder().from(this) companion object { @@ -1003,79 +1372,100 @@ constructor( class Builder { - private var id: String? = null - private var gitId: Long? = null - private var dateConnected: OffsetDateTime? = null - private var dateUpdated: OffsetDateTime? = null - private var branch: String? = null - private var name: String? = null - private var private_: Boolean? = null - private var slug: String? = null - private var url: String? = null - private var rootDir: String? = null - private var projectId: String? = null - private var gitAccountId: String? = null + private var id: JsonField? = null + private var dateConnected: JsonField? = null + private var dateUpdated: JsonField? = null + private var gitAccountId: JsonField? = null + private var gitId: JsonField? = null + private var name: JsonField? = null + private var private_: JsonField? = null + private var projectId: JsonField? = null + private var slug: JsonField? = null + private var url: JsonField? = null + private var branch: JsonField = JsonMissing.of() + private var rootDir: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(gitRepo: GitRepo) = apply { - this.id = gitRepo.id - this.gitId = gitRepo.gitId - this.dateConnected = gitRepo.dateConnected - this.dateUpdated = gitRepo.dateUpdated - this.branch = gitRepo.branch - this.name = gitRepo.name - this.private_ = gitRepo.private_ - this.slug = gitRepo.slug - this.url = gitRepo.url - this.rootDir = gitRepo.rootDir - this.projectId = gitRepo.projectId - this.gitAccountId = gitRepo.gitAccountId - additionalProperties(gitRepo.additionalProperties) + id = gitRepo.id + dateConnected = gitRepo.dateConnected + dateUpdated = gitRepo.dateUpdated + gitAccountId = gitRepo.gitAccountId + gitId = gitRepo.gitId + name = gitRepo.name + private_ = gitRepo.private_ + projectId = gitRepo.projectId + slug = gitRepo.slug + url = gitRepo.url + branch = gitRepo.branch + rootDir = gitRepo.rootDir + additionalProperties = gitRepo.additionalProperties.toMutableMap() } - @JsonProperty("id") fun id(id: String) = apply { this.id = id } + fun id(id: String) = id(JsonField.of(id)) - @JsonProperty("gitId") fun gitId(gitId: Long) = apply { this.gitId = gitId } + fun id(id: JsonField) = apply { this.id = id } - @JsonProperty("dateConnected") - fun dateConnected(dateConnected: OffsetDateTime) = apply { + fun dateConnected(dateConnected: OffsetDateTime) = + dateConnected(JsonField.of(dateConnected)) + + fun dateConnected(dateConnected: JsonField) = apply { this.dateConnected = dateConnected } - @JsonProperty("dateUpdated") - fun dateUpdated(dateUpdated: OffsetDateTime) = apply { + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) + + fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - @JsonProperty("branch") fun branch(branch: String) = apply { this.branch = branch } + fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) + + fun gitAccountId(gitAccountId: JsonField) = apply { + this.gitAccountId = gitAccountId + } + + fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) + + fun gitId(gitId: JsonField) = apply { this.gitId = gitId } + + fun name(name: String) = name(JsonField.of(name)) - @JsonProperty("name") fun name(name: String) = apply { this.name = name } + fun name(name: JsonField) = apply { this.name = name } - @JsonProperty("private") - fun private_(private_: Boolean) = apply { this.private_ = private_ } + fun private_(private_: Boolean) = private_(JsonField.of(private_)) - @JsonProperty("slug") fun slug(slug: String) = apply { this.slug = slug } + fun private_(private_: JsonField) = apply { this.private_ = private_ } - @JsonProperty("url") fun url(url: String) = apply { this.url = url } + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - @JsonProperty("rootDir") - fun rootDir(rootDir: String) = apply { this.rootDir = rootDir } + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } - @JsonProperty("projectId") - fun projectId(projectId: String) = apply { this.projectId = projectId } + fun slug(slug: String) = slug(JsonField.of(slug)) - @JsonProperty("gitAccountId") - fun gitAccountId(gitAccountId: String) = apply { this.gitAccountId = gitAccountId } + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun url(url: String) = url(JsonField.of(url)) + + fun url(url: JsonField) = apply { this.url = url } + + fun branch(branch: String) = branch(JsonField.of(branch)) + + fun branch(branch: JsonField) = apply { this.branch = branch } + + fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) + + fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1083,22 +1473,28 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): GitRepo = GitRepo( - checkNotNull(id) { "`id` is required but was not set" }, - checkNotNull(gitId) { "`gitId` is required but was not set" }, - checkNotNull(dateConnected) { - "`dateConnected` is required but was not set" - }, - checkNotNull(dateUpdated) { "`dateUpdated` is required but was not set" }, + checkRequired("id", id), + checkRequired("dateConnected", dateConnected), + checkRequired("dateUpdated", dateUpdated), + checkRequired("gitAccountId", gitAccountId), + checkRequired("gitId", gitId), + checkRequired("name", name), + checkRequired("private_", private_), + checkRequired("projectId", projectId), + checkRequired("slug", slug), + checkRequired("url", url), branch, - checkNotNull(name) { "`name` is required but was not set" }, - checkNotNull(private_) { "`private_` is required but was not set" }, - checkNotNull(slug) { "`slug` is required but was not set" }, - checkNotNull(url) { "`url` is required but was not set" }, rootDir, - checkNotNull(projectId) { "`projectId` is required but was not set" }, - checkNotNull(gitAccountId) { "`gitAccountId` is required but was not set" }, additionalProperties.toImmutable(), ) } @@ -1108,17 +1504,17 @@ constructor( return true } - return /* spotless:off */ other is GitRepo && id == other.id && gitId == other.gitId && dateConnected == other.dateConnected && dateUpdated == other.dateUpdated && branch == other.branch && name == other.name && private_ == other.private_ && slug == other.slug && url == other.url && rootDir == other.rootDir && projectId == other.projectId && gitAccountId == other.gitAccountId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GitRepo && id == other.id && dateConnected == other.dateConnected && dateUpdated == other.dateUpdated && gitAccountId == other.gitAccountId && gitId == other.gitId && name == other.name && private_ == other.private_ && projectId == other.projectId && slug == other.slug && url == other.url && branch == other.branch && rootDir == other.rootDir && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, gitId, dateConnected, dateUpdated, branch, name, private_, slug, url, rootDir, projectId, gitAccountId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dateConnected, dateUpdated, gitAccountId, gitId, name, private_, projectId, slug, url, branch, rootDir, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GitRepo{id=$id, gitId=$gitId, dateConnected=$dateConnected, dateUpdated=$dateUpdated, branch=$branch, name=$name, private_=$private_, slug=$slug, url=$url, rootDir=$rootDir, projectId=$projectId, gitAccountId=$gitAccountId, additionalProperties=$additionalProperties}" + "GitRepo{id=$id, dateConnected=$dateConnected, dateUpdated=$dateUpdated, gitAccountId=$gitAccountId, gitId=$gitId, name=$name, private_=$private_, projectId=$projectId, slug=$slug, url=$url, branch=$branch, rootDir=$rootDir, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1126,91 +1522,221 @@ constructor( return true } - return /* spotless:off */ other is Project && id == other.id && workspaceId == other.workspaceId && creatorId == other.creatorId && name == other.name && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && description == other.description && source == other.source && taskType == other.taskType && versionCount == other.versionCount && inferencePipelineCount == other.inferencePipelineCount && goalCount == other.goalCount && developmentGoalCount == other.developmentGoalCount && monitoringGoalCount == other.monitoringGoalCount && links == other.links && gitRepo == other.gitRepo && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Project && id == other.id && creatorId == other.creatorId && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && developmentGoalCount == other.developmentGoalCount && goalCount == other.goalCount && inferencePipelineCount == other.inferencePipelineCount && links == other.links && monitoringGoalCount == other.monitoringGoalCount && name == other.name && source == other.source && taskType == other.taskType && versionCount == other.versionCount && workspaceId == other.workspaceId && description == other.description && gitRepo == other.gitRepo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, workspaceId, creatorId, name, dateCreated, dateUpdated, description, source, taskType, versionCount, inferencePipelineCount, goalCount, developmentGoalCount, monitoringGoalCount, links, gitRepo, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, creatorId, dateCreated, dateUpdated, developmentGoalCount, goalCount, inferencePipelineCount, links, monitoringGoalCount, name, source, taskType, versionCount, workspaceId, description, gitRepo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Project{id=$id, workspaceId=$workspaceId, creatorId=$creatorId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, source=$source, taskType=$taskType, versionCount=$versionCount, inferencePipelineCount=$inferencePipelineCount, goalCount=$goalCount, developmentGoalCount=$developmentGoalCount, monitoringGoalCount=$monitoringGoalCount, links=$links, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" + "Project{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, developmentGoalCount=$developmentGoalCount, goalCount=$goalCount, inferencePipelineCount=$inferencePipelineCount, links=$links, monitoringGoalCount=$monitoringGoalCount, name=$name, source=$source, taskType=$taskType, versionCount=$versionCount, workspaceId=$workspaceId, description=$description, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Workspace.Builder::class) @NoAutoDetect class Workspace + @JsonCreator private constructor( - private val id: String?, - private val name: String?, - private val slug: String?, - private val dateCreated: OffsetDateTime?, - private val dateUpdated: OffsetDateTime?, - private val creatorId: String?, - private val inviteCode: String?, - private val wildcardDomains: List?, - private val projectCount: Long?, - private val memberCount: Long?, - private val monthlyUsage: List?, - private val inviteCount: Long?, - private val periodStartDate: OffsetDateTime?, - private val periodEndDate: OffsetDateTime?, - private val samlOnlyAccess: Boolean?, - private val status: Status?, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + private val creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("inviteCount") + @ExcludeMissing + private val inviteCount: JsonField = JsonMissing.of(), + @JsonProperty("memberCount") + @ExcludeMissing + private val memberCount: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("periodEndDate") + @ExcludeMissing + private val periodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("periodStartDate") + @ExcludeMissing + private val periodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("projectCount") + @ExcludeMissing + private val projectCount: JsonField = JsonMissing.of(), + @JsonProperty("slug") + @ExcludeMissing + private val slug: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonProperty("inviteCode") + @ExcludeMissing + private val inviteCode: JsonField = JsonMissing.of(), + @JsonProperty("monthlyUsage") + @ExcludeMissing + private val monthlyUsage: JsonField> = JsonMissing.of(), + @JsonProperty("samlOnlyAccess") + @ExcludeMissing + private val samlOnlyAccess: JsonField = JsonMissing.of(), + @JsonProperty("wildcardDomains") + @ExcludeMissing + private val wildcardDomains: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** The workspace id. */ - @JsonProperty("id") fun id(): String? = id + fun id(): String = id.getRequired("id") + + /** The workspace creator id. */ + fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + + /** The workspace creation date. */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** The workspace last updated date. */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** The number of invites in the workspace. */ + fun inviteCount(): Long = inviteCount.getRequired("inviteCount") + + /** The number of members in the workspace. */ + fun memberCount(): Long = memberCount.getRequired("memberCount") /** The workspace name. */ - @JsonProperty("name") fun name(): String? = name + fun name(): String = name.getRequired("name") + + /** The end date of the current billing period. */ + fun periodEndDate(): Optional = + Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) + + /** The start date of the current billing period. */ + fun periodStartDate(): Optional = + Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) + + /** The number of projects in the workspace. */ + fun projectCount(): Long = projectCount.getRequired("projectCount") /** The workspace slug. */ - @JsonProperty("slug") fun slug(): String? = slug + fun slug(): String = slug.getRequired("slug") - /** The workspace creation date. */ - @JsonProperty("dateCreated") fun dateCreated(): OffsetDateTime? = dateCreated + fun status(): Status = status.getRequired("status") - /** The workspace last updated date. */ - @JsonProperty("dateUpdated") fun dateUpdated(): OffsetDateTime? = dateUpdated + /** The workspace invite code. */ + fun inviteCode(): Optional = + Optional.ofNullable(inviteCode.getNullable("inviteCode")) + + fun monthlyUsage(): Optional> = + Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) + + /** Whether the workspace only allows SAML authentication. */ + fun samlOnlyAccess(): Optional = + Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) + + fun wildcardDomains(): Optional> = + Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) + + /** The workspace id. */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The workspace creator id. */ - @JsonProperty("creatorId") fun creatorId(): String? = creatorId + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId - /** The workspace invite code. */ - @JsonProperty("inviteCode") fun inviteCode(): String? = inviteCode + /** The workspace creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated - @JsonProperty("wildcardDomains") fun wildcardDomains(): List? = wildcardDomains + /** The workspace last updated date. */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - /** The number of projects in the workspace. */ - @JsonProperty("projectCount") fun projectCount(): Long? = projectCount + /** The number of invites in the workspace. */ + @JsonProperty("inviteCount") + @ExcludeMissing + fun _inviteCount(): JsonField = inviteCount /** The number of members in the workspace. */ - @JsonProperty("memberCount") fun memberCount(): Long? = memberCount + @JsonProperty("memberCount") + @ExcludeMissing + fun _memberCount(): JsonField = memberCount - @JsonProperty("monthlyUsage") fun monthlyUsage(): List? = monthlyUsage + /** The workspace name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The number of invites in the workspace. */ - @JsonProperty("inviteCount") fun inviteCount(): Long? = inviteCount + /** The end date of the current billing period. */ + @JsonProperty("periodEndDate") + @ExcludeMissing + fun _periodEndDate(): JsonField = periodEndDate /** The start date of the current billing period. */ - @JsonProperty("periodStartDate") fun periodStartDate(): OffsetDateTime? = periodStartDate + @JsonProperty("periodStartDate") + @ExcludeMissing + fun _periodStartDate(): JsonField = periodStartDate - /** The end date of the current billing period. */ - @JsonProperty("periodEndDate") fun periodEndDate(): OffsetDateTime? = periodEndDate + /** The number of projects in the workspace. */ + @JsonProperty("projectCount") + @ExcludeMissing + fun _projectCount(): JsonField = projectCount + + /** The workspace slug. */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** The workspace invite code. */ + @JsonProperty("inviteCode") + @ExcludeMissing + fun _inviteCode(): JsonField = inviteCode + + @JsonProperty("monthlyUsage") + @ExcludeMissing + fun _monthlyUsage(): JsonField> = monthlyUsage /** Whether the workspace only allows SAML authentication. */ - @JsonProperty("samlOnlyAccess") fun samlOnlyAccess(): Boolean? = samlOnlyAccess + @JsonProperty("samlOnlyAccess") + @ExcludeMissing + fun _samlOnlyAccess(): JsonField = samlOnlyAccess - @JsonProperty("status") fun status(): Status? = status + @JsonProperty("wildcardDomains") + @ExcludeMissing + fun _wildcardDomains(): JsonField> = wildcardDomains @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + + fun validate(): Workspace = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + inviteCount() + memberCount() + name() + periodEndDate() + periodStartDate() + projectCount() + slug() + status() + inviteCode() + monthlyUsage().ifPresent { it.forEach { it.validate() } } + samlOnlyAccess() + wildcardDomains() + validated = true + } + fun toBuilder() = Builder().from(this) companion object { @@ -1220,144 +1746,230 @@ constructor( class Builder { - private var id: String? = null - private var name: String? = null - private var slug: String? = null - private var dateCreated: OffsetDateTime? = null - private var dateUpdated: OffsetDateTime? = null - private var creatorId: String? = null - private var inviteCode: String? = null - private var wildcardDomains: List? = null - private var projectCount: Long? = null - private var memberCount: Long? = null - private var monthlyUsage: List? = null - private var inviteCount: Long? = null - private var periodStartDate: OffsetDateTime? = null - private var periodEndDate: OffsetDateTime? = null - private var samlOnlyAccess: Boolean? = null - private var status: Status? = null + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var inviteCount: JsonField? = null + private var memberCount: JsonField? = null + private var name: JsonField? = null + private var periodEndDate: JsonField? = null + private var periodStartDate: JsonField? = null + private var projectCount: JsonField? = null + private var slug: JsonField? = null + private var status: JsonField? = null + private var inviteCode: JsonField = JsonMissing.of() + private var monthlyUsage: JsonField>? = null + private var samlOnlyAccess: JsonField = JsonMissing.of() + private var wildcardDomains: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(workspace: Workspace) = apply { - this.id = workspace.id - this.name = workspace.name - this.slug = workspace.slug - this.dateCreated = workspace.dateCreated - this.dateUpdated = workspace.dateUpdated - this.creatorId = workspace.creatorId - this.inviteCode = workspace.inviteCode - this.wildcardDomains = workspace.wildcardDomains - this.projectCount = workspace.projectCount - this.memberCount = workspace.memberCount - this.monthlyUsage = workspace.monthlyUsage - this.inviteCount = workspace.inviteCount - this.periodStartDate = workspace.periodStartDate - this.periodEndDate = workspace.periodEndDate - this.samlOnlyAccess = workspace.samlOnlyAccess - this.status = workspace.status - additionalProperties(workspace.additionalProperties) + id = workspace.id + creatorId = workspace.creatorId + dateCreated = workspace.dateCreated + dateUpdated = workspace.dateUpdated + inviteCount = workspace.inviteCount + memberCount = workspace.memberCount + name = workspace.name + periodEndDate = workspace.periodEndDate + periodStartDate = workspace.periodStartDate + projectCount = workspace.projectCount + slug = workspace.slug + status = workspace.status + inviteCode = workspace.inviteCode + monthlyUsage = workspace.monthlyUsage.map { it.toMutableList() } + samlOnlyAccess = workspace.samlOnlyAccess + wildcardDomains = workspace.wildcardDomains.map { it.toMutableList() } + additionalProperties = workspace.additionalProperties.toMutableMap() } /** The workspace id. */ - @JsonProperty("id") fun id(id: String) = apply { this.id = id } + fun id(id: String) = id(JsonField.of(id)) - /** The workspace name. */ - @JsonProperty("name") fun name(name: String) = apply { this.name = name } + /** The workspace id. */ + fun id(id: JsonField) = apply { this.id = id } - /** The workspace slug. */ - @JsonProperty("slug") fun slug(slug: String) = apply { this.slug = slug } + /** The workspace creator id. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** The workspace creator id. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + + /** The workspace creator id. */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The workspace creation date. */ - @JsonProperty("dateCreated") - fun dateCreated(dateCreated: OffsetDateTime) = apply { this.dateCreated = dateCreated } + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** The workspace creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } /** The workspace last updated date. */ - @JsonProperty("dateUpdated") - fun dateUpdated(dateUpdated: OffsetDateTime) = apply { this.dateUpdated = dateUpdated } + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The workspace creator id. */ - @JsonProperty("creatorId") - fun creatorId(creatorId: String) = apply { this.creatorId = creatorId } + /** The workspace last updated date. */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } - /** The workspace invite code. */ - @JsonProperty("inviteCode") - fun inviteCode(inviteCode: String) = apply { this.inviteCode = inviteCode } + /** The number of invites in the workspace. */ + fun inviteCount(inviteCount: Long) = inviteCount(JsonField.of(inviteCount)) - @JsonProperty("wildcardDomains") - fun wildcardDomains(wildcardDomains: List) = apply { - this.wildcardDomains = wildcardDomains - } + /** The number of invites in the workspace. */ + fun inviteCount(inviteCount: JsonField) = apply { this.inviteCount = inviteCount } - /** The number of projects in the workspace. */ - @JsonProperty("projectCount") - fun projectCount(projectCount: Long) = apply { this.projectCount = projectCount } + /** The number of members in the workspace. */ + fun memberCount(memberCount: Long) = memberCount(JsonField.of(memberCount)) /** The number of members in the workspace. */ - @JsonProperty("memberCount") - fun memberCount(memberCount: Long) = apply { this.memberCount = memberCount } + fun memberCount(memberCount: JsonField) = apply { this.memberCount = memberCount } + + /** The workspace name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The workspace name. */ + fun name(name: JsonField) = apply { this.name = name } + + /** The end date of the current billing period. */ + fun periodEndDate(periodEndDate: OffsetDateTime?) = + periodEndDate(JsonField.ofNullable(periodEndDate)) + + /** The end date of the current billing period. */ + fun periodEndDate(periodEndDate: Optional) = + periodEndDate(periodEndDate.orElse(null)) - @JsonProperty("monthlyUsage") - fun monthlyUsage(monthlyUsage: List) = apply { - this.monthlyUsage = monthlyUsage + /** The end date of the current billing period. */ + fun periodEndDate(periodEndDate: JsonField) = apply { + this.periodEndDate = periodEndDate } - /** The number of invites in the workspace. */ - @JsonProperty("inviteCount") - fun inviteCount(inviteCount: Long) = apply { this.inviteCount = inviteCount } + /** The start date of the current billing period. */ + fun periodStartDate(periodStartDate: OffsetDateTime?) = + periodStartDate(JsonField.ofNullable(periodStartDate)) + + /** The start date of the current billing period. */ + fun periodStartDate(periodStartDate: Optional) = + periodStartDate(periodStartDate.orElse(null)) /** The start date of the current billing period. */ - @JsonProperty("periodStartDate") - fun periodStartDate(periodStartDate: OffsetDateTime) = apply { + fun periodStartDate(periodStartDate: JsonField) = apply { this.periodStartDate = periodStartDate } - /** The end date of the current billing period. */ - @JsonProperty("periodEndDate") - fun periodEndDate(periodEndDate: OffsetDateTime) = apply { - this.periodEndDate = periodEndDate + /** The number of projects in the workspace. */ + fun projectCount(projectCount: Long) = projectCount(JsonField.of(projectCount)) + + /** The number of projects in the workspace. */ + fun projectCount(projectCount: JsonField) = apply { + this.projectCount = projectCount + } + + /** The workspace slug. */ + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** The workspace slug. */ + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun status(status: Status) = status(JsonField.of(status)) + + fun status(status: JsonField) = apply { this.status = status } + + /** The workspace invite code. */ + fun inviteCode(inviteCode: String) = inviteCode(JsonField.of(inviteCode)) + + /** The workspace invite code. */ + fun inviteCode(inviteCode: JsonField) = apply { this.inviteCode = inviteCode } + + fun monthlyUsage(monthlyUsage: List) = + monthlyUsage(JsonField.of(monthlyUsage)) + + fun monthlyUsage(monthlyUsage: JsonField>) = apply { + this.monthlyUsage = monthlyUsage.map { it.toMutableList() } } + fun addMonthlyUsage(monthlyUsage: MonthlyUsage) = apply { + this.monthlyUsage = + (this.monthlyUsage ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(monthlyUsage) + } + } + + /** Whether the workspace only allows SAML authentication. */ + fun samlOnlyAccess(samlOnlyAccess: Boolean) = + samlOnlyAccess(JsonField.of(samlOnlyAccess)) + /** Whether the workspace only allows SAML authentication. */ - @JsonProperty("samlOnlyAccess") - fun samlOnlyAccess(samlOnlyAccess: Boolean) = apply { + fun samlOnlyAccess(samlOnlyAccess: JsonField) = apply { this.samlOnlyAccess = samlOnlyAccess } - @JsonProperty("status") fun status(status: Status) = apply { this.status = status } + fun wildcardDomains(wildcardDomains: List) = + wildcardDomains(JsonField.of(wildcardDomains)) + + fun wildcardDomains(wildcardDomains: JsonField>) = apply { + this.wildcardDomains = wildcardDomains.map { it.toMutableList() } + } + + fun addWildcardDomain(wildcardDomain: String) = apply { + wildcardDomains = + (wildcardDomains ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(wildcardDomain) + } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Workspace = Workspace( - checkNotNull(id) { "`id` is required but was not set" }, - checkNotNull(name) { "`name` is required but was not set" }, - checkNotNull(slug) { "`slug` is required but was not set" }, - checkNotNull(dateCreated) { "`dateCreated` is required but was not set" }, - checkNotNull(dateUpdated) { "`dateUpdated` is required but was not set" }, - creatorId, + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("inviteCount", inviteCount), + checkRequired("memberCount", memberCount), + checkRequired("name", name), + checkRequired("periodEndDate", periodEndDate), + checkRequired("periodStartDate", periodStartDate), + checkRequired("projectCount", projectCount), + checkRequired("slug", slug), + checkRequired("status", status), inviteCode, - wildcardDomains?.toImmutable(), - checkNotNull(projectCount) { "`projectCount` is required but was not set" }, - checkNotNull(memberCount) { "`memberCount` is required but was not set" }, - monthlyUsage?.toImmutable(), - checkNotNull(inviteCount) { "`inviteCount` is required but was not set" }, - periodStartDate, - periodEndDate, + (monthlyUsage ?: JsonMissing.of()).map { it.toImmutable() }, samlOnlyAccess, - checkNotNull(status) { "`status` is required but was not set" }, + (wildcardDomains ?: JsonMissing.of()).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -1455,26 +2067,61 @@ constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = MonthlyUsage.Builder::class) @NoAutoDetect class MonthlyUsage + @JsonCreator private constructor( - private val monthYear: LocalDate?, - private val predictionCount: Long?, - private val executionTimeMs: Long?, - private val additionalProperties: Map, + @JsonProperty("executionTimeMs") + @ExcludeMissing + private val executionTimeMs: JsonField = JsonMissing.of(), + @JsonProperty("monthYear") + @ExcludeMissing + private val monthYear: JsonField = JsonMissing.of(), + @JsonProperty("predictionCount") + @ExcludeMissing + private val predictionCount: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("monthYear") fun monthYear(): LocalDate? = monthYear + fun executionTimeMs(): Optional = + Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) + + fun monthYear(): Optional = + Optional.ofNullable(monthYear.getNullable("monthYear")) - @JsonProperty("predictionCount") fun predictionCount(): Long? = predictionCount + fun predictionCount(): Optional = + Optional.ofNullable(predictionCount.getNullable("predictionCount")) - @JsonProperty("executionTimeMs") fun executionTimeMs(): Long? = executionTimeMs + @JsonProperty("executionTimeMs") + @ExcludeMissing + fun _executionTimeMs(): JsonField = executionTimeMs + + @JsonProperty("monthYear") + @ExcludeMissing + fun _monthYear(): JsonField = monthYear + + @JsonProperty("predictionCount") + @ExcludeMissing + fun _predictionCount(): JsonField = predictionCount @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + + fun validate(): MonthlyUsage = apply { + if (validated) { + return@apply + } + + executionTimeMs() + monthYear() + predictionCount() + validated = true + } + fun toBuilder() = Builder().from(this) companion object { @@ -1484,40 +2131,53 @@ constructor( class Builder { - private var monthYear: LocalDate? = null - private var predictionCount: Long? = null - private var executionTimeMs: Long? = null + private var executionTimeMs: JsonField = JsonMissing.of() + private var monthYear: JsonField = JsonMissing.of() + private var predictionCount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(monthlyUsage: MonthlyUsage) = apply { - this.monthYear = monthlyUsage.monthYear - this.predictionCount = monthlyUsage.predictionCount - this.executionTimeMs = monthlyUsage.executionTimeMs - additionalProperties(monthlyUsage.additionalProperties) + executionTimeMs = monthlyUsage.executionTimeMs + monthYear = monthlyUsage.monthYear + predictionCount = monthlyUsage.predictionCount + additionalProperties = monthlyUsage.additionalProperties.toMutableMap() } - @JsonProperty("monthYear") - fun monthYear(monthYear: LocalDate) = apply { this.monthYear = monthYear } + fun executionTimeMs(executionTimeMs: Long?) = + executionTimeMs(JsonField.ofNullable(executionTimeMs)) - @JsonProperty("predictionCount") - fun predictionCount(predictionCount: Long) = apply { - this.predictionCount = predictionCount - } + fun executionTimeMs(executionTimeMs: Long) = + executionTimeMs(executionTimeMs as Long?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun executionTimeMs(executionTimeMs: Optional) = + executionTimeMs(executionTimeMs.orElse(null) as Long?) - @JsonProperty("executionTimeMs") - fun executionTimeMs(executionTimeMs: Long) = apply { + fun executionTimeMs(executionTimeMs: JsonField) = apply { this.executionTimeMs = executionTimeMs } + fun monthYear(monthYear: LocalDate) = monthYear(JsonField.of(monthYear)) + + fun monthYear(monthYear: JsonField) = apply { + this.monthYear = monthYear + } + + fun predictionCount(predictionCount: Long) = + predictionCount(JsonField.of(predictionCount)) + + fun predictionCount(predictionCount: JsonField) = apply { + this.predictionCount = predictionCount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1525,11 +2185,19 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): MonthlyUsage = MonthlyUsage( + executionTimeMs, monthYear, predictionCount, - executionTimeMs, additionalProperties.toImmutable(), ) } @@ -1539,17 +2207,17 @@ constructor( return true } - return /* spotless:off */ other is MonthlyUsage && monthYear == other.monthYear && predictionCount == other.predictionCount && executionTimeMs == other.executionTimeMs && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MonthlyUsage && executionTimeMs == other.executionTimeMs && monthYear == other.monthYear && predictionCount == other.predictionCount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(monthYear, predictionCount, executionTimeMs, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(executionTimeMs, monthYear, predictionCount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MonthlyUsage{monthYear=$monthYear, predictionCount=$predictionCount, executionTimeMs=$executionTimeMs, additionalProperties=$additionalProperties}" + "MonthlyUsage{executionTimeMs=$executionTimeMs, monthYear=$monthYear, predictionCount=$predictionCount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1557,17 +2225,17 @@ constructor( return true } - return /* spotless:off */ other is Workspace && id == other.id && name == other.name && slug == other.slug && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && creatorId == other.creatorId && inviteCode == other.inviteCode && wildcardDomains == other.wildcardDomains && projectCount == other.projectCount && memberCount == other.memberCount && monthlyUsage == other.monthlyUsage && inviteCount == other.inviteCount && periodStartDate == other.periodStartDate && periodEndDate == other.periodEndDate && samlOnlyAccess == other.samlOnlyAccess && status == other.status && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Workspace && id == other.id && creatorId == other.creatorId && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && inviteCount == other.inviteCount && memberCount == other.memberCount && name == other.name && periodEndDate == other.periodEndDate && periodStartDate == other.periodStartDate && projectCount == other.projectCount && slug == other.slug && status == other.status && inviteCode == other.inviteCode && monthlyUsage == other.monthlyUsage && samlOnlyAccess == other.samlOnlyAccess && wildcardDomains == other.wildcardDomains && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, name, slug, dateCreated, dateUpdated, creatorId, inviteCode, wildcardDomains, projectCount, memberCount, monthlyUsage, inviteCount, periodStartDate, periodEndDate, samlOnlyAccess, status, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, creatorId, dateCreated, dateUpdated, inviteCount, memberCount, name, periodEndDate, periodStartDate, projectCount, slug, status, inviteCode, monthlyUsage, samlOnlyAccess, wildcardDomains, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Workspace{id=$id, name=$name, slug=$slug, dateCreated=$dateCreated, dateUpdated=$dateUpdated, creatorId=$creatorId, inviteCode=$inviteCode, wildcardDomains=$wildcardDomains, projectCount=$projectCount, memberCount=$memberCount, monthlyUsage=$monthlyUsage, inviteCount=$inviteCount, periodStartDate=$periodStartDate, periodEndDate=$periodEndDate, samlOnlyAccess=$samlOnlyAccess, status=$status, additionalProperties=$additionalProperties}" + "Workspace{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, inviteCount=$inviteCount, memberCount=$memberCount, name=$name, periodEndDate=$periodEndDate, periodStartDate=$periodStartDate, projectCount=$projectCount, slug=$slug, status=$status, inviteCode=$inviteCode, monthlyUsage=$monthlyUsage, samlOnlyAccess=$samlOnlyAccess, wildcardDomains=$wildcardDomains, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1575,11 +2243,11 @@ constructor( return true } - return /* spotless:off */ other is ProjectInferencePipelineCreateParams && projectId == other.projectId && description == other.description && name == other.name && project == other.project && workspace == other.workspace && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is ProjectInferencePipelineCreateParams && projectId == other.projectId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(projectId, description, name, project, workspace, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(projectId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "ProjectInferencePipelineCreateParams{projectId=$projectId, description=$description, name=$name, project=$project, workspace=$workspace, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "ProjectInferencePipelineCreateParams{projectId=$projectId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt index 963a65e3..291f142d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt @@ -6,13 +6,14 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.Enum import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.LocalDate @@ -20,80 +21,99 @@ import java.time.OffsetDateTime import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = ProjectInferencePipelineCreateResponse.Builder::class) @NoAutoDetect class ProjectInferencePipelineCreateResponse +@JsonCreator private constructor( - private val id: JsonField, - private val projectId: JsonField, - private val workspaceId: JsonField, - private val project: JsonField, - private val workspace: JsonField, - private val name: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val dateLastSampleReceived: JsonField, - private val description: JsonField, - private val dateLastEvaluated: JsonField, - private val dateOfNextEvaluation: JsonField, - private val passingGoalCount: JsonField, - private val failingGoalCount: JsonField, - private val totalGoalCount: JsonField, - private val status: JsonField, - private val statusMessage: JsonField, - private val links: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + private val dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastSampleReceived") + @ExcludeMissing + private val dateLastSampleReceived: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + private val dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("failingGoalCount") + @ExcludeMissing + private val failingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing private val links: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), + @JsonProperty("passingGoalCount") + @ExcludeMissing + private val passingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + private val projectId: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + private val statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("totalGoalCount") + @ExcludeMissing + private val totalGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("project") + @ExcludeMissing + private val project: JsonField = JsonMissing.of(), + @JsonProperty("workspace") + @ExcludeMissing + private val workspace: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + private val workspaceId: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The inference pipeline id. */ fun id(): String = id.getRequired("id") - /** The project id. */ - fun projectId(): String = projectId.getRequired("projectId") - - /** The workspace id. */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) - - fun project(): Optional = Optional.ofNullable(project.getNullable("project")) - - fun workspace(): Optional = Optional.ofNullable(workspace.getNullable("workspace")) - - /** The inference pipeline name. */ - fun name(): String = name.getRequired("name") - /** The creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The last updated date. */ - fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** The last test evaluation date. */ + fun dateLastEvaluated(): Optional = + Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) /** The last data sample received date. */ fun dateLastSampleReceived(): Optional = Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + /** The next test evaluation date. */ + fun dateOfNextEvaluation(): Optional = + Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + + /** The last updated date. */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** The inference pipeline description. */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** The last test evaluation date. */ - fun dateLastEvaluated(): Optional = - Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + /** The number of tests failing. */ + fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") - /** The next test evaluation date. */ - fun dateOfNextEvaluation(): Optional = - Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + fun links(): Links = links.getRequired("links") + + /** The inference pipeline name. */ + fun name(): String = name.getRequired("name") /** The number of tests passing. */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") - /** The number of tests failing. */ - fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") - - /** The total number of tests. */ - fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") + /** The project id. */ + fun projectId(): String = projectId.getRequired("projectId") /** The status of test evaluation for the inference pipeline. */ fun status(): Status = status.getRequired("status") @@ -102,89 +122,116 @@ private constructor( fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) - fun links(): Links = links.getRequired("links") + /** The total number of tests. */ + fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") - /** The inference pipeline id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun project(): Optional = Optional.ofNullable(project.getNullable("project")) - /** The project id. */ - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + fun workspace(): Optional = Optional.ofNullable(workspace.getNullable("workspace")) /** The workspace id. */ - @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId() = workspaceId - - @JsonProperty("project") @ExcludeMissing fun _project() = project - - @JsonProperty("workspace") @ExcludeMissing fun _workspace() = workspace + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The inference pipeline name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + /** The inference pipeline id. */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated - /** The last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + /** The last test evaluation date. */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun _dateLastEvaluated(): JsonField = dateLastEvaluated /** The last data sample received date. */ @JsonProperty("dateLastSampleReceived") @ExcludeMissing - fun _dateLastSampleReceived() = dateLastSampleReceived - - /** The inference pipeline description. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description - - /** The last test evaluation date. */ - @JsonProperty("dateLastEvaluated") @ExcludeMissing fun _dateLastEvaluated() = dateLastEvaluated + fun _dateLastSampleReceived(): JsonField = dateLastSampleReceived /** The next test evaluation date. */ @JsonProperty("dateOfNextEvaluation") @ExcludeMissing - fun _dateOfNextEvaluation() = dateOfNextEvaluation + fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation - /** The number of tests passing. */ - @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount + /** The last updated date. */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** The inference pipeline description. */ + @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description /** The number of tests failing. */ - @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount + @JsonProperty("failingGoalCount") + @ExcludeMissing + fun _failingGoalCount(): JsonField = failingGoalCount - /** The total number of tests. */ - @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links + + /** The inference pipeline name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** The number of tests passing. */ + @JsonProperty("passingGoalCount") + @ExcludeMissing + fun _passingGoalCount(): JsonField = passingGoalCount + + /** The project id. */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId /** The status of test evaluation for the inference pipeline. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status /** The status message of test evaluation for the inference pipeline. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + + /** The total number of tests. */ + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun _totalGoalCount(): JsonField = totalGoalCount + + @JsonProperty("project") @ExcludeMissing fun _project(): JsonField = project - @JsonProperty("links") @ExcludeMissing fun _links() = links + @JsonProperty("workspace") @ExcludeMissing fun _workspace(): JsonField = workspace + + /** The workspace id. */ + @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): ProjectInferencePipelineCreateResponse = apply { - if (!validated) { - id() - projectId() - workspaceId() - project().map { it.validate() } - workspace().map { it.validate() } - name() - dateCreated() - dateUpdated() - dateLastSampleReceived() - description() - dateLastEvaluated() - dateOfNextEvaluation() - passingGoalCount() - failingGoalCount() - totalGoalCount() - status() - statusMessage() - links().validate() - validated = true + if (validated) { + return@apply } + + id() + dateCreated() + dateLastEvaluated() + dateLastSampleReceived() + dateOfNextEvaluation() + dateUpdated() + description() + failingGoalCount() + links().validate() + name() + passingGoalCount() + projectId() + status() + statusMessage() + totalGoalCount() + project().ifPresent { it.validate() } + workspace().ifPresent { it.validate() } + workspaceId() + validated = true } fun toBuilder() = Builder().from(this) @@ -196,272 +243,270 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var projectId: JsonField = JsonMissing.of() - private var workspaceId: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateLastEvaluated: JsonField? = null + private var dateLastSampleReceived: JsonField? = null + private var dateOfNextEvaluation: JsonField? = null + private var dateUpdated: JsonField? = null + private var description: JsonField? = null + private var failingGoalCount: JsonField? = null + private var links: JsonField? = null + private var name: JsonField? = null + private var passingGoalCount: JsonField? = null + private var projectId: JsonField? = null + private var status: JsonField? = null + private var statusMessage: JsonField? = null + private var totalGoalCount: JsonField? = null private var project: JsonField = JsonMissing.of() private var workspace: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() - private var dateLastSampleReceived: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() - private var dateLastEvaluated: JsonField = JsonMissing.of() - private var dateOfNextEvaluation: JsonField = JsonMissing.of() - private var passingGoalCount: JsonField = JsonMissing.of() - private var failingGoalCount: JsonField = JsonMissing.of() - private var totalGoalCount: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var statusMessage: JsonField = JsonMissing.of() - private var links: JsonField = JsonMissing.of() + private var workspaceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( projectInferencePipelineCreateResponse: ProjectInferencePipelineCreateResponse ) = apply { - this.id = projectInferencePipelineCreateResponse.id - this.projectId = projectInferencePipelineCreateResponse.projectId - this.workspaceId = projectInferencePipelineCreateResponse.workspaceId - this.project = projectInferencePipelineCreateResponse.project - this.workspace = projectInferencePipelineCreateResponse.workspace - this.name = projectInferencePipelineCreateResponse.name - this.dateCreated = projectInferencePipelineCreateResponse.dateCreated - this.dateUpdated = projectInferencePipelineCreateResponse.dateUpdated - this.dateLastSampleReceived = - projectInferencePipelineCreateResponse.dateLastSampleReceived - this.description = projectInferencePipelineCreateResponse.description - this.dateLastEvaluated = projectInferencePipelineCreateResponse.dateLastEvaluated - this.dateOfNextEvaluation = projectInferencePipelineCreateResponse.dateOfNextEvaluation - this.passingGoalCount = projectInferencePipelineCreateResponse.passingGoalCount - this.failingGoalCount = projectInferencePipelineCreateResponse.failingGoalCount - this.totalGoalCount = projectInferencePipelineCreateResponse.totalGoalCount - this.status = projectInferencePipelineCreateResponse.status - this.statusMessage = projectInferencePipelineCreateResponse.statusMessage - this.links = projectInferencePipelineCreateResponse.links - additionalProperties(projectInferencePipelineCreateResponse.additionalProperties) + id = projectInferencePipelineCreateResponse.id + dateCreated = projectInferencePipelineCreateResponse.dateCreated + dateLastEvaluated = projectInferencePipelineCreateResponse.dateLastEvaluated + dateLastSampleReceived = projectInferencePipelineCreateResponse.dateLastSampleReceived + dateOfNextEvaluation = projectInferencePipelineCreateResponse.dateOfNextEvaluation + dateUpdated = projectInferencePipelineCreateResponse.dateUpdated + description = projectInferencePipelineCreateResponse.description + failingGoalCount = projectInferencePipelineCreateResponse.failingGoalCount + links = projectInferencePipelineCreateResponse.links + name = projectInferencePipelineCreateResponse.name + passingGoalCount = projectInferencePipelineCreateResponse.passingGoalCount + projectId = projectInferencePipelineCreateResponse.projectId + status = projectInferencePipelineCreateResponse.status + statusMessage = projectInferencePipelineCreateResponse.statusMessage + totalGoalCount = projectInferencePipelineCreateResponse.totalGoalCount + project = projectInferencePipelineCreateResponse.project + workspace = projectInferencePipelineCreateResponse.workspace + workspaceId = projectInferencePipelineCreateResponse.workspaceId + additionalProperties = + projectInferencePipelineCreateResponse.additionalProperties.toMutableMap() } /** The inference pipeline id. */ fun id(id: String) = id(JsonField.of(id)) /** The inference pipeline id. */ - @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + fun id(id: JsonField) = apply { this.id = id } - /** The project id. */ - fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - - /** The project id. */ - @JsonProperty("projectId") - @ExcludeMissing - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The workspace id. */ - fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + /** The creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } - /** The workspace id. */ - @JsonProperty("workspaceId") - @ExcludeMissing - fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = + dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) - fun project(project: Project) = project(JsonField.of(project)) + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: Optional) = + dateLastEvaluated(dateLastEvaluated.orElse(null)) - @JsonProperty("project") - @ExcludeMissing - fun project(project: JsonField) = apply { this.project = project } + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } - fun workspace(workspace: Workspace) = workspace(JsonField.of(workspace)) + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime?) = + dateLastSampleReceived(JsonField.ofNullable(dateLastSampleReceived)) - @JsonProperty("workspace") - @ExcludeMissing - fun workspace(workspace: JsonField) = apply { this.workspace = workspace } + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: Optional) = + dateLastSampleReceived(dateLastSampleReceived.orElse(null)) - /** The inference pipeline name. */ - fun name(name: String) = name(JsonField.of(name)) + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { + this.dateLastSampleReceived = dateLastSampleReceived + } - /** The inference pipeline name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = + dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) - /** The creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = + dateOfNextEvaluation(dateOfNextEvaluation.orElse(null)) - /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun dateCreated(dateCreated: JsonField) = apply { - this.dateCreated = dateCreated + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation } /** The last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - /** The last data sample received date. */ - fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime) = - dateLastSampleReceived(JsonField.of(dateLastSampleReceived)) - - /** The last data sample received date. */ - @JsonProperty("dateLastSampleReceived") - @ExcludeMissing - fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { - this.dateLastSampleReceived = dateLastSampleReceived - } + /** The inference pipeline description. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) /** The inference pipeline description. */ - fun description(description: String) = description(JsonField.of(description)) + fun description(description: Optional) = description(description.orElse(null)) /** The inference pipeline description. */ - @JsonProperty("description") - @ExcludeMissing fun description(description: JsonField) = apply { this.description = description } - /** The last test evaluation date. */ - fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime) = - dateLastEvaluated(JsonField.of(dateLastEvaluated)) + /** The number of tests failing. */ + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) - /** The last test evaluation date. */ - @JsonProperty("dateLastEvaluated") - @ExcludeMissing - fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { - this.dateLastEvaluated = dateLastEvaluated + /** The number of tests failing. */ + fun failingGoalCount(failingGoalCount: JsonField) = apply { + this.failingGoalCount = failingGoalCount } - /** The next test evaluation date. */ - fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = - dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) + fun links(links: Links) = links(JsonField.of(links)) - /** The next test evaluation date. */ - @JsonProperty("dateOfNextEvaluation") - @ExcludeMissing - fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { - this.dateOfNextEvaluation = dateOfNextEvaluation - } + fun links(links: JsonField) = apply { this.links = links } + + /** The inference pipeline name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The inference pipeline name. */ + fun name(name: JsonField) = apply { this.name = name } /** The number of tests passing. */ fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) /** The number of tests passing. */ - @JsonProperty("passingGoalCount") - @ExcludeMissing fun passingGoalCount(passingGoalCount: JsonField) = apply { this.passingGoalCount = passingGoalCount } - /** The number of tests failing. */ - fun failingGoalCount(failingGoalCount: Long) = - failingGoalCount(JsonField.of(failingGoalCount)) - - /** The number of tests failing. */ - @JsonProperty("failingGoalCount") - @ExcludeMissing - fun failingGoalCount(failingGoalCount: JsonField) = apply { - this.failingGoalCount = failingGoalCount - } - - /** The total number of tests. */ - fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) + /** The project id. */ + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** The total number of tests. */ - @JsonProperty("totalGoalCount") - @ExcludeMissing - fun totalGoalCount(totalGoalCount: JsonField) = apply { - this.totalGoalCount = totalGoalCount - } + /** The project id. */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** The status of test evaluation for the inference pipeline. */ fun status(status: Status) = status(JsonField.of(status)) /** The status of test evaluation for the inference pipeline. */ - @JsonProperty("status") - @ExcludeMissing fun status(status: JsonField) = apply { this.status = status } /** The status message of test evaluation for the inference pipeline. */ - fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** The status message of test evaluation for the inference pipeline. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.orElse(null)) /** The status message of test evaluation for the inference pipeline. */ - @JsonProperty("statusMessage") - @ExcludeMissing fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } - fun links(links: Links) = links(JsonField.of(links)) + /** The total number of tests. */ + fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - @JsonProperty("links") - @ExcludeMissing - fun links(links: JsonField) = apply { this.links = links } + /** The total number of tests. */ + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount + } + + fun project(project: Project?) = project(JsonField.ofNullable(project)) + + fun project(project: Optional) = project(project.orElse(null)) + + fun project(project: JsonField) = apply { this.project = project } + + fun workspace(workspace: Workspace?) = workspace(JsonField.ofNullable(workspace)) + + fun workspace(workspace: Optional) = workspace(workspace.orElse(null)) + + fun workspace(workspace: JsonField) = apply { this.workspace = workspace } + + /** The workspace id. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** The workspace id. */ + fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): ProjectInferencePipelineCreateResponse = ProjectInferencePipelineCreateResponse( - id, - projectId, - workspaceId, + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateLastEvaluated", dateLastEvaluated), + checkRequired("dateLastSampleReceived", dateLastSampleReceived), + checkRequired("dateOfNextEvaluation", dateOfNextEvaluation), + checkRequired("dateUpdated", dateUpdated), + checkRequired("description", description), + checkRequired("failingGoalCount", failingGoalCount), + checkRequired("links", links), + checkRequired("name", name), + checkRequired("passingGoalCount", passingGoalCount), + checkRequired("projectId", projectId), + checkRequired("status", status), + checkRequired("statusMessage", statusMessage), + checkRequired("totalGoalCount", totalGoalCount), project, workspace, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - status, - statusMessage, - links, + workspaceId, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect class Links + @JsonCreator private constructor( - private val app: JsonField, - private val additionalProperties: Map, + @JsonProperty("app") @ExcludeMissing private val app: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun app(): String = app.getRequired("app") - @JsonProperty("app") @ExcludeMissing fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Links = apply { - if (!validated) { - app() - validated = true + if (validated) { + return@apply } + + app() + validated = true } fun toBuilder() = Builder().from(this) @@ -473,36 +518,40 @@ private constructor( class Builder { - private var app: JsonField = JsonMissing.of() + private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) + app = links.app + additionalProperties = links.additionalProperties.toMutableMap() } fun app(app: String) = app(JsonField.of(app)) - @JsonProperty("app") - @ExcludeMissing fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toImmutable()) + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Links = + Links(checkRequired("app", app), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -522,6 +571,7 @@ private constructor( override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } + /** The status of test evaluation for the inference pipeline. */ class Status @JsonCreator private constructor( @@ -603,53 +653,90 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = Project.Builder::class) @NoAutoDetect class Project + @JsonCreator private constructor( - private val id: JsonField, - private val workspaceId: JsonField, - private val creatorId: JsonField, - private val name: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val description: JsonField, - private val source: JsonField, - private val taskType: JsonField, - private val versionCount: JsonField, - private val inferencePipelineCount: JsonField, - private val goalCount: JsonField, - private val developmentGoalCount: JsonField, - private val monitoringGoalCount: JsonField, - private val links: JsonField, - private val gitRepo: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + private val creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("developmentGoalCount") + @ExcludeMissing + private val developmentGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("goalCount") + @ExcludeMissing + private val goalCount: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + private val inferencePipelineCount: JsonField = JsonMissing.of(), + @JsonProperty("links") + @ExcludeMissing + private val links: JsonField = JsonMissing.of(), + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + private val monitoringGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("source") + @ExcludeMissing + private val source: JsonField = JsonMissing.of(), + @JsonProperty("taskType") + @ExcludeMissing + private val taskType: JsonField = JsonMissing.of(), + @JsonProperty("versionCount") + @ExcludeMissing + private val versionCount: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + private val workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("gitRepo") + @ExcludeMissing + private val gitRepo: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The project id. */ fun id(): String = id.getRequired("id") - /** The workspace id. */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The project creator id. */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The project name. */ - fun name(): String = name.getRequired("name") - /** The project creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") /** The project last updated date. */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The project description. */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") + + /** The total number of tests in the project. */ + fun goalCount(): Long = goalCount.getRequired("goalCount") + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(): Long = + inferencePipelineCount.getRequired("inferencePipelineCount") + + /** Links to the project. */ + fun links(): Links = links.getRequired("links") + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") + + /** The project name. */ + fun name(): String = name.getRequired("name") /** The source of the project. */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) @@ -660,101 +747,107 @@ private constructor( /** The number of versions (commits) in the project. */ fun versionCount(): Long = versionCount.getRequired("versionCount") - /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(): Long = - inferencePipelineCount.getRequired("inferencePipelineCount") - - /** The total number of tests in the project. */ - fun goalCount(): Long = goalCount.getRequired("goalCount") - - /** The number of tests in the development mode of the project. */ - fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") - - /** The number of tests in the monitoring mode of the project. */ - fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") + /** The workspace id. */ + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** Links to the project. */ - fun links(): Links = links.getRequired("links") + /** The project description. */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) /** The project id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id - - /** The workspace id. */ - @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId() = workspaceId + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The project creator id. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId - - /** The project name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId /** The project creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated /** The project last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated - - /** The project description. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description - - /** The source of the project. */ - @JsonProperty("source") @ExcludeMissing fun _source() = source + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - /** The task type of the project. */ - @JsonProperty("taskType") @ExcludeMissing fun _taskType() = taskType + /** The number of tests in the development mode of the project. */ + @JsonProperty("developmentGoalCount") + @ExcludeMissing + fun _developmentGoalCount(): JsonField = developmentGoalCount - /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") @ExcludeMissing fun _versionCount() = versionCount + /** The total number of tests in the project. */ + @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount /** The number of inference pipelines in the project. */ @JsonProperty("inferencePipelineCount") @ExcludeMissing - fun _inferencePipelineCount() = inferencePipelineCount - - /** The total number of tests in the project. */ - @JsonProperty("goalCount") @ExcludeMissing fun _goalCount() = goalCount + fun _inferencePipelineCount(): JsonField = inferencePipelineCount - /** The number of tests in the development mode of the project. */ - @JsonProperty("developmentGoalCount") - @ExcludeMissing - fun _developmentGoalCount() = developmentGoalCount + /** Links to the project. */ + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links /** The number of tests in the monitoring mode of the project. */ @JsonProperty("monitoringGoalCount") @ExcludeMissing - fun _monitoringGoalCount() = monitoringGoalCount + fun _monitoringGoalCount(): JsonField = monitoringGoalCount - /** Links to the project. */ - @JsonProperty("links") @ExcludeMissing fun _links() = links + /** The project name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** The source of the project. */ + @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source + + /** The task type of the project. */ + @JsonProperty("taskType") @ExcludeMissing fun _taskType(): JsonField = taskType - @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo() = gitRepo + /** The number of versions (commits) in the project. */ + @JsonProperty("versionCount") + @ExcludeMissing + fun _versionCount(): JsonField = versionCount + + /** The workspace id. */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** The project description. */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Project = apply { - if (!validated) { - id() - workspaceId() - creatorId() - name() - dateCreated() - dateUpdated() - description() - source() - taskType() - versionCount() - inferencePipelineCount() - goalCount() - developmentGoalCount() - monitoringGoalCount() - links().validate() - gitRepo().map { it.validate() } - validated = true + if (validated) { + return@apply } + + id() + creatorId() + dateCreated() + dateUpdated() + developmentGoalCount() + goalCount() + inferencePipelineCount() + links().validate() + monitoringGoalCount() + name() + source() + taskType() + versionCount() + workspaceId() + description() + gitRepo().ifPresent { it.validate() } + validated = true } fun toBuilder() = Builder().from(this) @@ -766,85 +859,64 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var workspaceId: JsonField = JsonMissing.of() - private var creatorId: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var developmentGoalCount: JsonField? = null + private var goalCount: JsonField? = null + private var inferencePipelineCount: JsonField? = null + private var links: JsonField? = null + private var monitoringGoalCount: JsonField? = null + private var name: JsonField? = null + private var source: JsonField? = null + private var taskType: JsonField? = null + private var versionCount: JsonField? = null + private var workspaceId: JsonField? = null private var description: JsonField = JsonMissing.of() - private var source: JsonField = JsonMissing.of() - private var taskType: JsonField = JsonMissing.of() - private var versionCount: JsonField = JsonMissing.of() - private var inferencePipelineCount: JsonField = JsonMissing.of() - private var goalCount: JsonField = JsonMissing.of() - private var developmentGoalCount: JsonField = JsonMissing.of() - private var monitoringGoalCount: JsonField = JsonMissing.of() - private var links: JsonField = JsonMissing.of() private var gitRepo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(project: Project) = apply { - this.id = project.id - this.workspaceId = project.workspaceId - this.creatorId = project.creatorId - this.name = project.name - this.dateCreated = project.dateCreated - this.dateUpdated = project.dateUpdated - this.description = project.description - this.source = project.source - this.taskType = project.taskType - this.versionCount = project.versionCount - this.inferencePipelineCount = project.inferencePipelineCount - this.goalCount = project.goalCount - this.developmentGoalCount = project.developmentGoalCount - this.monitoringGoalCount = project.monitoringGoalCount - this.links = project.links - this.gitRepo = project.gitRepo - additionalProperties(project.additionalProperties) + id = project.id + creatorId = project.creatorId + dateCreated = project.dateCreated + dateUpdated = project.dateUpdated + developmentGoalCount = project.developmentGoalCount + goalCount = project.goalCount + inferencePipelineCount = project.inferencePipelineCount + links = project.links + monitoringGoalCount = project.monitoringGoalCount + name = project.name + source = project.source + taskType = project.taskType + versionCount = project.versionCount + workspaceId = project.workspaceId + description = project.description + gitRepo = project.gitRepo + additionalProperties = project.additionalProperties.toMutableMap() } /** The project id. */ fun id(id: String) = id(JsonField.of(id)) /** The project id. */ - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - /** The workspace id. */ - fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) - - /** The workspace id. */ - @JsonProperty("workspaceId") - @ExcludeMissing - fun workspaceId(workspaceId: JsonField) = apply { - this.workspaceId = workspaceId - } + /** The project creator id. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The project creator id. */ - fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) /** The project creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } - /** The project name. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The project name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) /** The project creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -853,163 +925,176 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) /** The project last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - /** The project description. */ - fun description(description: String) = description(JsonField.of(description)) + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: Long) = + developmentGoalCount(JsonField.of(developmentGoalCount)) - /** The project description. */ - @JsonProperty("description") - @ExcludeMissing - fun description(description: JsonField) = apply { - this.description = description + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: JsonField) = apply { + this.developmentGoalCount = developmentGoalCount + } + + /** The total number of tests in the project. */ + fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) + + /** The total number of tests in the project. */ + fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(inferencePipelineCount: Long) = + inferencePipelineCount(JsonField.of(inferencePipelineCount)) + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { + this.inferencePipelineCount = inferencePipelineCount } + /** Links to the project. */ + fun links(links: Links) = links(JsonField.of(links)) + + /** Links to the project. */ + fun links(links: JsonField) = apply { this.links = links } + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(monitoringGoalCount: Long) = + monitoringGoalCount(JsonField.of(monitoringGoalCount)) + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { + this.monitoringGoalCount = monitoringGoalCount + } + + /** The project name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The project name. */ + fun name(name: JsonField) = apply { this.name = name } + /** The source of the project. */ - fun source(source: Source) = source(JsonField.of(source)) + fun source(source: Source?) = source(JsonField.ofNullable(source)) + + /** The source of the project. */ + fun source(source: Optional) = source(source.orElse(null)) /** The source of the project. */ - @JsonProperty("source") - @ExcludeMissing fun source(source: JsonField) = apply { this.source = source } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) /** The task type of the project. */ - @JsonProperty("taskType") - @ExcludeMissing fun taskType(taskType: JsonField) = apply { this.taskType = taskType } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") - @ExcludeMissing fun versionCount(versionCount: JsonField) = apply { this.versionCount = versionCount } - /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(inferencePipelineCount: Long) = - inferencePipelineCount(JsonField.of(inferencePipelineCount)) - - /** The number of inference pipelines in the project. */ - @JsonProperty("inferencePipelineCount") - @ExcludeMissing - fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { - this.inferencePipelineCount = inferencePipelineCount - } - - /** The total number of tests in the project. */ - fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) - - /** The total number of tests in the project. */ - @JsonProperty("goalCount") - @ExcludeMissing - fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } + /** The workspace id. */ + fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) - /** The number of tests in the development mode of the project. */ - fun developmentGoalCount(developmentGoalCount: Long) = - developmentGoalCount(JsonField.of(developmentGoalCount)) + /** The workspace id. */ + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.orElse(null)) - /** The number of tests in the development mode of the project. */ - @JsonProperty("developmentGoalCount") - @ExcludeMissing - fun developmentGoalCount(developmentGoalCount: JsonField) = apply { - this.developmentGoalCount = developmentGoalCount + /** The workspace id. */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId } - /** The number of tests in the monitoring mode of the project. */ - fun monitoringGoalCount(monitoringGoalCount: Long) = - monitoringGoalCount(JsonField.of(monitoringGoalCount)) + /** The project description. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) - /** The number of tests in the monitoring mode of the project. */ - @JsonProperty("monitoringGoalCount") - @ExcludeMissing - fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { - this.monitoringGoalCount = monitoringGoalCount - } + /** The project description. */ + fun description(description: Optional) = description(description.orElse(null)) - /** Links to the project. */ - fun links(links: Links) = links(JsonField.of(links)) + /** The project description. */ + fun description(description: JsonField) = apply { + this.description = description + } - /** Links to the project. */ - @JsonProperty("links") - @ExcludeMissing - fun links(links: JsonField) = apply { this.links = links } + fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) - fun gitRepo(gitRepo: GitRepo) = gitRepo(JsonField.of(gitRepo)) + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.orElse(null)) - @JsonProperty("gitRepo") - @ExcludeMissing fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Project = Project( - id, - workspaceId, - creatorId, - name, - dateCreated, - dateUpdated, + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("developmentGoalCount", developmentGoalCount), + checkRequired("goalCount", goalCount), + checkRequired("inferencePipelineCount", inferencePipelineCount), + checkRequired("links", links), + checkRequired("monitoringGoalCount", monitoringGoalCount), + checkRequired("name", name), + checkRequired("source", source), + checkRequired("taskType", taskType), + checkRequired("versionCount", versionCount), + checkRequired("workspaceId", workspaceId), description, - source, - taskType, - versionCount, - inferencePipelineCount, - goalCount, - developmentGoalCount, - monitoringGoalCount, - links, gitRepo, additionalProperties.toImmutable(), ) } /** Links to the project. */ - @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect class Links + @JsonCreator private constructor( - private val app: JsonField, - private val additionalProperties: Map, + @JsonProperty("app") + @ExcludeMissing + private val app: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun app(): String = app.getRequired("app") - @JsonProperty("app") @ExcludeMissing fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Links = apply { - if (!validated) { - app() - validated = true + if (validated) { + return@apply } + + app() + validated = true } fun toBuilder() = Builder().from(this) @@ -1021,29 +1106,26 @@ private constructor( class Builder { - private var app: JsonField = JsonMissing.of() + private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) + app = links.app + additionalProperties = links.additionalProperties.toMutableMap() } fun app(app: String) = app(JsonField.of(app)) - @JsonProperty("app") - @ExcludeMissing fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1051,7 +1133,16 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toImmutable()) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Links = + Links(checkRequired("app", app), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -1071,6 +1162,7 @@ private constructor( override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } + /** The source of the project. */ class Source @JsonCreator private constructor( @@ -1134,6 +1226,7 @@ private constructor( override fun toString() = value.toString() } + /** The task type of the project. */ class TaskType @JsonCreator private constructor( @@ -1203,95 +1296,130 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = GitRepo.Builder::class) @NoAutoDetect class GitRepo + @JsonCreator private constructor( - private val id: JsonField, - private val gitId: JsonField, - private val dateConnected: JsonField, - private val dateUpdated: JsonField, - private val branch: JsonField, - private val name: JsonField, - private val private_: JsonField, - private val slug: JsonField, - private val url: JsonField, - private val rootDir: JsonField, - private val projectId: JsonField, - private val gitAccountId: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("dateConnected") + @ExcludeMissing + private val dateConnected: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("gitAccountId") + @ExcludeMissing + private val gitAccountId: JsonField = JsonMissing.of(), + @JsonProperty("gitId") + @ExcludeMissing + private val gitId: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("private") + @ExcludeMissing + private val private_: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + private val projectId: JsonField = JsonMissing.of(), + @JsonProperty("slug") + @ExcludeMissing + private val slug: JsonField = JsonMissing.of(), + @JsonProperty("url") + @ExcludeMissing + private val url: JsonField = JsonMissing.of(), + @JsonProperty("branch") + @ExcludeMissing + private val branch: JsonField = JsonMissing.of(), + @JsonProperty("rootDir") + @ExcludeMissing + private val rootDir: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): String = id.getRequired("id") - fun gitId(): Long = gitId.getRequired("gitId") - fun dateConnected(): OffsetDateTime = dateConnected.getRequired("dateConnected") fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + + fun gitId(): Long = gitId.getRequired("gitId") fun name(): String = name.getRequired("name") fun private_(): Boolean = private_.getRequired("private") + fun projectId(): String = projectId.getRequired("projectId") + fun slug(): String = slug.getRequired("slug") fun url(): String = url.getRequired("url") - fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) - - fun projectId(): String = projectId.getRequired("projectId") + fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) - fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - @JsonProperty("gitId") @ExcludeMissing fun _gitId() = gitId + @JsonProperty("dateConnected") + @ExcludeMissing + fun _dateConnected(): JsonField = dateConnected - @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected() = dateConnected + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("gitAccountId") + @ExcludeMissing + fun _gitAccountId(): JsonField = gitAccountId - @JsonProperty("branch") @ExcludeMissing fun _branch() = branch + @JsonProperty("gitId") @ExcludeMissing fun _gitId(): JsonField = gitId - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - @JsonProperty("private") @ExcludeMissing fun _private_() = private_ + @JsonProperty("private") @ExcludeMissing fun _private_(): JsonField = private_ - @JsonProperty("slug") @ExcludeMissing fun _slug() = slug + @JsonProperty("projectId") + @ExcludeMissing + fun _projectId(): JsonField = projectId - @JsonProperty("url") @ExcludeMissing fun _url() = url + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - @JsonProperty("rootDir") @ExcludeMissing fun _rootDir() = rootDir + @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch - @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId() = gitAccountId + @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): GitRepo = apply { - if (!validated) { - id() - gitId() - dateConnected() - dateUpdated() - branch() - name() - private_() - slug() - url() - rootDir() - projectId() - gitAccountId() - validated = true + if (validated) { + return@apply } + + id() + dateConnected() + dateUpdated() + gitAccountId() + gitId() + name() + private_() + projectId() + slug() + url() + branch() + rootDir() + validated = true } fun toBuilder() = Builder().from(this) @@ -1303,54 +1431,44 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var gitId: JsonField = JsonMissing.of() - private var dateConnected: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var dateConnected: JsonField? = null + private var dateUpdated: JsonField? = null + private var gitAccountId: JsonField? = null + private var gitId: JsonField? = null + private var name: JsonField? = null + private var private_: JsonField? = null + private var projectId: JsonField? = null + private var slug: JsonField? = null + private var url: JsonField? = null private var branch: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var private_: JsonField = JsonMissing.of() - private var slug: JsonField = JsonMissing.of() - private var url: JsonField = JsonMissing.of() private var rootDir: JsonField = JsonMissing.of() - private var projectId: JsonField = JsonMissing.of() - private var gitAccountId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(gitRepo: GitRepo) = apply { - this.id = gitRepo.id - this.gitId = gitRepo.gitId - this.dateConnected = gitRepo.dateConnected - this.dateUpdated = gitRepo.dateUpdated - this.branch = gitRepo.branch - this.name = gitRepo.name - this.private_ = gitRepo.private_ - this.slug = gitRepo.slug - this.url = gitRepo.url - this.rootDir = gitRepo.rootDir - this.projectId = gitRepo.projectId - this.gitAccountId = gitRepo.gitAccountId - additionalProperties(gitRepo.additionalProperties) + id = gitRepo.id + dateConnected = gitRepo.dateConnected + dateUpdated = gitRepo.dateUpdated + gitAccountId = gitRepo.gitAccountId + gitId = gitRepo.gitId + name = gitRepo.name + private_ = gitRepo.private_ + projectId = gitRepo.projectId + slug = gitRepo.slug + url = gitRepo.url + branch = gitRepo.branch + rootDir = gitRepo.rootDir + additionalProperties = gitRepo.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) - - @JsonProperty("gitId") - @ExcludeMissing - fun gitId(gitId: JsonField) = apply { this.gitId = gitId } - fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) - @JsonProperty("dateConnected") - @ExcludeMissing fun dateConnected(dateConnected: JsonField) = apply { this.dateConnected = dateConnected } @@ -1358,70 +1476,55 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - fun branch(branch: String) = branch(JsonField.of(branch)) + fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) - @JsonProperty("branch") - @ExcludeMissing - fun branch(branch: JsonField) = apply { this.branch = branch } + fun gitAccountId(gitAccountId: JsonField) = apply { + this.gitAccountId = gitAccountId + } + + fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) + + fun gitId(gitId: JsonField) = apply { this.gitId = gitId } fun name(name: String) = name(JsonField.of(name)) - @JsonProperty("name") - @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } fun private_(private_: Boolean) = private_(JsonField.of(private_)) - @JsonProperty("private") - @ExcludeMissing fun private_(private_: JsonField) = apply { this.private_ = private_ } + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + fun slug(slug: String) = slug(JsonField.of(slug)) - @JsonProperty("slug") - @ExcludeMissing fun slug(slug: JsonField) = apply { this.slug = slug } fun url(url: String) = url(JsonField.of(url)) - @JsonProperty("url") - @ExcludeMissing fun url(url: JsonField) = apply { this.url = url } - fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) - - @JsonProperty("rootDir") - @ExcludeMissing - fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } - - fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + fun branch(branch: String) = branch(JsonField.of(branch)) - @JsonProperty("projectId") - @ExcludeMissing - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + fun branch(branch: JsonField) = apply { this.branch = branch } - fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) + fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) - @JsonProperty("gitAccountId") - @ExcludeMissing - fun gitAccountId(gitAccountId: JsonField) = apply { - this.gitAccountId = gitAccountId - } + fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1429,20 +1532,28 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): GitRepo = GitRepo( - id, - gitId, - dateConnected, - dateUpdated, + checkRequired("id", id), + checkRequired("dateConnected", dateConnected), + checkRequired("dateUpdated", dateUpdated), + checkRequired("gitAccountId", gitAccountId), + checkRequired("gitId", gitId), + checkRequired("name", name), + checkRequired("private_", private_), + checkRequired("projectId", projectId), + checkRequired("slug", slug), + checkRequired("url", url), branch, - name, - private_, - slug, - url, rootDir, - projectId, - gitAccountId, additionalProperties.toImmutable(), ) } @@ -1452,17 +1563,17 @@ private constructor( return true } - return /* spotless:off */ other is GitRepo && id == other.id && gitId == other.gitId && dateConnected == other.dateConnected && dateUpdated == other.dateUpdated && branch == other.branch && name == other.name && private_ == other.private_ && slug == other.slug && url == other.url && rootDir == other.rootDir && projectId == other.projectId && gitAccountId == other.gitAccountId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GitRepo && id == other.id && dateConnected == other.dateConnected && dateUpdated == other.dateUpdated && gitAccountId == other.gitAccountId && gitId == other.gitId && name == other.name && private_ == other.private_ && projectId == other.projectId && slug == other.slug && url == other.url && branch == other.branch && rootDir == other.rootDir && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, gitId, dateConnected, dateUpdated, branch, name, private_, slug, url, rootDir, projectId, gitAccountId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dateConnected, dateUpdated, gitAccountId, gitId, name, private_, projectId, slug, url, branch, rootDir, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GitRepo{id=$id, gitId=$gitId, dateConnected=$dateConnected, dateUpdated=$dateUpdated, branch=$branch, name=$name, private_=$private_, slug=$slug, url=$url, rootDir=$rootDir, projectId=$projectId, gitAccountId=$gitAccountId, additionalProperties=$additionalProperties}" + "GitRepo{id=$id, dateConnected=$dateConnected, dateUpdated=$dateUpdated, gitAccountId=$gitAccountId, gitId=$gitId, name=$name, private_=$private_, projectId=$projectId, slug=$slug, url=$url, branch=$branch, rootDir=$rootDir, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1470,52 +1581,78 @@ private constructor( return true } - return /* spotless:off */ other is Project && id == other.id && workspaceId == other.workspaceId && creatorId == other.creatorId && name == other.name && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && description == other.description && source == other.source && taskType == other.taskType && versionCount == other.versionCount && inferencePipelineCount == other.inferencePipelineCount && goalCount == other.goalCount && developmentGoalCount == other.developmentGoalCount && monitoringGoalCount == other.monitoringGoalCount && links == other.links && gitRepo == other.gitRepo && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Project && id == other.id && creatorId == other.creatorId && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && developmentGoalCount == other.developmentGoalCount && goalCount == other.goalCount && inferencePipelineCount == other.inferencePipelineCount && links == other.links && monitoringGoalCount == other.monitoringGoalCount && name == other.name && source == other.source && taskType == other.taskType && versionCount == other.versionCount && workspaceId == other.workspaceId && description == other.description && gitRepo == other.gitRepo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, workspaceId, creatorId, name, dateCreated, dateUpdated, description, source, taskType, versionCount, inferencePipelineCount, goalCount, developmentGoalCount, monitoringGoalCount, links, gitRepo, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, creatorId, dateCreated, dateUpdated, developmentGoalCount, goalCount, inferencePipelineCount, links, monitoringGoalCount, name, source, taskType, versionCount, workspaceId, description, gitRepo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Project{id=$id, workspaceId=$workspaceId, creatorId=$creatorId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, source=$source, taskType=$taskType, versionCount=$versionCount, inferencePipelineCount=$inferencePipelineCount, goalCount=$goalCount, developmentGoalCount=$developmentGoalCount, monitoringGoalCount=$monitoringGoalCount, links=$links, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" + "Project{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, developmentGoalCount=$developmentGoalCount, goalCount=$goalCount, inferencePipelineCount=$inferencePipelineCount, links=$links, monitoringGoalCount=$monitoringGoalCount, name=$name, source=$source, taskType=$taskType, versionCount=$versionCount, workspaceId=$workspaceId, description=$description, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Workspace.Builder::class) @NoAutoDetect class Workspace + @JsonCreator private constructor( - private val id: JsonField, - private val name: JsonField, - private val slug: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val creatorId: JsonField, - private val inviteCode: JsonField, - private val wildcardDomains: JsonField>, - private val projectCount: JsonField, - private val memberCount: JsonField, - private val monthlyUsage: JsonField>, - private val inviteCount: JsonField, - private val periodStartDate: JsonField, - private val periodEndDate: JsonField, - private val samlOnlyAccess: JsonField, - private val status: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + private val creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("inviteCount") + @ExcludeMissing + private val inviteCount: JsonField = JsonMissing.of(), + @JsonProperty("memberCount") + @ExcludeMissing + private val memberCount: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("periodEndDate") + @ExcludeMissing + private val periodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("periodStartDate") + @ExcludeMissing + private val periodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("projectCount") + @ExcludeMissing + private val projectCount: JsonField = JsonMissing.of(), + @JsonProperty("slug") + @ExcludeMissing + private val slug: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonProperty("inviteCode") + @ExcludeMissing + private val inviteCode: JsonField = JsonMissing.of(), + @JsonProperty("monthlyUsage") + @ExcludeMissing + private val monthlyUsage: JsonField> = JsonMissing.of(), + @JsonProperty("samlOnlyAccess") + @ExcludeMissing + private val samlOnlyAccess: JsonField = JsonMissing.of(), + @JsonProperty("wildcardDomains") + @ExcludeMissing + private val wildcardDomains: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The workspace id. */ fun id(): String = id.getRequired("id") - /** The workspace name. */ - fun name(): String = name.getRequired("name") - - /** The workspace slug. */ - fun slug(): String = slug.getRequired("slug") + /** The workspace creator id. */ + fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) /** The workspace creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") @@ -1523,111 +1660,140 @@ private constructor( /** The workspace last updated date. */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The workspace creator id. */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - - /** The workspace invite code. */ - fun inviteCode(): Optional = - Optional.ofNullable(inviteCode.getNullable("inviteCode")) - - fun wildcardDomains(): Optional> = - Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) - - /** The number of projects in the workspace. */ - fun projectCount(): Long = projectCount.getRequired("projectCount") + /** The number of invites in the workspace. */ + fun inviteCount(): Long = inviteCount.getRequired("inviteCount") /** The number of members in the workspace. */ fun memberCount(): Long = memberCount.getRequired("memberCount") - fun monthlyUsage(): Optional> = - Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) + /** The workspace name. */ + fun name(): String = name.getRequired("name") - /** The number of invites in the workspace. */ - fun inviteCount(): Long = inviteCount.getRequired("inviteCount") + /** The end date of the current billing period. */ + fun periodEndDate(): Optional = + Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) /** The start date of the current billing period. */ fun periodStartDate(): Optional = Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) - /** The end date of the current billing period. */ - fun periodEndDate(): Optional = - Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) + /** The number of projects in the workspace. */ + fun projectCount(): Long = projectCount.getRequired("projectCount") + + /** The workspace slug. */ + fun slug(): String = slug.getRequired("slug") + + fun status(): Status = status.getRequired("status") + + /** The workspace invite code. */ + fun inviteCode(): Optional = + Optional.ofNullable(inviteCode.getNullable("inviteCode")) + + fun monthlyUsage(): Optional> = + Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) /** Whether the workspace only allows SAML authentication. */ fun samlOnlyAccess(): Optional = Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) - fun status(): Status = status.getRequired("status") + fun wildcardDomains(): Optional> = + Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) /** The workspace id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The workspace name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name - - /** The workspace slug. */ - @JsonProperty("slug") @ExcludeMissing fun _slug() = slug + /** The workspace creator id. */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId /** The workspace creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated /** The workspace last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - /** The workspace creator id. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + /** The number of invites in the workspace. */ + @JsonProperty("inviteCount") + @ExcludeMissing + fun _inviteCount(): JsonField = inviteCount - /** The workspace invite code. */ - @JsonProperty("inviteCode") @ExcludeMissing fun _inviteCode() = inviteCode + /** The number of members in the workspace. */ + @JsonProperty("memberCount") + @ExcludeMissing + fun _memberCount(): JsonField = memberCount - @JsonProperty("wildcardDomains") @ExcludeMissing fun _wildcardDomains() = wildcardDomains + /** The workspace name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The number of projects in the workspace. */ - @JsonProperty("projectCount") @ExcludeMissing fun _projectCount() = projectCount + /** The end date of the current billing period. */ + @JsonProperty("periodEndDate") + @ExcludeMissing + fun _periodEndDate(): JsonField = periodEndDate - /** The number of members in the workspace. */ - @JsonProperty("memberCount") @ExcludeMissing fun _memberCount() = memberCount + /** The start date of the current billing period. */ + @JsonProperty("periodStartDate") + @ExcludeMissing + fun _periodStartDate(): JsonField = periodStartDate - @JsonProperty("monthlyUsage") @ExcludeMissing fun _monthlyUsage() = monthlyUsage + /** The number of projects in the workspace. */ + @JsonProperty("projectCount") + @ExcludeMissing + fun _projectCount(): JsonField = projectCount - /** The number of invites in the workspace. */ - @JsonProperty("inviteCount") @ExcludeMissing fun _inviteCount() = inviteCount + /** The workspace slug. */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - /** The start date of the current billing period. */ - @JsonProperty("periodStartDate") @ExcludeMissing fun _periodStartDate() = periodStartDate + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The end date of the current billing period. */ - @JsonProperty("periodEndDate") @ExcludeMissing fun _periodEndDate() = periodEndDate + /** The workspace invite code. */ + @JsonProperty("inviteCode") + @ExcludeMissing + fun _inviteCode(): JsonField = inviteCode + + @JsonProperty("monthlyUsage") + @ExcludeMissing + fun _monthlyUsage(): JsonField> = monthlyUsage /** Whether the workspace only allows SAML authentication. */ - @JsonProperty("samlOnlyAccess") @ExcludeMissing fun _samlOnlyAccess() = samlOnlyAccess + @JsonProperty("samlOnlyAccess") + @ExcludeMissing + fun _samlOnlyAccess(): JsonField = samlOnlyAccess - @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonProperty("wildcardDomains") + @ExcludeMissing + fun _wildcardDomains(): JsonField> = wildcardDomains @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Workspace = apply { - if (!validated) { - id() - name() - slug() - dateCreated() - dateUpdated() - creatorId() - inviteCode() - wildcardDomains() - projectCount() - memberCount() - monthlyUsage().map { it.forEach { it.validate() } } - inviteCount() - periodStartDate() - periodEndDate() - samlOnlyAccess() - status() - validated = true + if (validated) { + return@apply } + + id() + creatorId() + dateCreated() + dateUpdated() + inviteCount() + memberCount() + name() + periodEndDate() + periodStartDate() + projectCount() + slug() + status() + inviteCode() + monthlyUsage().ifPresent { it.forEach { it.validate() } } + samlOnlyAccess() + wildcardDomains() + validated = true } fun toBuilder() = Builder().from(this) @@ -1639,75 +1805,64 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var slug: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() - private var creatorId: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var inviteCount: JsonField? = null + private var memberCount: JsonField? = null + private var name: JsonField? = null + private var periodEndDate: JsonField? = null + private var periodStartDate: JsonField? = null + private var projectCount: JsonField? = null + private var slug: JsonField? = null + private var status: JsonField? = null private var inviteCode: JsonField = JsonMissing.of() - private var wildcardDomains: JsonField> = JsonMissing.of() - private var projectCount: JsonField = JsonMissing.of() - private var memberCount: JsonField = JsonMissing.of() - private var monthlyUsage: JsonField> = JsonMissing.of() - private var inviteCount: JsonField = JsonMissing.of() - private var periodStartDate: JsonField = JsonMissing.of() - private var periodEndDate: JsonField = JsonMissing.of() + private var monthlyUsage: JsonField>? = null private var samlOnlyAccess: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() + private var wildcardDomains: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(workspace: Workspace) = apply { - this.id = workspace.id - this.name = workspace.name - this.slug = workspace.slug - this.dateCreated = workspace.dateCreated - this.dateUpdated = workspace.dateUpdated - this.creatorId = workspace.creatorId - this.inviteCode = workspace.inviteCode - this.wildcardDomains = workspace.wildcardDomains - this.projectCount = workspace.projectCount - this.memberCount = workspace.memberCount - this.monthlyUsage = workspace.monthlyUsage - this.inviteCount = workspace.inviteCount - this.periodStartDate = workspace.periodStartDate - this.periodEndDate = workspace.periodEndDate - this.samlOnlyAccess = workspace.samlOnlyAccess - this.status = workspace.status - additionalProperties(workspace.additionalProperties) + id = workspace.id + creatorId = workspace.creatorId + dateCreated = workspace.dateCreated + dateUpdated = workspace.dateUpdated + inviteCount = workspace.inviteCount + memberCount = workspace.memberCount + name = workspace.name + periodEndDate = workspace.periodEndDate + periodStartDate = workspace.periodStartDate + projectCount = workspace.projectCount + slug = workspace.slug + status = workspace.status + inviteCode = workspace.inviteCode + monthlyUsage = workspace.monthlyUsage.map { it.toMutableList() } + samlOnlyAccess = workspace.samlOnlyAccess + wildcardDomains = workspace.wildcardDomains.map { it.toMutableList() } + additionalProperties = workspace.additionalProperties.toMutableMap() } /** The workspace id. */ fun id(id: String) = id(JsonField.of(id)) /** The workspace id. */ - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - /** The workspace name. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The workspace name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + /** The workspace creator id. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The workspace slug. */ - fun slug(slug: String) = slug(JsonField.of(slug)) + /** The workspace creator id. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) - /** The workspace slug. */ - @JsonProperty("slug") - @ExcludeMissing - fun slug(slug: JsonField) = apply { this.slug = slug } + /** The workspace creator id. */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The workspace creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) /** The workspace creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -1716,92 +1871,96 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) /** The workspace last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - /** The workspace creator id. */ - fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) + /** The number of invites in the workspace. */ + fun inviteCount(inviteCount: Long) = inviteCount(JsonField.of(inviteCount)) - /** The workspace creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + /** The number of invites in the workspace. */ + fun inviteCount(inviteCount: JsonField) = apply { this.inviteCount = inviteCount } - /** The workspace invite code. */ - fun inviteCode(inviteCode: String) = inviteCode(JsonField.of(inviteCode)) + /** The number of members in the workspace. */ + fun memberCount(memberCount: Long) = memberCount(JsonField.of(memberCount)) - /** The workspace invite code. */ - @JsonProperty("inviteCode") - @ExcludeMissing - fun inviteCode(inviteCode: JsonField) = apply { this.inviteCode = inviteCode } + /** The number of members in the workspace. */ + fun memberCount(memberCount: JsonField) = apply { this.memberCount = memberCount } - fun wildcardDomains(wildcardDomains: List) = - wildcardDomains(JsonField.of(wildcardDomains)) + /** The workspace name. */ + fun name(name: String) = name(JsonField.of(name)) - @JsonProperty("wildcardDomains") - @ExcludeMissing - fun wildcardDomains(wildcardDomains: JsonField>) = apply { - this.wildcardDomains = wildcardDomains + /** The workspace name. */ + fun name(name: JsonField) = apply { this.name = name } + + /** The end date of the current billing period. */ + fun periodEndDate(periodEndDate: OffsetDateTime?) = + periodEndDate(JsonField.ofNullable(periodEndDate)) + + /** The end date of the current billing period. */ + fun periodEndDate(periodEndDate: Optional) = + periodEndDate(periodEndDate.orElse(null)) + + /** The end date of the current billing period. */ + fun periodEndDate(periodEndDate: JsonField) = apply { + this.periodEndDate = periodEndDate + } + + /** The start date of the current billing period. */ + fun periodStartDate(periodStartDate: OffsetDateTime?) = + periodStartDate(JsonField.ofNullable(periodStartDate)) + + /** The start date of the current billing period. */ + fun periodStartDate(periodStartDate: Optional) = + periodStartDate(periodStartDate.orElse(null)) + + /** The start date of the current billing period. */ + fun periodStartDate(periodStartDate: JsonField) = apply { + this.periodStartDate = periodStartDate } /** The number of projects in the workspace. */ fun projectCount(projectCount: Long) = projectCount(JsonField.of(projectCount)) /** The number of projects in the workspace. */ - @JsonProperty("projectCount") - @ExcludeMissing fun projectCount(projectCount: JsonField) = apply { this.projectCount = projectCount } - /** The number of members in the workspace. */ - fun memberCount(memberCount: Long) = memberCount(JsonField.of(memberCount)) + /** The workspace slug. */ + fun slug(slug: String) = slug(JsonField.of(slug)) - /** The number of members in the workspace. */ - @JsonProperty("memberCount") - @ExcludeMissing - fun memberCount(memberCount: JsonField) = apply { this.memberCount = memberCount } + /** The workspace slug. */ + fun slug(slug: JsonField) = apply { this.slug = slug } - fun monthlyUsage(monthlyUsage: List) = - monthlyUsage(JsonField.of(monthlyUsage)) + fun status(status: Status) = status(JsonField.of(status)) - @JsonProperty("monthlyUsage") - @ExcludeMissing - fun monthlyUsage(monthlyUsage: JsonField>) = apply { - this.monthlyUsage = monthlyUsage - } + fun status(status: JsonField) = apply { this.status = status } - /** The number of invites in the workspace. */ - fun inviteCount(inviteCount: Long) = inviteCount(JsonField.of(inviteCount)) + /** The workspace invite code. */ + fun inviteCode(inviteCode: String) = inviteCode(JsonField.of(inviteCode)) - /** The number of invites in the workspace. */ - @JsonProperty("inviteCount") - @ExcludeMissing - fun inviteCount(inviteCount: JsonField) = apply { this.inviteCount = inviteCount } + /** The workspace invite code. */ + fun inviteCode(inviteCode: JsonField) = apply { this.inviteCode = inviteCode } - /** The start date of the current billing period. */ - fun periodStartDate(periodStartDate: OffsetDateTime) = - periodStartDate(JsonField.of(periodStartDate)) + fun monthlyUsage(monthlyUsage: List) = + monthlyUsage(JsonField.of(monthlyUsage)) - /** The start date of the current billing period. */ - @JsonProperty("periodStartDate") - @ExcludeMissing - fun periodStartDate(periodStartDate: JsonField) = apply { - this.periodStartDate = periodStartDate + fun monthlyUsage(monthlyUsage: JsonField>) = apply { + this.monthlyUsage = monthlyUsage.map { it.toMutableList() } } - /** The end date of the current billing period. */ - fun periodEndDate(periodEndDate: OffsetDateTime) = - periodEndDate(JsonField.of(periodEndDate)) - - /** The end date of the current billing period. */ - @JsonProperty("periodEndDate") - @ExcludeMissing - fun periodEndDate(periodEndDate: JsonField) = apply { - this.periodEndDate = periodEndDate + fun addMonthlyUsage(monthlyUsage: MonthlyUsage) = apply { + this.monthlyUsage = + (this.monthlyUsage ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(monthlyUsage) + } } /** Whether the workspace only allows SAML authentication. */ @@ -1809,50 +1968,67 @@ private constructor( samlOnlyAccess(JsonField.of(samlOnlyAccess)) /** Whether the workspace only allows SAML authentication. */ - @JsonProperty("samlOnlyAccess") - @ExcludeMissing fun samlOnlyAccess(samlOnlyAccess: JsonField) = apply { this.samlOnlyAccess = samlOnlyAccess } - fun status(status: Status) = status(JsonField.of(status)) + fun wildcardDomains(wildcardDomains: List) = + wildcardDomains(JsonField.of(wildcardDomains)) - @JsonProperty("status") - @ExcludeMissing - fun status(status: JsonField) = apply { this.status = status } + fun wildcardDomains(wildcardDomains: JsonField>) = apply { + this.wildcardDomains = wildcardDomains.map { it.toMutableList() } + } + + fun addWildcardDomain(wildcardDomain: String) = apply { + wildcardDomains = + (wildcardDomains ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(wildcardDomain) + } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Workspace = Workspace( - id, - name, - slug, - dateCreated, - dateUpdated, - creatorId, + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("inviteCount", inviteCount), + checkRequired("memberCount", memberCount), + checkRequired("name", name), + checkRequired("periodEndDate", periodEndDate), + checkRequired("periodStartDate", periodStartDate), + checkRequired("projectCount", projectCount), + checkRequired("slug", slug), + checkRequired("status", status), inviteCode, - wildcardDomains.map { it.toImmutable() }, - projectCount, - memberCount, - monthlyUsage.map { it.toImmutable() }, - inviteCount, - periodStartDate, - periodEndDate, + (monthlyUsage ?: JsonMissing.of()).map { it.toImmutable() }, samlOnlyAccess, - status, + (wildcardDomains ?: JsonMissing.of()).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -1950,17 +2126,25 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = MonthlyUsage.Builder::class) @NoAutoDetect class MonthlyUsage + @JsonCreator private constructor( - private val monthYear: JsonField, - private val predictionCount: JsonField, - private val executionTimeMs: JsonField, - private val additionalProperties: Map, + @JsonProperty("executionTimeMs") + @ExcludeMissing + private val executionTimeMs: JsonField = JsonMissing.of(), + @JsonProperty("monthYear") + @ExcludeMissing + private val monthYear: JsonField = JsonMissing.of(), + @JsonProperty("predictionCount") + @ExcludeMissing + private val predictionCount: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + fun executionTimeMs(): Optional = + Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) fun monthYear(): Optional = Optional.ofNullable(monthYear.getNullable("monthYear")) @@ -1968,30 +2152,33 @@ private constructor( fun predictionCount(): Optional = Optional.ofNullable(predictionCount.getNullable("predictionCount")) - fun executionTimeMs(): Optional = - Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) - - @JsonProperty("monthYear") @ExcludeMissing fun _monthYear() = monthYear + @JsonProperty("executionTimeMs") + @ExcludeMissing + fun _executionTimeMs(): JsonField = executionTimeMs - @JsonProperty("predictionCount") + @JsonProperty("monthYear") @ExcludeMissing - fun _predictionCount() = predictionCount + fun _monthYear(): JsonField = monthYear - @JsonProperty("executionTimeMs") + @JsonProperty("predictionCount") @ExcludeMissing - fun _executionTimeMs() = executionTimeMs + fun _predictionCount(): JsonField = predictionCount @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): MonthlyUsage = apply { - if (!validated) { - monthYear() - predictionCount() - executionTimeMs() - validated = true + if (validated) { + return@apply } + + executionTimeMs() + monthYear() + predictionCount() + validated = true } fun toBuilder() = Builder().from(this) @@ -2003,23 +2190,35 @@ private constructor( class Builder { + private var executionTimeMs: JsonField = JsonMissing.of() private var monthYear: JsonField = JsonMissing.of() private var predictionCount: JsonField = JsonMissing.of() - private var executionTimeMs: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(monthlyUsage: MonthlyUsage) = apply { - this.monthYear = monthlyUsage.monthYear - this.predictionCount = monthlyUsage.predictionCount - this.executionTimeMs = monthlyUsage.executionTimeMs - additionalProperties(monthlyUsage.additionalProperties) + executionTimeMs = monthlyUsage.executionTimeMs + monthYear = monthlyUsage.monthYear + predictionCount = monthlyUsage.predictionCount + additionalProperties = monthlyUsage.additionalProperties.toMutableMap() + } + + fun executionTimeMs(executionTimeMs: Long?) = + executionTimeMs(JsonField.ofNullable(executionTimeMs)) + + fun executionTimeMs(executionTimeMs: Long) = + executionTimeMs(executionTimeMs as Long?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun executionTimeMs(executionTimeMs: Optional) = + executionTimeMs(executionTimeMs.orElse(null) as Long?) + + fun executionTimeMs(executionTimeMs: JsonField) = apply { + this.executionTimeMs = executionTimeMs } fun monthYear(monthYear: LocalDate) = monthYear(JsonField.of(monthYear)) - @JsonProperty("monthYear") - @ExcludeMissing fun monthYear(monthYear: JsonField) = apply { this.monthYear = monthYear } @@ -2027,29 +2226,17 @@ private constructor( fun predictionCount(predictionCount: Long) = predictionCount(JsonField.of(predictionCount)) - @JsonProperty("predictionCount") - @ExcludeMissing fun predictionCount(predictionCount: JsonField) = apply { this.predictionCount = predictionCount } - fun executionTimeMs(executionTimeMs: Long) = - executionTimeMs(JsonField.of(executionTimeMs)) - - @JsonProperty("executionTimeMs") - @ExcludeMissing - fun executionTimeMs(executionTimeMs: JsonField) = apply { - this.executionTimeMs = executionTimeMs - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -2057,11 +2244,19 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): MonthlyUsage = MonthlyUsage( + executionTimeMs, monthYear, predictionCount, - executionTimeMs, additionalProperties.toImmutable(), ) } @@ -2071,17 +2266,17 @@ private constructor( return true } - return /* spotless:off */ other is MonthlyUsage && monthYear == other.monthYear && predictionCount == other.predictionCount && executionTimeMs == other.executionTimeMs && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MonthlyUsage && executionTimeMs == other.executionTimeMs && monthYear == other.monthYear && predictionCount == other.predictionCount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(monthYear, predictionCount, executionTimeMs, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(executionTimeMs, monthYear, predictionCount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MonthlyUsage{monthYear=$monthYear, predictionCount=$predictionCount, executionTimeMs=$executionTimeMs, additionalProperties=$additionalProperties}" + "MonthlyUsage{executionTimeMs=$executionTimeMs, monthYear=$monthYear, predictionCount=$predictionCount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2089,17 +2284,17 @@ private constructor( return true } - return /* spotless:off */ other is Workspace && id == other.id && name == other.name && slug == other.slug && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && creatorId == other.creatorId && inviteCode == other.inviteCode && wildcardDomains == other.wildcardDomains && projectCount == other.projectCount && memberCount == other.memberCount && monthlyUsage == other.monthlyUsage && inviteCount == other.inviteCount && periodStartDate == other.periodStartDate && periodEndDate == other.periodEndDate && samlOnlyAccess == other.samlOnlyAccess && status == other.status && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Workspace && id == other.id && creatorId == other.creatorId && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && inviteCount == other.inviteCount && memberCount == other.memberCount && name == other.name && periodEndDate == other.periodEndDate && periodStartDate == other.periodStartDate && projectCount == other.projectCount && slug == other.slug && status == other.status && inviteCode == other.inviteCode && monthlyUsage == other.monthlyUsage && samlOnlyAccess == other.samlOnlyAccess && wildcardDomains == other.wildcardDomains && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, name, slug, dateCreated, dateUpdated, creatorId, inviteCode, wildcardDomains, projectCount, memberCount, monthlyUsage, inviteCount, periodStartDate, periodEndDate, samlOnlyAccess, status, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, creatorId, dateCreated, dateUpdated, inviteCount, memberCount, name, periodEndDate, periodStartDate, projectCount, slug, status, inviteCode, monthlyUsage, samlOnlyAccess, wildcardDomains, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Workspace{id=$id, name=$name, slug=$slug, dateCreated=$dateCreated, dateUpdated=$dateUpdated, creatorId=$creatorId, inviteCode=$inviteCode, wildcardDomains=$wildcardDomains, projectCount=$projectCount, memberCount=$memberCount, monthlyUsage=$monthlyUsage, inviteCount=$inviteCount, periodStartDate=$periodStartDate, periodEndDate=$periodEndDate, samlOnlyAccess=$samlOnlyAccess, status=$status, additionalProperties=$additionalProperties}" + "Workspace{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, inviteCount=$inviteCount, memberCount=$memberCount, name=$name, periodEndDate=$periodEndDate, periodStartDate=$periodStartDate, projectCount=$projectCount, slug=$slug, status=$status, inviteCode=$inviteCode, monthlyUsage=$monthlyUsage, samlOnlyAccess=$samlOnlyAccess, wildcardDomains=$wildcardDomains, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2107,15 +2302,15 @@ private constructor( return true } - return /* spotless:off */ other is ProjectInferencePipelineCreateResponse && id == other.id && projectId == other.projectId && workspaceId == other.workspaceId && project == other.project && workspace == other.workspace && name == other.name && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && dateLastSampleReceived == other.dateLastSampleReceived && description == other.description && dateLastEvaluated == other.dateLastEvaluated && dateOfNextEvaluation == other.dateOfNextEvaluation && passingGoalCount == other.passingGoalCount && failingGoalCount == other.failingGoalCount && totalGoalCount == other.totalGoalCount && status == other.status && statusMessage == other.statusMessage && links == other.links && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ProjectInferencePipelineCreateResponse && id == other.id && dateCreated == other.dateCreated && dateLastEvaluated == other.dateLastEvaluated && dateLastSampleReceived == other.dateLastSampleReceived && dateOfNextEvaluation == other.dateOfNextEvaluation && dateUpdated == other.dateUpdated && description == other.description && failingGoalCount == other.failingGoalCount && links == other.links && name == other.name && passingGoalCount == other.passingGoalCount && projectId == other.projectId && status == other.status && statusMessage == other.statusMessage && totalGoalCount == other.totalGoalCount && project == other.project && workspace == other.workspace && workspaceId == other.workspaceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, projectId, workspaceId, project, workspace, name, dateCreated, dateUpdated, dateLastSampleReceived, description, dateLastEvaluated, dateOfNextEvaluation, passingGoalCount, failingGoalCount, totalGoalCount, status, statusMessage, links, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dateCreated, dateLastEvaluated, dateLastSampleReceived, dateOfNextEvaluation, dateUpdated, description, failingGoalCount, links, name, passingGoalCount, projectId, status, statusMessage, totalGoalCount, project, workspace, workspaceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ProjectInferencePipelineCreateResponse{id=$id, projectId=$projectId, workspaceId=$workspaceId, project=$project, workspace=$workspace, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, dateLastSampleReceived=$dateLastSampleReceived, description=$description, dateLastEvaluated=$dateLastEvaluated, dateOfNextEvaluation=$dateOfNextEvaluation, passingGoalCount=$passingGoalCount, failingGoalCount=$failingGoalCount, totalGoalCount=$totalGoalCount, status=$status, statusMessage=$statusMessage, links=$links, additionalProperties=$additionalProperties}" + "ProjectInferencePipelineCreateResponse{id=$id, dateCreated=$dateCreated, dateLastEvaluated=$dateLastEvaluated, dateLastSampleReceived=$dateLastSampleReceived, dateOfNextEvaluation=$dateOfNextEvaluation, dateUpdated=$dateUpdated, description=$description, failingGoalCount=$failingGoalCount, links=$links, name=$name, passingGoalCount=$passingGoalCount, projectId=$projectId, status=$status, statusMessage=$statusMessage, totalGoalCount=$totalGoalCount, project=$project, workspace=$workspace, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt index 6aa853f7..8e15f0ca 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt @@ -3,11 +3,13 @@ package com.openlayer.api.models import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams import java.util.Objects import java.util.Optional +/** List the inference pipelines in a project. */ class ProjectInferencePipelineListParams constructor( private val projectId: String, @@ -20,10 +22,13 @@ constructor( fun projectId(): String = projectId + /** Filter list of items by name. */ fun name(): Optional = Optional.ofNullable(name) + /** The page to return in a paginated query. */ fun page(): Optional = Optional.ofNullable(page) + /** Maximum number of items to return per page. */ fun perPage(): Optional = Optional.ofNullable(perPage) fun _additionalHeaders(): Headers = additionalHeaders @@ -81,13 +86,30 @@ constructor( fun projectId(projectId: String) = apply { this.projectId = projectId } /** Filter list of items by name. */ - fun name(name: String) = apply { this.name = name } + fun name(name: String?) = apply { this.name = name } + + /** Filter list of items by name. */ + fun name(name: Optional) = name(name.orElse(null)) + + /** The page to return in a paginated query. */ + fun page(page: Long?) = apply { this.page = page } + + /** The page to return in a paginated query. */ + fun page(page: Long) = page(page as Long?) /** The page to return in a paginated query. */ - fun page(page: Long) = apply { this.page = page } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun page(page: Optional) = page(page.orElse(null) as Long?) + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long?) = apply { this.perPage = perPage } + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long) = perPage(perPage as Long?) /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { this.perPage = perPage } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun perPage(perPage: Optional) = perPage(perPage.orElse(null) as Long?) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -189,7 +211,7 @@ constructor( fun build(): ProjectInferencePipelineListParams = ProjectInferencePipelineListParams( - checkNotNull(projectId) { "`projectId` is required but was not set" }, + checkRequired("projectId", projectId), name, page, perPage, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt index 899a007d..56cc95b5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt @@ -6,13 +6,14 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.Enum import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.LocalDate @@ -20,29 +21,33 @@ import java.time.OffsetDateTime import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = ProjectInferencePipelineListResponse.Builder::class) @NoAutoDetect class ProjectInferencePipelineListResponse +@JsonCreator private constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") + @ExcludeMissing + private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun items(): List = items.getRequired("items") - @JsonProperty("items") @ExcludeMissing fun _items() = items + @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): ProjectInferencePipelineListResponse = apply { - if (!validated) { - items().forEach { it.validate() } - validated = true + if (validated) { + return@apply } + + items().forEach { it.validate() } + validated = true } fun toBuilder() = Builder().from(this) @@ -54,119 +59,161 @@ private constructor( class Builder { - private var items: JsonField> = JsonMissing.of() + private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( projectInferencePipelineListResponse: ProjectInferencePipelineListResponse ) = apply { - this.items = projectInferencePipelineListResponse.items - additionalProperties(projectInferencePipelineListResponse.additionalProperties) + items = projectInferencePipelineListResponse.items.map { it.toMutableList() } + additionalProperties = + projectInferencePipelineListResponse.additionalProperties.toMutableMap() } fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") - @ExcludeMissing - fun items(items: JsonField>) = apply { this.items = items } + fun items(items: JsonField>) = apply { + this.items = items.map { it.toMutableList() } + } + + fun addItem(item: Item) = apply { + items = + (items ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(item) + } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): ProjectInferencePipelineListResponse = ProjectInferencePipelineListResponse( - items.map { it.toImmutable() }, + checkRequired("items", items).map { it.toImmutable() }, additionalProperties.toImmutable() ) } - @JsonDeserialize(builder = Item.Builder::class) @NoAutoDetect class Item + @JsonCreator private constructor( - private val id: JsonField, - private val projectId: JsonField, - private val workspaceId: JsonField, - private val project: JsonField, - private val workspace: JsonField, - private val name: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val dateLastSampleReceived: JsonField, - private val description: JsonField, - private val dateLastEvaluated: JsonField, - private val dateOfNextEvaluation: JsonField, - private val passingGoalCount: JsonField, - private val failingGoalCount: JsonField, - private val totalGoalCount: JsonField, - private val status: JsonField, - private val statusMessage: JsonField, - private val links: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + private val dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastSampleReceived") + @ExcludeMissing + private val dateLastSampleReceived: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + private val dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("failingGoalCount") + @ExcludeMissing + private val failingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("links") + @ExcludeMissing + private val links: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("passingGoalCount") + @ExcludeMissing + private val passingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + private val projectId: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + private val statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("totalGoalCount") + @ExcludeMissing + private val totalGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("project") + @ExcludeMissing + private val project: JsonField = JsonMissing.of(), + @JsonProperty("workspace") + @ExcludeMissing + private val workspace: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + private val workspaceId: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The inference pipeline id. */ fun id(): String = id.getRequired("id") - /** The project id. */ - fun projectId(): String = projectId.getRequired("projectId") - - /** The workspace id. */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) - - fun project(): Optional = Optional.ofNullable(project.getNullable("project")) - - fun workspace(): Optional = - Optional.ofNullable(workspace.getNullable("workspace")) - - /** The inference pipeline name. */ - fun name(): String = name.getRequired("name") - /** The creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The last updated date. */ - fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** The last test evaluation date. */ + fun dateLastEvaluated(): Optional = + Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) /** The last data sample received date. */ fun dateLastSampleReceived(): Optional = Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + /** The next test evaluation date. */ + fun dateOfNextEvaluation(): Optional = + Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + + /** The last updated date. */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** The inference pipeline description. */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** The last test evaluation date. */ - fun dateLastEvaluated(): Optional = - Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + /** The number of tests failing. */ + fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") - /** The next test evaluation date. */ - fun dateOfNextEvaluation(): Optional = - Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + fun links(): Links = links.getRequired("links") + + /** The inference pipeline name. */ + fun name(): String = name.getRequired("name") /** The number of tests passing. */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") - /** The number of tests failing. */ - fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") - - /** The total number of tests. */ - fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") + /** The project id. */ + fun projectId(): String = projectId.getRequired("projectId") /** The status of test evaluation for the inference pipeline. */ fun status(): Status = status.getRequired("status") @@ -175,91 +222,123 @@ private constructor( fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) - fun links(): Links = links.getRequired("links") + /** The total number of tests. */ + fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") - /** The inference pipeline id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun project(): Optional = Optional.ofNullable(project.getNullable("project")) - /** The project id. */ - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + fun workspace(): Optional = + Optional.ofNullable(workspace.getNullable("workspace")) /** The workspace id. */ - @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId() = workspaceId - - @JsonProperty("project") @ExcludeMissing fun _project() = project - - @JsonProperty("workspace") @ExcludeMissing fun _workspace() = workspace + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The inference pipeline name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + /** The inference pipeline id. */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated - - /** The last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated - - /** The last data sample received date. */ - @JsonProperty("dateLastSampleReceived") + @JsonProperty("dateCreated") @ExcludeMissing - fun _dateLastSampleReceived() = dateLastSampleReceived - - /** The inference pipeline description. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description + fun _dateCreated(): JsonField = dateCreated /** The last test evaluation date. */ @JsonProperty("dateLastEvaluated") @ExcludeMissing - fun _dateLastEvaluated() = dateLastEvaluated + fun _dateLastEvaluated(): JsonField = dateLastEvaluated + + /** The last data sample received date. */ + @JsonProperty("dateLastSampleReceived") + @ExcludeMissing + fun _dateLastSampleReceived(): JsonField = dateLastSampleReceived /** The next test evaluation date. */ @JsonProperty("dateOfNextEvaluation") @ExcludeMissing - fun _dateOfNextEvaluation() = dateOfNextEvaluation + fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation - /** The number of tests passing. */ - @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount + /** The last updated date. */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** The inference pipeline description. */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description /** The number of tests failing. */ - @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount + @JsonProperty("failingGoalCount") + @ExcludeMissing + fun _failingGoalCount(): JsonField = failingGoalCount - /** The total number of tests. */ - @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links + + /** The inference pipeline name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** The number of tests passing. */ + @JsonProperty("passingGoalCount") + @ExcludeMissing + fun _passingGoalCount(): JsonField = passingGoalCount + + /** The project id. */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId /** The status of test evaluation for the inference pipeline. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status /** The status message of test evaluation for the inference pipeline. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + + /** The total number of tests. */ + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun _totalGoalCount(): JsonField = totalGoalCount + + @JsonProperty("project") @ExcludeMissing fun _project(): JsonField = project - @JsonProperty("links") @ExcludeMissing fun _links() = links + @JsonProperty("workspace") + @ExcludeMissing + fun _workspace(): JsonField = workspace + + /** The workspace id. */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Item = apply { - if (!validated) { - id() - projectId() - workspaceId() - project().map { it.validate() } - workspace().map { it.validate() } - name() - dateCreated() - dateUpdated() - dateLastSampleReceived() - description() - dateLastEvaluated() - dateOfNextEvaluation() - passingGoalCount() - failingGoalCount() - totalGoalCount() - status() - statusMessage() - links().validate() - validated = true + if (validated) { + return@apply } + + id() + dateCreated() + dateLastEvaluated() + dateLastSampleReceived() + dateOfNextEvaluation() + dateUpdated() + description() + failingGoalCount() + links().validate() + name() + passingGoalCount() + projectId() + status() + statusMessage() + totalGoalCount() + project().ifPresent { it.validate() } + workspace().ifPresent { it.validate() } + workspaceId() + validated = true } fun toBuilder() = Builder().from(this) @@ -271,275 +350,273 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var projectId: JsonField = JsonMissing.of() - private var workspaceId: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateLastEvaluated: JsonField? = null + private var dateLastSampleReceived: JsonField? = null + private var dateOfNextEvaluation: JsonField? = null + private var dateUpdated: JsonField? = null + private var description: JsonField? = null + private var failingGoalCount: JsonField? = null + private var links: JsonField? = null + private var name: JsonField? = null + private var passingGoalCount: JsonField? = null + private var projectId: JsonField? = null + private var status: JsonField? = null + private var statusMessage: JsonField? = null + private var totalGoalCount: JsonField? = null private var project: JsonField = JsonMissing.of() private var workspace: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() - private var dateLastSampleReceived: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() - private var dateLastEvaluated: JsonField = JsonMissing.of() - private var dateOfNextEvaluation: JsonField = JsonMissing.of() - private var passingGoalCount: JsonField = JsonMissing.of() - private var failingGoalCount: JsonField = JsonMissing.of() - private var totalGoalCount: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var statusMessage: JsonField = JsonMissing.of() - private var links: JsonField = JsonMissing.of() + private var workspaceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(item: Item) = apply { - this.id = item.id - this.projectId = item.projectId - this.workspaceId = item.workspaceId - this.project = item.project - this.workspace = item.workspace - this.name = item.name - this.dateCreated = item.dateCreated - this.dateUpdated = item.dateUpdated - this.dateLastSampleReceived = item.dateLastSampleReceived - this.description = item.description - this.dateLastEvaluated = item.dateLastEvaluated - this.dateOfNextEvaluation = item.dateOfNextEvaluation - this.passingGoalCount = item.passingGoalCount - this.failingGoalCount = item.failingGoalCount - this.totalGoalCount = item.totalGoalCount - this.status = item.status - this.statusMessage = item.statusMessage - this.links = item.links - additionalProperties(item.additionalProperties) + id = item.id + dateCreated = item.dateCreated + dateLastEvaluated = item.dateLastEvaluated + dateLastSampleReceived = item.dateLastSampleReceived + dateOfNextEvaluation = item.dateOfNextEvaluation + dateUpdated = item.dateUpdated + description = item.description + failingGoalCount = item.failingGoalCount + links = item.links + name = item.name + passingGoalCount = item.passingGoalCount + projectId = item.projectId + status = item.status + statusMessage = item.statusMessage + totalGoalCount = item.totalGoalCount + project = item.project + workspace = item.workspace + workspaceId = item.workspaceId + additionalProperties = item.additionalProperties.toMutableMap() } /** The inference pipeline id. */ fun id(id: String) = id(JsonField.of(id)) /** The inference pipeline id. */ - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - /** The project id. */ - fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - - /** The project id. */ - @JsonProperty("projectId") - @ExcludeMissing - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } - - /** The workspace id. */ - fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The workspace id. */ - @JsonProperty("workspaceId") - @ExcludeMissing - fun workspaceId(workspaceId: JsonField) = apply { - this.workspaceId = workspaceId + /** The creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated } - fun project(project: Project) = project(JsonField.of(project)) + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = + dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) - @JsonProperty("project") - @ExcludeMissing - fun project(project: JsonField) = apply { this.project = project } + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: Optional) = + dateLastEvaluated(dateLastEvaluated.orElse(null)) - fun workspace(workspace: Workspace) = workspace(JsonField.of(workspace)) + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } - @JsonProperty("workspace") - @ExcludeMissing - fun workspace(workspace: JsonField) = apply { this.workspace = workspace } + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime?) = + dateLastSampleReceived(JsonField.ofNullable(dateLastSampleReceived)) - /** The inference pipeline name. */ - fun name(name: String) = name(JsonField.of(name)) + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: Optional) = + dateLastSampleReceived(dateLastSampleReceived.orElse(null)) - /** The inference pipeline name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { + this.dateLastSampleReceived = dateLastSampleReceived + } - /** The creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = + dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) - /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun dateCreated(dateCreated: JsonField) = apply { - this.dateCreated = dateCreated + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = + dateOfNextEvaluation(dateOfNextEvaluation.orElse(null)) + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation } /** The last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - /** The last data sample received date. */ - fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime) = - dateLastSampleReceived(JsonField.of(dateLastSampleReceived)) - - /** The last data sample received date. */ - @JsonProperty("dateLastSampleReceived") - @ExcludeMissing - fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { - this.dateLastSampleReceived = dateLastSampleReceived - } + /** The inference pipeline description. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) /** The inference pipeline description. */ - fun description(description: String) = description(JsonField.of(description)) + fun description(description: Optional) = description(description.orElse(null)) /** The inference pipeline description. */ - @JsonProperty("description") - @ExcludeMissing fun description(description: JsonField) = apply { this.description = description } - /** The last test evaluation date. */ - fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime) = - dateLastEvaluated(JsonField.of(dateLastEvaluated)) + /** The number of tests failing. */ + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) - /** The last test evaluation date. */ - @JsonProperty("dateLastEvaluated") - @ExcludeMissing - fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { - this.dateLastEvaluated = dateLastEvaluated + /** The number of tests failing. */ + fun failingGoalCount(failingGoalCount: JsonField) = apply { + this.failingGoalCount = failingGoalCount } - /** The next test evaluation date. */ - fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = - dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) + fun links(links: Links) = links(JsonField.of(links)) - /** The next test evaluation date. */ - @JsonProperty("dateOfNextEvaluation") - @ExcludeMissing - fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { - this.dateOfNextEvaluation = dateOfNextEvaluation - } + fun links(links: JsonField) = apply { this.links = links } + + /** The inference pipeline name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The inference pipeline name. */ + fun name(name: JsonField) = apply { this.name = name } /** The number of tests passing. */ fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) /** The number of tests passing. */ - @JsonProperty("passingGoalCount") - @ExcludeMissing fun passingGoalCount(passingGoalCount: JsonField) = apply { this.passingGoalCount = passingGoalCount } - /** The number of tests failing. */ - fun failingGoalCount(failingGoalCount: Long) = - failingGoalCount(JsonField.of(failingGoalCount)) - - /** The number of tests failing. */ - @JsonProperty("failingGoalCount") - @ExcludeMissing - fun failingGoalCount(failingGoalCount: JsonField) = apply { - this.failingGoalCount = failingGoalCount - } - - /** The total number of tests. */ - fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) + /** The project id. */ + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** The total number of tests. */ - @JsonProperty("totalGoalCount") - @ExcludeMissing - fun totalGoalCount(totalGoalCount: JsonField) = apply { - this.totalGoalCount = totalGoalCount - } + /** The project id. */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** The status of test evaluation for the inference pipeline. */ fun status(status: Status) = status(JsonField.of(status)) /** The status of test evaluation for the inference pipeline. */ - @JsonProperty("status") - @ExcludeMissing fun status(status: JsonField) = apply { this.status = status } /** The status message of test evaluation for the inference pipeline. */ - fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** The status message of test evaluation for the inference pipeline. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.orElse(null)) /** The status message of test evaluation for the inference pipeline. */ - @JsonProperty("statusMessage") - @ExcludeMissing fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } - fun links(links: Links) = links(JsonField.of(links)) + /** The total number of tests. */ + fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - @JsonProperty("links") - @ExcludeMissing - fun links(links: JsonField) = apply { this.links = links } + /** The total number of tests. */ + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount + } + + fun project(project: Project?) = project(JsonField.ofNullable(project)) + + fun project(project: Optional) = project(project.orElse(null)) + + fun project(project: JsonField) = apply { this.project = project } + + fun workspace(workspace: Workspace?) = workspace(JsonField.ofNullable(workspace)) + + fun workspace(workspace: Optional) = workspace(workspace.orElse(null)) + + fun workspace(workspace: JsonField) = apply { this.workspace = workspace } + + /** The workspace id. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** The workspace id. */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Item = Item( - id, - projectId, - workspaceId, + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateLastEvaluated", dateLastEvaluated), + checkRequired("dateLastSampleReceived", dateLastSampleReceived), + checkRequired("dateOfNextEvaluation", dateOfNextEvaluation), + checkRequired("dateUpdated", dateUpdated), + checkRequired("description", description), + checkRequired("failingGoalCount", failingGoalCount), + checkRequired("links", links), + checkRequired("name", name), + checkRequired("passingGoalCount", passingGoalCount), + checkRequired("projectId", projectId), + checkRequired("status", status), + checkRequired("statusMessage", statusMessage), + checkRequired("totalGoalCount", totalGoalCount), project, workspace, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - status, - statusMessage, - links, + workspaceId, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect class Links + @JsonCreator private constructor( - private val app: JsonField, - private val additionalProperties: Map, + @JsonProperty("app") + @ExcludeMissing + private val app: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun app(): String = app.getRequired("app") - @JsonProperty("app") @ExcludeMissing fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Links = apply { - if (!validated) { - app() - validated = true + if (validated) { + return@apply } + + app() + validated = true } fun toBuilder() = Builder().from(this) @@ -551,29 +628,26 @@ private constructor( class Builder { - private var app: JsonField = JsonMissing.of() + private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) + app = links.app + additionalProperties = links.additionalProperties.toMutableMap() } fun app(app: String) = app(JsonField.of(app)) - @JsonProperty("app") - @ExcludeMissing fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -581,7 +655,16 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toImmutable()) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Links = + Links(checkRequired("app", app), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -601,6 +684,7 @@ private constructor( override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } + /** The status of test evaluation for the inference pipeline. */ class Status @JsonCreator private constructor( @@ -682,54 +766,94 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = Project.Builder::class) @NoAutoDetect class Project + @JsonCreator private constructor( - private val id: JsonField, - private val workspaceId: JsonField, - private val creatorId: JsonField, - private val name: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val description: JsonField, - private val source: JsonField, - private val taskType: JsonField, - private val versionCount: JsonField, - private val inferencePipelineCount: JsonField, - private val goalCount: JsonField, - private val developmentGoalCount: JsonField, - private val monitoringGoalCount: JsonField, - private val links: JsonField, - private val gitRepo: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + private val creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("developmentGoalCount") + @ExcludeMissing + private val developmentGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("goalCount") + @ExcludeMissing + private val goalCount: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + private val inferencePipelineCount: JsonField = JsonMissing.of(), + @JsonProperty("links") + @ExcludeMissing + private val links: JsonField = JsonMissing.of(), + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + private val monitoringGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("source") + @ExcludeMissing + private val source: JsonField = JsonMissing.of(), + @JsonProperty("taskType") + @ExcludeMissing + private val taskType: JsonField = JsonMissing.of(), + @JsonProperty("versionCount") + @ExcludeMissing + private val versionCount: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + private val workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("gitRepo") + @ExcludeMissing + private val gitRepo: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The project id. */ fun id(): String = id.getRequired("id") - /** The workspace id. */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The project creator id. */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The project name. */ - fun name(): String = name.getRequired("name") - /** The project creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") /** The project last updated date. */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The project description. */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(): Long = + developmentGoalCount.getRequired("developmentGoalCount") + + /** The total number of tests in the project. */ + fun goalCount(): Long = goalCount.getRequired("goalCount") + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(): Long = + inferencePipelineCount.getRequired("inferencePipelineCount") + + /** Links to the project. */ + fun links(): Links = links.getRequired("links") + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") + + /** The project name. */ + fun name(): String = name.getRequired("name") /** The source of the project. */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) @@ -740,102 +864,111 @@ private constructor( /** The number of versions (commits) in the project. */ fun versionCount(): Long = versionCount.getRequired("versionCount") - /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(): Long = - inferencePipelineCount.getRequired("inferencePipelineCount") - - /** The total number of tests in the project. */ - fun goalCount(): Long = goalCount.getRequired("goalCount") - - /** The number of tests in the development mode of the project. */ - fun developmentGoalCount(): Long = - developmentGoalCount.getRequired("developmentGoalCount") - - /** The number of tests in the monitoring mode of the project. */ - fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") + /** The workspace id. */ + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** Links to the project. */ - fun links(): Links = links.getRequired("links") + /** The project description. */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) /** The project id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id - - /** The workspace id. */ - @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId() = workspaceId + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The project creator id. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId - - /** The project name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("creatorId") + @ExcludeMissing + fun _creatorId(): JsonField = creatorId /** The project creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated /** The project last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated - - /** The project description. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description - - /** The source of the project. */ - @JsonProperty("source") @ExcludeMissing fun _source() = source + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - /** The task type of the project. */ - @JsonProperty("taskType") @ExcludeMissing fun _taskType() = taskType + /** The number of tests in the development mode of the project. */ + @JsonProperty("developmentGoalCount") + @ExcludeMissing + fun _developmentGoalCount(): JsonField = developmentGoalCount - /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") @ExcludeMissing fun _versionCount() = versionCount + /** The total number of tests in the project. */ + @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount /** The number of inference pipelines in the project. */ @JsonProperty("inferencePipelineCount") @ExcludeMissing - fun _inferencePipelineCount() = inferencePipelineCount - - /** The total number of tests in the project. */ - @JsonProperty("goalCount") @ExcludeMissing fun _goalCount() = goalCount + fun _inferencePipelineCount(): JsonField = inferencePipelineCount - /** The number of tests in the development mode of the project. */ - @JsonProperty("developmentGoalCount") - @ExcludeMissing - fun _developmentGoalCount() = developmentGoalCount + /** Links to the project. */ + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links /** The number of tests in the monitoring mode of the project. */ @JsonProperty("monitoringGoalCount") @ExcludeMissing - fun _monitoringGoalCount() = monitoringGoalCount + fun _monitoringGoalCount(): JsonField = monitoringGoalCount - /** Links to the project. */ - @JsonProperty("links") @ExcludeMissing fun _links() = links + /** The project name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** The source of the project. */ + @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source + + /** The task type of the project. */ + @JsonProperty("taskType") + @ExcludeMissing + fun _taskType(): JsonField = taskType + + /** The number of versions (commits) in the project. */ + @JsonProperty("versionCount") + @ExcludeMissing + fun _versionCount(): JsonField = versionCount + + /** The workspace id. */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** The project description. */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description - @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo() = gitRepo + @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Project = apply { - if (!validated) { - id() - workspaceId() - creatorId() - name() - dateCreated() - dateUpdated() - description() - source() - taskType() - versionCount() - inferencePipelineCount() - goalCount() - developmentGoalCount() - monitoringGoalCount() - links().validate() - gitRepo().map { it.validate() } - validated = true + if (validated) { + return@apply } + + id() + creatorId() + dateCreated() + dateUpdated() + developmentGoalCount() + goalCount() + inferencePipelineCount() + links().validate() + monitoringGoalCount() + name() + source() + taskType() + versionCount() + workspaceId() + description() + gitRepo().ifPresent { it.validate() } + validated = true } fun toBuilder() = Builder().from(this) @@ -847,200 +980,185 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var workspaceId: JsonField = JsonMissing.of() - private var creatorId: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var developmentGoalCount: JsonField? = null + private var goalCount: JsonField? = null + private var inferencePipelineCount: JsonField? = null + private var links: JsonField? = null + private var monitoringGoalCount: JsonField? = null + private var name: JsonField? = null + private var source: JsonField? = null + private var taskType: JsonField? = null + private var versionCount: JsonField? = null + private var workspaceId: JsonField? = null private var description: JsonField = JsonMissing.of() - private var source: JsonField = JsonMissing.of() - private var taskType: JsonField = JsonMissing.of() - private var versionCount: JsonField = JsonMissing.of() - private var inferencePipelineCount: JsonField = JsonMissing.of() - private var goalCount: JsonField = JsonMissing.of() - private var developmentGoalCount: JsonField = JsonMissing.of() - private var monitoringGoalCount: JsonField = JsonMissing.of() - private var links: JsonField = JsonMissing.of() private var gitRepo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(project: Project) = apply { - this.id = project.id - this.workspaceId = project.workspaceId - this.creatorId = project.creatorId - this.name = project.name - this.dateCreated = project.dateCreated - this.dateUpdated = project.dateUpdated - this.description = project.description - this.source = project.source - this.taskType = project.taskType - this.versionCount = project.versionCount - this.inferencePipelineCount = project.inferencePipelineCount - this.goalCount = project.goalCount - this.developmentGoalCount = project.developmentGoalCount - this.monitoringGoalCount = project.monitoringGoalCount - this.links = project.links - this.gitRepo = project.gitRepo - additionalProperties(project.additionalProperties) + id = project.id + creatorId = project.creatorId + dateCreated = project.dateCreated + dateUpdated = project.dateUpdated + developmentGoalCount = project.developmentGoalCount + goalCount = project.goalCount + inferencePipelineCount = project.inferencePipelineCount + links = project.links + monitoringGoalCount = project.monitoringGoalCount + name = project.name + source = project.source + taskType = project.taskType + versionCount = project.versionCount + workspaceId = project.workspaceId + description = project.description + gitRepo = project.gitRepo + additionalProperties = project.additionalProperties.toMutableMap() } /** The project id. */ fun id(id: String) = id(JsonField.of(id)) /** The project id. */ - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - /** The workspace id. */ - fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + /** The project creator id. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The workspace id. */ - @JsonProperty("workspaceId") - @ExcludeMissing - fun workspaceId(workspaceId: JsonField) = apply { - this.workspaceId = workspaceId + /** The project creator id. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + + /** The project creator id. */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The project creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) + + /** The project creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The project last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) + + /** The project last updated date. */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: Long) = + developmentGoalCount(JsonField.of(developmentGoalCount)) + + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: JsonField) = apply { + this.developmentGoalCount = developmentGoalCount + } + + /** The total number of tests in the project. */ + fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) + + /** The total number of tests in the project. */ + fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(inferencePipelineCount: Long) = + inferencePipelineCount(JsonField.of(inferencePipelineCount)) + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { + this.inferencePipelineCount = inferencePipelineCount } - /** The project creator id. */ - fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) + /** Links to the project. */ + fun links(links: Links) = links(JsonField.of(links)) + + /** Links to the project. */ + fun links(links: JsonField) = apply { this.links = links } + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(monitoringGoalCount: Long) = + monitoringGoalCount(JsonField.of(monitoringGoalCount)) - /** The project creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { + this.monitoringGoalCount = monitoringGoalCount + } /** The project name. */ fun name(name: String) = name(JsonField.of(name)) /** The project name. */ - @JsonProperty("name") - @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } - /** The project creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = - dateCreated(JsonField.of(dateCreated)) - - /** The project creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun dateCreated(dateCreated: JsonField) = apply { - this.dateCreated = dateCreated - } - - /** The project last updated date. */ - fun dateUpdated(dateUpdated: OffsetDateTime) = - dateUpdated(JsonField.of(dateUpdated)) - - /** The project last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun dateUpdated(dateUpdated: JsonField) = apply { - this.dateUpdated = dateUpdated - } - - /** The project description. */ - fun description(description: String) = description(JsonField.of(description)) - - /** The project description. */ - @JsonProperty("description") - @ExcludeMissing - fun description(description: JsonField) = apply { - this.description = description - } + /** The source of the project. */ + fun source(source: Source?) = source(JsonField.ofNullable(source)) /** The source of the project. */ - fun source(source: Source) = source(JsonField.of(source)) + fun source(source: Optional) = source(source.orElse(null)) /** The source of the project. */ - @JsonProperty("source") - @ExcludeMissing fun source(source: JsonField) = apply { this.source = source } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) /** The task type of the project. */ - @JsonProperty("taskType") - @ExcludeMissing fun taskType(taskType: JsonField) = apply { this.taskType = taskType } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") - @ExcludeMissing fun versionCount(versionCount: JsonField) = apply { this.versionCount = versionCount } - /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(inferencePipelineCount: Long) = - inferencePipelineCount(JsonField.of(inferencePipelineCount)) - - /** The number of inference pipelines in the project. */ - @JsonProperty("inferencePipelineCount") - @ExcludeMissing - fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { - this.inferencePipelineCount = inferencePipelineCount - } - - /** The total number of tests in the project. */ - fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) - - /** The total number of tests in the project. */ - @JsonProperty("goalCount") - @ExcludeMissing - fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } + /** The workspace id. */ + fun workspaceId(workspaceId: String?) = + workspaceId(JsonField.ofNullable(workspaceId)) - /** The number of tests in the development mode of the project. */ - fun developmentGoalCount(developmentGoalCount: Long) = - developmentGoalCount(JsonField.of(developmentGoalCount)) + /** The workspace id. */ + fun workspaceId(workspaceId: Optional) = + workspaceId(workspaceId.orElse(null)) - /** The number of tests in the development mode of the project. */ - @JsonProperty("developmentGoalCount") - @ExcludeMissing - fun developmentGoalCount(developmentGoalCount: JsonField) = apply { - this.developmentGoalCount = developmentGoalCount + /** The workspace id. */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId } - /** The number of tests in the monitoring mode of the project. */ - fun monitoringGoalCount(monitoringGoalCount: Long) = - monitoringGoalCount(JsonField.of(monitoringGoalCount)) + /** The project description. */ + fun description(description: String?) = + description(JsonField.ofNullable(description)) - /** The number of tests in the monitoring mode of the project. */ - @JsonProperty("monitoringGoalCount") - @ExcludeMissing - fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { - this.monitoringGoalCount = monitoringGoalCount - } + /** The project description. */ + fun description(description: Optional) = + description(description.orElse(null)) - /** Links to the project. */ - fun links(links: Links) = links(JsonField.of(links)) + /** The project description. */ + fun description(description: JsonField) = apply { + this.description = description + } - /** Links to the project. */ - @JsonProperty("links") - @ExcludeMissing - fun links(links: JsonField) = apply { this.links = links } + fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) - fun gitRepo(gitRepo: GitRepo) = gitRepo(JsonField.of(gitRepo)) + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.orElse(null)) - @JsonProperty("gitRepo") - @ExcludeMissing fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1048,52 +1166,65 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Project = Project( - id, - workspaceId, - creatorId, - name, - dateCreated, - dateUpdated, + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("developmentGoalCount", developmentGoalCount), + checkRequired("goalCount", goalCount), + checkRequired("inferencePipelineCount", inferencePipelineCount), + checkRequired("links", links), + checkRequired("monitoringGoalCount", monitoringGoalCount), + checkRequired("name", name), + checkRequired("source", source), + checkRequired("taskType", taskType), + checkRequired("versionCount", versionCount), + checkRequired("workspaceId", workspaceId), description, - source, - taskType, - versionCount, - inferencePipelineCount, - goalCount, - developmentGoalCount, - monitoringGoalCount, - links, gitRepo, additionalProperties.toImmutable(), ) } /** Links to the project. */ - @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect class Links + @JsonCreator private constructor( - private val app: JsonField, - private val additionalProperties: Map, + @JsonProperty("app") + @ExcludeMissing + private val app: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun app(): String = app.getRequired("app") - @JsonProperty("app") @ExcludeMissing fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Links = apply { - if (!validated) { - app() - validated = true + if (validated) { + return@apply } + + app() + validated = true } fun toBuilder() = Builder().from(this) @@ -1105,29 +1236,26 @@ private constructor( class Builder { - private var app: JsonField = JsonMissing.of() + private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) + app = links.app + additionalProperties = links.additionalProperties.toMutableMap() } fun app(app: String) = app(JsonField.of(app)) - @JsonProperty("app") - @ExcludeMissing fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1135,7 +1263,16 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toImmutable()) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Links = + Links(checkRequired("app", app), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -1156,6 +1293,7 @@ private constructor( "Links{app=$app, additionalProperties=$additionalProperties}" } + /** The source of the project. */ class Source @JsonCreator private constructor( @@ -1219,6 +1357,7 @@ private constructor( override fun toString() = value.toString() } + /** The task type of the project. */ class TaskType @JsonCreator private constructor( @@ -1288,96 +1427,133 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = GitRepo.Builder::class) @NoAutoDetect class GitRepo + @JsonCreator private constructor( - private val id: JsonField, - private val gitId: JsonField, - private val dateConnected: JsonField, - private val dateUpdated: JsonField, - private val branch: JsonField, - private val name: JsonField, - private val private_: JsonField, - private val slug: JsonField, - private val url: JsonField, - private val rootDir: JsonField, - private val projectId: JsonField, - private val gitAccountId: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("dateConnected") + @ExcludeMissing + private val dateConnected: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("gitAccountId") + @ExcludeMissing + private val gitAccountId: JsonField = JsonMissing.of(), + @JsonProperty("gitId") + @ExcludeMissing + private val gitId: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("private") + @ExcludeMissing + private val private_: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + private val projectId: JsonField = JsonMissing.of(), + @JsonProperty("slug") + @ExcludeMissing + private val slug: JsonField = JsonMissing.of(), + @JsonProperty("url") + @ExcludeMissing + private val url: JsonField = JsonMissing.of(), + @JsonProperty("branch") + @ExcludeMissing + private val branch: JsonField = JsonMissing.of(), + @JsonProperty("rootDir") + @ExcludeMissing + private val rootDir: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): String = id.getRequired("id") - fun gitId(): Long = gitId.getRequired("gitId") - fun dateConnected(): OffsetDateTime = dateConnected.getRequired("dateConnected") fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + + fun gitId(): Long = gitId.getRequired("gitId") fun name(): String = name.getRequired("name") fun private_(): Boolean = private_.getRequired("private") + fun projectId(): String = projectId.getRequired("projectId") + fun slug(): String = slug.getRequired("slug") fun url(): String = url.getRequired("url") + fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) - fun projectId(): String = projectId.getRequired("projectId") - - fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - @JsonProperty("gitId") @ExcludeMissing fun _gitId() = gitId + @JsonProperty("dateConnected") + @ExcludeMissing + fun _dateConnected(): JsonField = dateConnected - @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected() = dateConnected + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("gitAccountId") + @ExcludeMissing + fun _gitAccountId(): JsonField = gitAccountId - @JsonProperty("branch") @ExcludeMissing fun _branch() = branch + @JsonProperty("gitId") @ExcludeMissing fun _gitId(): JsonField = gitId - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - @JsonProperty("private") @ExcludeMissing fun _private_() = private_ + @JsonProperty("private") + @ExcludeMissing + fun _private_(): JsonField = private_ - @JsonProperty("slug") @ExcludeMissing fun _slug() = slug + @JsonProperty("projectId") + @ExcludeMissing + fun _projectId(): JsonField = projectId - @JsonProperty("url") @ExcludeMissing fun _url() = url + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - @JsonProperty("rootDir") @ExcludeMissing fun _rootDir() = rootDir + @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch - @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId() = gitAccountId + @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): GitRepo = apply { - if (!validated) { - id() - gitId() - dateConnected() - dateUpdated() - branch() - name() - private_() - slug() - url() - rootDir() - projectId() - gitAccountId() - validated = true + if (validated) { + return@apply } + + id() + dateConnected() + dateUpdated() + gitAccountId() + gitId() + name() + private_() + projectId() + slug() + url() + branch() + rootDir() + validated = true } fun toBuilder() = Builder().from(this) @@ -1389,54 +1565,44 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var gitId: JsonField = JsonMissing.of() - private var dateConnected: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var dateConnected: JsonField? = null + private var dateUpdated: JsonField? = null + private var gitAccountId: JsonField? = null + private var gitId: JsonField? = null + private var name: JsonField? = null + private var private_: JsonField? = null + private var projectId: JsonField? = null + private var slug: JsonField? = null + private var url: JsonField? = null private var branch: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var private_: JsonField = JsonMissing.of() - private var slug: JsonField = JsonMissing.of() - private var url: JsonField = JsonMissing.of() private var rootDir: JsonField = JsonMissing.of() - private var projectId: JsonField = JsonMissing.of() - private var gitAccountId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(gitRepo: GitRepo) = apply { - this.id = gitRepo.id - this.gitId = gitRepo.gitId - this.dateConnected = gitRepo.dateConnected - this.dateUpdated = gitRepo.dateUpdated - this.branch = gitRepo.branch - this.name = gitRepo.name - this.private_ = gitRepo.private_ - this.slug = gitRepo.slug - this.url = gitRepo.url - this.rootDir = gitRepo.rootDir - this.projectId = gitRepo.projectId - this.gitAccountId = gitRepo.gitAccountId - additionalProperties(gitRepo.additionalProperties) + id = gitRepo.id + dateConnected = gitRepo.dateConnected + dateUpdated = gitRepo.dateUpdated + gitAccountId = gitRepo.gitAccountId + gitId = gitRepo.gitId + name = gitRepo.name + private_ = gitRepo.private_ + projectId = gitRepo.projectId + slug = gitRepo.slug + url = gitRepo.url + branch = gitRepo.branch + rootDir = gitRepo.rootDir + additionalProperties = gitRepo.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) - - @JsonProperty("gitId") - @ExcludeMissing - fun gitId(gitId: JsonField) = apply { this.gitId = gitId } - fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) - @JsonProperty("dateConnected") - @ExcludeMissing fun dateConnected(dateConnected: JsonField) = apply { this.dateConnected = dateConnected } @@ -1444,73 +1610,58 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - fun branch(branch: String) = branch(JsonField.of(branch)) + fun gitAccountId(gitAccountId: String) = + gitAccountId(JsonField.of(gitAccountId)) - @JsonProperty("branch") - @ExcludeMissing - fun branch(branch: JsonField) = apply { this.branch = branch } + fun gitAccountId(gitAccountId: JsonField) = apply { + this.gitAccountId = gitAccountId + } + + fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) + + fun gitId(gitId: JsonField) = apply { this.gitId = gitId } fun name(name: String) = name(JsonField.of(name)) - @JsonProperty("name") - @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } fun private_(private_: Boolean) = private_(JsonField.of(private_)) - @JsonProperty("private") - @ExcludeMissing fun private_(private_: JsonField) = apply { this.private_ = private_ } + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + + fun projectId(projectId: JsonField) = apply { + this.projectId = projectId + } + fun slug(slug: String) = slug(JsonField.of(slug)) - @JsonProperty("slug") - @ExcludeMissing fun slug(slug: JsonField) = apply { this.slug = slug } fun url(url: String) = url(JsonField.of(url)) - @JsonProperty("url") - @ExcludeMissing fun url(url: JsonField) = apply { this.url = url } - fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) - - @JsonProperty("rootDir") - @ExcludeMissing - fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } - - fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + fun branch(branch: String) = branch(JsonField.of(branch)) - @JsonProperty("projectId") - @ExcludeMissing - fun projectId(projectId: JsonField) = apply { - this.projectId = projectId - } + fun branch(branch: JsonField) = apply { this.branch = branch } - fun gitAccountId(gitAccountId: String) = - gitAccountId(JsonField.of(gitAccountId)) + fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) - @JsonProperty("gitAccountId") - @ExcludeMissing - fun gitAccountId(gitAccountId: JsonField) = apply { - this.gitAccountId = gitAccountId - } + fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1518,20 +1669,28 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): GitRepo = GitRepo( - id, - gitId, - dateConnected, - dateUpdated, + checkRequired("id", id), + checkRequired("dateConnected", dateConnected), + checkRequired("dateUpdated", dateUpdated), + checkRequired("gitAccountId", gitAccountId), + checkRequired("gitId", gitId), + checkRequired("name", name), + checkRequired("private_", private_), + checkRequired("projectId", projectId), + checkRequired("slug", slug), + checkRequired("url", url), branch, - name, - private_, - slug, - url, rootDir, - projectId, - gitAccountId, additionalProperties.toImmutable(), ) } @@ -1541,17 +1700,17 @@ private constructor( return true } - return /* spotless:off */ other is GitRepo && id == other.id && gitId == other.gitId && dateConnected == other.dateConnected && dateUpdated == other.dateUpdated && branch == other.branch && name == other.name && private_ == other.private_ && slug == other.slug && url == other.url && rootDir == other.rootDir && projectId == other.projectId && gitAccountId == other.gitAccountId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GitRepo && id == other.id && dateConnected == other.dateConnected && dateUpdated == other.dateUpdated && gitAccountId == other.gitAccountId && gitId == other.gitId && name == other.name && private_ == other.private_ && projectId == other.projectId && slug == other.slug && url == other.url && branch == other.branch && rootDir == other.rootDir && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, gitId, dateConnected, dateUpdated, branch, name, private_, slug, url, rootDir, projectId, gitAccountId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dateConnected, dateUpdated, gitAccountId, gitId, name, private_, projectId, slug, url, branch, rootDir, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GitRepo{id=$id, gitId=$gitId, dateConnected=$dateConnected, dateUpdated=$dateUpdated, branch=$branch, name=$name, private_=$private_, slug=$slug, url=$url, rootDir=$rootDir, projectId=$projectId, gitAccountId=$gitAccountId, additionalProperties=$additionalProperties}" + "GitRepo{id=$id, dateConnected=$dateConnected, dateUpdated=$dateUpdated, gitAccountId=$gitAccountId, gitId=$gitId, name=$name, private_=$private_, projectId=$projectId, slug=$slug, url=$url, branch=$branch, rootDir=$rootDir, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1559,52 +1718,81 @@ private constructor( return true } - return /* spotless:off */ other is Project && id == other.id && workspaceId == other.workspaceId && creatorId == other.creatorId && name == other.name && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && description == other.description && source == other.source && taskType == other.taskType && versionCount == other.versionCount && inferencePipelineCount == other.inferencePipelineCount && goalCount == other.goalCount && developmentGoalCount == other.developmentGoalCount && monitoringGoalCount == other.monitoringGoalCount && links == other.links && gitRepo == other.gitRepo && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Project && id == other.id && creatorId == other.creatorId && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && developmentGoalCount == other.developmentGoalCount && goalCount == other.goalCount && inferencePipelineCount == other.inferencePipelineCount && links == other.links && monitoringGoalCount == other.monitoringGoalCount && name == other.name && source == other.source && taskType == other.taskType && versionCount == other.versionCount && workspaceId == other.workspaceId && description == other.description && gitRepo == other.gitRepo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, workspaceId, creatorId, name, dateCreated, dateUpdated, description, source, taskType, versionCount, inferencePipelineCount, goalCount, developmentGoalCount, monitoringGoalCount, links, gitRepo, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, creatorId, dateCreated, dateUpdated, developmentGoalCount, goalCount, inferencePipelineCount, links, monitoringGoalCount, name, source, taskType, versionCount, workspaceId, description, gitRepo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Project{id=$id, workspaceId=$workspaceId, creatorId=$creatorId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, source=$source, taskType=$taskType, versionCount=$versionCount, inferencePipelineCount=$inferencePipelineCount, goalCount=$goalCount, developmentGoalCount=$developmentGoalCount, monitoringGoalCount=$monitoringGoalCount, links=$links, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" + "Project{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, developmentGoalCount=$developmentGoalCount, goalCount=$goalCount, inferencePipelineCount=$inferencePipelineCount, links=$links, monitoringGoalCount=$monitoringGoalCount, name=$name, source=$source, taskType=$taskType, versionCount=$versionCount, workspaceId=$workspaceId, description=$description, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Workspace.Builder::class) @NoAutoDetect class Workspace + @JsonCreator private constructor( - private val id: JsonField, - private val name: JsonField, - private val slug: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val creatorId: JsonField, - private val inviteCode: JsonField, - private val wildcardDomains: JsonField>, - private val projectCount: JsonField, - private val memberCount: JsonField, - private val monthlyUsage: JsonField>, - private val inviteCount: JsonField, - private val periodStartDate: JsonField, - private val periodEndDate: JsonField, - private val samlOnlyAccess: JsonField, - private val status: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + private val creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("inviteCount") + @ExcludeMissing + private val inviteCount: JsonField = JsonMissing.of(), + @JsonProperty("memberCount") + @ExcludeMissing + private val memberCount: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("periodEndDate") + @ExcludeMissing + private val periodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("periodStartDate") + @ExcludeMissing + private val periodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("projectCount") + @ExcludeMissing + private val projectCount: JsonField = JsonMissing.of(), + @JsonProperty("slug") + @ExcludeMissing + private val slug: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonProperty("inviteCode") + @ExcludeMissing + private val inviteCode: JsonField = JsonMissing.of(), + @JsonProperty("monthlyUsage") + @ExcludeMissing + private val monthlyUsage: JsonField> = JsonMissing.of(), + @JsonProperty("samlOnlyAccess") + @ExcludeMissing + private val samlOnlyAccess: JsonField = JsonMissing.of(), + @JsonProperty("wildcardDomains") + @ExcludeMissing + private val wildcardDomains: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The workspace id. */ fun id(): String = id.getRequired("id") - /** The workspace name. */ - fun name(): String = name.getRequired("name") - - /** The workspace slug. */ - fun slug(): String = slug.getRequired("slug") + /** The workspace creator id. */ + fun creatorId(): Optional = + Optional.ofNullable(creatorId.getNullable("creatorId")) /** The workspace creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") @@ -1612,116 +1800,142 @@ private constructor( /** The workspace last updated date. */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The workspace creator id. */ - fun creatorId(): Optional = - Optional.ofNullable(creatorId.getNullable("creatorId")) - - /** The workspace invite code. */ - fun inviteCode(): Optional = - Optional.ofNullable(inviteCode.getNullable("inviteCode")) - - fun wildcardDomains(): Optional> = - Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) - - /** The number of projects in the workspace. */ - fun projectCount(): Long = projectCount.getRequired("projectCount") - + /** The number of invites in the workspace. */ + fun inviteCount(): Long = inviteCount.getRequired("inviteCount") + /** The number of members in the workspace. */ fun memberCount(): Long = memberCount.getRequired("memberCount") - fun monthlyUsage(): Optional> = - Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) + /** The workspace name. */ + fun name(): String = name.getRequired("name") - /** The number of invites in the workspace. */ - fun inviteCount(): Long = inviteCount.getRequired("inviteCount") + /** The end date of the current billing period. */ + fun periodEndDate(): Optional = + Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) /** The start date of the current billing period. */ fun periodStartDate(): Optional = Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) - /** The end date of the current billing period. */ - fun periodEndDate(): Optional = - Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) + /** The number of projects in the workspace. */ + fun projectCount(): Long = projectCount.getRequired("projectCount") - /** Whether the workspace only allows SAML authentication. */ - fun samlOnlyAccess(): Optional = - Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) + /** The workspace slug. */ + fun slug(): String = slug.getRequired("slug") fun status(): Status = status.getRequired("status") - /** The workspace id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The workspace invite code. */ + fun inviteCode(): Optional = + Optional.ofNullable(inviteCode.getNullable("inviteCode")) - /** The workspace name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun monthlyUsage(): Optional> = + Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) - /** The workspace slug. */ - @JsonProperty("slug") @ExcludeMissing fun _slug() = slug + /** Whether the workspace only allows SAML authentication. */ + fun samlOnlyAccess(): Optional = + Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) - /** The workspace creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + fun wildcardDomains(): Optional> = + Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) - /** The workspace last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + /** The workspace id. */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The workspace creator id. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + @JsonProperty("creatorId") + @ExcludeMissing + fun _creatorId(): JsonField = creatorId - /** The workspace invite code. */ - @JsonProperty("inviteCode") @ExcludeMissing fun _inviteCode() = inviteCode + /** The workspace creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated - @JsonProperty("wildcardDomains") + /** The workspace last updated date. */ + @JsonProperty("dateUpdated") @ExcludeMissing - fun _wildcardDomains() = wildcardDomains + fun _dateUpdated(): JsonField = dateUpdated - /** The number of projects in the workspace. */ - @JsonProperty("projectCount") @ExcludeMissing fun _projectCount() = projectCount + /** The number of invites in the workspace. */ + @JsonProperty("inviteCount") + @ExcludeMissing + fun _inviteCount(): JsonField = inviteCount /** The number of members in the workspace. */ - @JsonProperty("memberCount") @ExcludeMissing fun _memberCount() = memberCount + @JsonProperty("memberCount") + @ExcludeMissing + fun _memberCount(): JsonField = memberCount - @JsonProperty("monthlyUsage") @ExcludeMissing fun _monthlyUsage() = monthlyUsage + /** The workspace name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The number of invites in the workspace. */ - @JsonProperty("inviteCount") @ExcludeMissing fun _inviteCount() = inviteCount + /** The end date of the current billing period. */ + @JsonProperty("periodEndDate") + @ExcludeMissing + fun _periodEndDate(): JsonField = periodEndDate /** The start date of the current billing period. */ @JsonProperty("periodStartDate") @ExcludeMissing - fun _periodStartDate() = periodStartDate + fun _periodStartDate(): JsonField = periodStartDate - /** The end date of the current billing period. */ - @JsonProperty("periodEndDate") @ExcludeMissing fun _periodEndDate() = periodEndDate + /** The number of projects in the workspace. */ + @JsonProperty("projectCount") + @ExcludeMissing + fun _projectCount(): JsonField = projectCount + + /** The workspace slug. */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** The workspace invite code. */ + @JsonProperty("inviteCode") + @ExcludeMissing + fun _inviteCode(): JsonField = inviteCode + + @JsonProperty("monthlyUsage") + @ExcludeMissing + fun _monthlyUsage(): JsonField> = monthlyUsage /** Whether the workspace only allows SAML authentication. */ - @JsonProperty("samlOnlyAccess") @ExcludeMissing fun _samlOnlyAccess() = samlOnlyAccess + @JsonProperty("samlOnlyAccess") + @ExcludeMissing + fun _samlOnlyAccess(): JsonField = samlOnlyAccess - @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonProperty("wildcardDomains") + @ExcludeMissing + fun _wildcardDomains(): JsonField> = wildcardDomains @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Workspace = apply { - if (!validated) { - id() - name() - slug() - dateCreated() - dateUpdated() - creatorId() - inviteCode() - wildcardDomains() - projectCount() - memberCount() - monthlyUsage().map { it.forEach { it.validate() } } - inviteCount() - periodStartDate() - periodEndDate() - samlOnlyAccess() - status() - validated = true + if (validated) { + return@apply } + + id() + creatorId() + dateCreated() + dateUpdated() + inviteCount() + memberCount() + name() + periodEndDate() + periodStartDate() + projectCount() + slug() + status() + inviteCode() + monthlyUsage().ifPresent { it.forEach { it.validate() } } + samlOnlyAccess() + wildcardDomains() + validated = true } fun toBuilder() = Builder().from(this) @@ -1733,76 +1947,65 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var slug: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() - private var creatorId: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var inviteCount: JsonField? = null + private var memberCount: JsonField? = null + private var name: JsonField? = null + private var periodEndDate: JsonField? = null + private var periodStartDate: JsonField? = null + private var projectCount: JsonField? = null + private var slug: JsonField? = null + private var status: JsonField? = null private var inviteCode: JsonField = JsonMissing.of() - private var wildcardDomains: JsonField> = JsonMissing.of() - private var projectCount: JsonField = JsonMissing.of() - private var memberCount: JsonField = JsonMissing.of() - private var monthlyUsage: JsonField> = JsonMissing.of() - private var inviteCount: JsonField = JsonMissing.of() - private var periodStartDate: JsonField = JsonMissing.of() - private var periodEndDate: JsonField = JsonMissing.of() + private var monthlyUsage: JsonField>? = null private var samlOnlyAccess: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() + private var wildcardDomains: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(workspace: Workspace) = apply { - this.id = workspace.id - this.name = workspace.name - this.slug = workspace.slug - this.dateCreated = workspace.dateCreated - this.dateUpdated = workspace.dateUpdated - this.creatorId = workspace.creatorId - this.inviteCode = workspace.inviteCode - this.wildcardDomains = workspace.wildcardDomains - this.projectCount = workspace.projectCount - this.memberCount = workspace.memberCount - this.monthlyUsage = workspace.monthlyUsage - this.inviteCount = workspace.inviteCount - this.periodStartDate = workspace.periodStartDate - this.periodEndDate = workspace.periodEndDate - this.samlOnlyAccess = workspace.samlOnlyAccess - this.status = workspace.status - additionalProperties(workspace.additionalProperties) + id = workspace.id + creatorId = workspace.creatorId + dateCreated = workspace.dateCreated + dateUpdated = workspace.dateUpdated + inviteCount = workspace.inviteCount + memberCount = workspace.memberCount + name = workspace.name + periodEndDate = workspace.periodEndDate + periodStartDate = workspace.periodStartDate + projectCount = workspace.projectCount + slug = workspace.slug + status = workspace.status + inviteCode = workspace.inviteCode + monthlyUsage = workspace.monthlyUsage.map { it.toMutableList() } + samlOnlyAccess = workspace.samlOnlyAccess + wildcardDomains = workspace.wildcardDomains.map { it.toMutableList() } + additionalProperties = workspace.additionalProperties.toMutableMap() } /** The workspace id. */ fun id(id: String) = id(JsonField.of(id)) /** The workspace id. */ - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - /** The workspace name. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The workspace name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + /** The workspace creator id. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The workspace slug. */ - fun slug(slug: String) = slug(JsonField.of(slug)) + /** The workspace creator id. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) - /** The workspace slug. */ - @JsonProperty("slug") - @ExcludeMissing - fun slug(slug: JsonField) = apply { this.slug = slug } + /** The workspace creator id. */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The workspace creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) /** The workspace creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -1812,98 +2015,102 @@ private constructor( dateUpdated(JsonField.of(dateUpdated)) /** The workspace last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - /** The workspace creator id. */ - fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) + /** The number of invites in the workspace. */ + fun inviteCount(inviteCount: Long) = inviteCount(JsonField.of(inviteCount)) - /** The workspace creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + /** The number of invites in the workspace. */ + fun inviteCount(inviteCount: JsonField) = apply { + this.inviteCount = inviteCount + } - /** The workspace invite code. */ - fun inviteCode(inviteCode: String) = inviteCode(JsonField.of(inviteCode)) + /** The number of members in the workspace. */ + fun memberCount(memberCount: Long) = memberCount(JsonField.of(memberCount)) - /** The workspace invite code. */ - @JsonProperty("inviteCode") - @ExcludeMissing - fun inviteCode(inviteCode: JsonField) = apply { - this.inviteCode = inviteCode + /** The number of members in the workspace. */ + fun memberCount(memberCount: JsonField) = apply { + this.memberCount = memberCount } - fun wildcardDomains(wildcardDomains: List) = - wildcardDomains(JsonField.of(wildcardDomains)) + /** The workspace name. */ + fun name(name: String) = name(JsonField.of(name)) - @JsonProperty("wildcardDomains") - @ExcludeMissing - fun wildcardDomains(wildcardDomains: JsonField>) = apply { - this.wildcardDomains = wildcardDomains + /** The workspace name. */ + fun name(name: JsonField) = apply { this.name = name } + + /** The end date of the current billing period. */ + fun periodEndDate(periodEndDate: OffsetDateTime?) = + periodEndDate(JsonField.ofNullable(periodEndDate)) + + /** The end date of the current billing period. */ + fun periodEndDate(periodEndDate: Optional) = + periodEndDate(periodEndDate.orElse(null)) + + /** The end date of the current billing period. */ + fun periodEndDate(periodEndDate: JsonField) = apply { + this.periodEndDate = periodEndDate + } + + /** The start date of the current billing period. */ + fun periodStartDate(periodStartDate: OffsetDateTime?) = + periodStartDate(JsonField.ofNullable(periodStartDate)) + + /** The start date of the current billing period. */ + fun periodStartDate(periodStartDate: Optional) = + periodStartDate(periodStartDate.orElse(null)) + + /** The start date of the current billing period. */ + fun periodStartDate(periodStartDate: JsonField) = apply { + this.periodStartDate = periodStartDate } /** The number of projects in the workspace. */ fun projectCount(projectCount: Long) = projectCount(JsonField.of(projectCount)) /** The number of projects in the workspace. */ - @JsonProperty("projectCount") - @ExcludeMissing fun projectCount(projectCount: JsonField) = apply { this.projectCount = projectCount } - /** The number of members in the workspace. */ - fun memberCount(memberCount: Long) = memberCount(JsonField.of(memberCount)) + /** The workspace slug. */ + fun slug(slug: String) = slug(JsonField.of(slug)) - /** The number of members in the workspace. */ - @JsonProperty("memberCount") - @ExcludeMissing - fun memberCount(memberCount: JsonField) = apply { - this.memberCount = memberCount - } + /** The workspace slug. */ + fun slug(slug: JsonField) = apply { this.slug = slug } - fun monthlyUsage(monthlyUsage: List) = - monthlyUsage(JsonField.of(monthlyUsage)) + fun status(status: Status) = status(JsonField.of(status)) - @JsonProperty("monthlyUsage") - @ExcludeMissing - fun monthlyUsage(monthlyUsage: JsonField>) = apply { - this.monthlyUsage = monthlyUsage - } + fun status(status: JsonField) = apply { this.status = status } - /** The number of invites in the workspace. */ - fun inviteCount(inviteCount: Long) = inviteCount(JsonField.of(inviteCount)) + /** The workspace invite code. */ + fun inviteCode(inviteCode: String) = inviteCode(JsonField.of(inviteCode)) - /** The number of invites in the workspace. */ - @JsonProperty("inviteCount") - @ExcludeMissing - fun inviteCount(inviteCount: JsonField) = apply { - this.inviteCount = inviteCount + /** The workspace invite code. */ + fun inviteCode(inviteCode: JsonField) = apply { + this.inviteCode = inviteCode } - /** The start date of the current billing period. */ - fun periodStartDate(periodStartDate: OffsetDateTime) = - periodStartDate(JsonField.of(periodStartDate)) + fun monthlyUsage(monthlyUsage: List) = + monthlyUsage(JsonField.of(monthlyUsage)) - /** The start date of the current billing period. */ - @JsonProperty("periodStartDate") - @ExcludeMissing - fun periodStartDate(periodStartDate: JsonField) = apply { - this.periodStartDate = periodStartDate + fun monthlyUsage(monthlyUsage: JsonField>) = apply { + this.monthlyUsage = monthlyUsage.map { it.toMutableList() } } - /** The end date of the current billing period. */ - fun periodEndDate(periodEndDate: OffsetDateTime) = - periodEndDate(JsonField.of(periodEndDate)) - - /** The end date of the current billing period. */ - @JsonProperty("periodEndDate") - @ExcludeMissing - fun periodEndDate(periodEndDate: JsonField) = apply { - this.periodEndDate = periodEndDate + fun addMonthlyUsage(monthlyUsage: MonthlyUsage) = apply { + this.monthlyUsage = + (this.monthlyUsage ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(monthlyUsage) + } } /** Whether the workspace only allows SAML authentication. */ @@ -1911,26 +2118,37 @@ private constructor( samlOnlyAccess(JsonField.of(samlOnlyAccess)) /** Whether the workspace only allows SAML authentication. */ - @JsonProperty("samlOnlyAccess") - @ExcludeMissing fun samlOnlyAccess(samlOnlyAccess: JsonField) = apply { this.samlOnlyAccess = samlOnlyAccess } - fun status(status: Status) = status(JsonField.of(status)) + fun wildcardDomains(wildcardDomains: List) = + wildcardDomains(JsonField.of(wildcardDomains)) - @JsonProperty("status") - @ExcludeMissing - fun status(status: JsonField) = apply { this.status = status } + fun wildcardDomains(wildcardDomains: JsonField>) = apply { + this.wildcardDomains = wildcardDomains.map { it.toMutableList() } + } + + fun addWildcardDomain(wildcardDomain: String) = apply { + wildcardDomains = + (wildcardDomains ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(wildcardDomain) + } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1938,24 +2156,32 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Workspace = Workspace( - id, - name, - slug, - dateCreated, - dateUpdated, - creatorId, + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("inviteCount", inviteCount), + checkRequired("memberCount", memberCount), + checkRequired("name", name), + checkRequired("periodEndDate", periodEndDate), + checkRequired("periodStartDate", periodStartDate), + checkRequired("projectCount", projectCount), + checkRequired("slug", slug), + checkRequired("status", status), inviteCode, - wildcardDomains.map { it.toImmutable() }, - projectCount, - memberCount, - monthlyUsage.map { it.toImmutable() }, - inviteCount, - periodStartDate, - periodEndDate, + (monthlyUsage ?: JsonMissing.of()).map { it.toImmutable() }, samlOnlyAccess, - status, + (wildcardDomains ?: JsonMissing.of()).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -2053,17 +2279,25 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = MonthlyUsage.Builder::class) @NoAutoDetect class MonthlyUsage + @JsonCreator private constructor( - private val monthYear: JsonField, - private val predictionCount: JsonField, - private val executionTimeMs: JsonField, - private val additionalProperties: Map, + @JsonProperty("executionTimeMs") + @ExcludeMissing + private val executionTimeMs: JsonField = JsonMissing.of(), + @JsonProperty("monthYear") + @ExcludeMissing + private val monthYear: JsonField = JsonMissing.of(), + @JsonProperty("predictionCount") + @ExcludeMissing + private val predictionCount: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + fun executionTimeMs(): Optional = + Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) fun monthYear(): Optional = Optional.ofNullable(monthYear.getNullable("monthYear")) @@ -2071,30 +2305,33 @@ private constructor( fun predictionCount(): Optional = Optional.ofNullable(predictionCount.getNullable("predictionCount")) - fun executionTimeMs(): Optional = - Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) - - @JsonProperty("monthYear") @ExcludeMissing fun _monthYear() = monthYear + @JsonProperty("executionTimeMs") + @ExcludeMissing + fun _executionTimeMs(): JsonField = executionTimeMs - @JsonProperty("predictionCount") + @JsonProperty("monthYear") @ExcludeMissing - fun _predictionCount() = predictionCount + fun _monthYear(): JsonField = monthYear - @JsonProperty("executionTimeMs") + @JsonProperty("predictionCount") @ExcludeMissing - fun _executionTimeMs() = executionTimeMs + fun _predictionCount(): JsonField = predictionCount @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): MonthlyUsage = apply { - if (!validated) { - monthYear() - predictionCount() - executionTimeMs() - validated = true + if (validated) { + return@apply } + + executionTimeMs() + monthYear() + predictionCount() + validated = true } fun toBuilder() = Builder().from(this) @@ -2106,23 +2343,35 @@ private constructor( class Builder { + private var executionTimeMs: JsonField = JsonMissing.of() private var monthYear: JsonField = JsonMissing.of() private var predictionCount: JsonField = JsonMissing.of() - private var executionTimeMs: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(monthlyUsage: MonthlyUsage) = apply { - this.monthYear = monthlyUsage.monthYear - this.predictionCount = monthlyUsage.predictionCount - this.executionTimeMs = monthlyUsage.executionTimeMs - additionalProperties(monthlyUsage.additionalProperties) + executionTimeMs = monthlyUsage.executionTimeMs + monthYear = monthlyUsage.monthYear + predictionCount = monthlyUsage.predictionCount + additionalProperties = monthlyUsage.additionalProperties.toMutableMap() + } + + fun executionTimeMs(executionTimeMs: Long?) = + executionTimeMs(JsonField.ofNullable(executionTimeMs)) + + fun executionTimeMs(executionTimeMs: Long) = + executionTimeMs(executionTimeMs as Long?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun executionTimeMs(executionTimeMs: Optional) = + executionTimeMs(executionTimeMs.orElse(null) as Long?) + + fun executionTimeMs(executionTimeMs: JsonField) = apply { + this.executionTimeMs = executionTimeMs } fun monthYear(monthYear: LocalDate) = monthYear(JsonField.of(monthYear)) - @JsonProperty("monthYear") - @ExcludeMissing fun monthYear(monthYear: JsonField) = apply { this.monthYear = monthYear } @@ -2130,29 +2379,17 @@ private constructor( fun predictionCount(predictionCount: Long) = predictionCount(JsonField.of(predictionCount)) - @JsonProperty("predictionCount") - @ExcludeMissing fun predictionCount(predictionCount: JsonField) = apply { this.predictionCount = predictionCount } - fun executionTimeMs(executionTimeMs: Long) = - executionTimeMs(JsonField.of(executionTimeMs)) - - @JsonProperty("executionTimeMs") - @ExcludeMissing - fun executionTimeMs(executionTimeMs: JsonField) = apply { - this.executionTimeMs = executionTimeMs - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -2160,11 +2397,19 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): MonthlyUsage = MonthlyUsage( + executionTimeMs, monthYear, predictionCount, - executionTimeMs, additionalProperties.toImmutable(), ) } @@ -2174,17 +2419,17 @@ private constructor( return true } - return /* spotless:off */ other is MonthlyUsage && monthYear == other.monthYear && predictionCount == other.predictionCount && executionTimeMs == other.executionTimeMs && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MonthlyUsage && executionTimeMs == other.executionTimeMs && monthYear == other.monthYear && predictionCount == other.predictionCount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(monthYear, predictionCount, executionTimeMs, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(executionTimeMs, monthYear, predictionCount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MonthlyUsage{monthYear=$monthYear, predictionCount=$predictionCount, executionTimeMs=$executionTimeMs, additionalProperties=$additionalProperties}" + "MonthlyUsage{executionTimeMs=$executionTimeMs, monthYear=$monthYear, predictionCount=$predictionCount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2192,17 +2437,17 @@ private constructor( return true } - return /* spotless:off */ other is Workspace && id == other.id && name == other.name && slug == other.slug && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && creatorId == other.creatorId && inviteCode == other.inviteCode && wildcardDomains == other.wildcardDomains && projectCount == other.projectCount && memberCount == other.memberCount && monthlyUsage == other.monthlyUsage && inviteCount == other.inviteCount && periodStartDate == other.periodStartDate && periodEndDate == other.periodEndDate && samlOnlyAccess == other.samlOnlyAccess && status == other.status && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Workspace && id == other.id && creatorId == other.creatorId && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && inviteCount == other.inviteCount && memberCount == other.memberCount && name == other.name && periodEndDate == other.periodEndDate && periodStartDate == other.periodStartDate && projectCount == other.projectCount && slug == other.slug && status == other.status && inviteCode == other.inviteCode && monthlyUsage == other.monthlyUsage && samlOnlyAccess == other.samlOnlyAccess && wildcardDomains == other.wildcardDomains && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, name, slug, dateCreated, dateUpdated, creatorId, inviteCode, wildcardDomains, projectCount, memberCount, monthlyUsage, inviteCount, periodStartDate, periodEndDate, samlOnlyAccess, status, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, creatorId, dateCreated, dateUpdated, inviteCount, memberCount, name, periodEndDate, periodStartDate, projectCount, slug, status, inviteCode, monthlyUsage, samlOnlyAccess, wildcardDomains, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Workspace{id=$id, name=$name, slug=$slug, dateCreated=$dateCreated, dateUpdated=$dateUpdated, creatorId=$creatorId, inviteCode=$inviteCode, wildcardDomains=$wildcardDomains, projectCount=$projectCount, memberCount=$memberCount, monthlyUsage=$monthlyUsage, inviteCount=$inviteCount, periodStartDate=$periodStartDate, periodEndDate=$periodEndDate, samlOnlyAccess=$samlOnlyAccess, status=$status, additionalProperties=$additionalProperties}" + "Workspace{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, inviteCount=$inviteCount, memberCount=$memberCount, name=$name, periodEndDate=$periodEndDate, periodStartDate=$periodStartDate, projectCount=$projectCount, slug=$slug, status=$status, inviteCode=$inviteCode, monthlyUsage=$monthlyUsage, samlOnlyAccess=$samlOnlyAccess, wildcardDomains=$wildcardDomains, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2210,17 +2455,17 @@ private constructor( return true } - return /* spotless:off */ other is Item && id == other.id && projectId == other.projectId && workspaceId == other.workspaceId && project == other.project && workspace == other.workspace && name == other.name && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && dateLastSampleReceived == other.dateLastSampleReceived && description == other.description && dateLastEvaluated == other.dateLastEvaluated && dateOfNextEvaluation == other.dateOfNextEvaluation && passingGoalCount == other.passingGoalCount && failingGoalCount == other.failingGoalCount && totalGoalCount == other.totalGoalCount && status == other.status && statusMessage == other.statusMessage && links == other.links && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Item && id == other.id && dateCreated == other.dateCreated && dateLastEvaluated == other.dateLastEvaluated && dateLastSampleReceived == other.dateLastSampleReceived && dateOfNextEvaluation == other.dateOfNextEvaluation && dateUpdated == other.dateUpdated && description == other.description && failingGoalCount == other.failingGoalCount && links == other.links && name == other.name && passingGoalCount == other.passingGoalCount && projectId == other.projectId && status == other.status && statusMessage == other.statusMessage && totalGoalCount == other.totalGoalCount && project == other.project && workspace == other.workspace && workspaceId == other.workspaceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, projectId, workspaceId, project, workspace, name, dateCreated, dateUpdated, dateLastSampleReceived, description, dateLastEvaluated, dateOfNextEvaluation, passingGoalCount, failingGoalCount, totalGoalCount, status, statusMessage, links, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dateCreated, dateLastEvaluated, dateLastSampleReceived, dateOfNextEvaluation, dateUpdated, description, failingGoalCount, links, name, passingGoalCount, projectId, status, statusMessage, totalGoalCount, project, workspace, workspaceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Item{id=$id, projectId=$projectId, workspaceId=$workspaceId, project=$project, workspace=$workspace, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, dateLastSampleReceived=$dateLastSampleReceived, description=$description, dateLastEvaluated=$dateLastEvaluated, dateOfNextEvaluation=$dateOfNextEvaluation, passingGoalCount=$passingGoalCount, failingGoalCount=$failingGoalCount, totalGoalCount=$totalGoalCount, status=$status, statusMessage=$statusMessage, links=$links, additionalProperties=$additionalProperties}" + "Item{id=$id, dateCreated=$dateCreated, dateLastEvaluated=$dateLastEvaluated, dateLastSampleReceived=$dateLastSampleReceived, dateOfNextEvaluation=$dateOfNextEvaluation, dateUpdated=$dateUpdated, description=$description, failingGoalCount=$failingGoalCount, links=$links, name=$name, passingGoalCount=$passingGoalCount, projectId=$projectId, status=$status, statusMessage=$statusMessage, totalGoalCount=$totalGoalCount, project=$project, workspace=$workspace, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt index c4959e47..56b6e224 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt @@ -12,6 +12,7 @@ import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects import java.util.Optional +/** List your workspace's projects. */ class ProjectListParams constructor( private val name: String?, @@ -22,12 +23,16 @@ constructor( private val additionalQueryParams: QueryParams, ) { + /** Filter list of items by project name. */ fun name(): Optional = Optional.ofNullable(name) + /** The page to return in a paginated query. */ fun page(): Optional = Optional.ofNullable(page) + /** Maximum number of items to return per page. */ fun perPage(): Optional = Optional.ofNullable(perPage) + /** Filter list of items by task type. */ fun taskType(): Optional = Optional.ofNullable(taskType) fun _additionalHeaders(): Headers = additionalHeaders @@ -75,16 +80,36 @@ constructor( } /** Filter list of items by project name. */ - fun name(name: String) = apply { this.name = name } + fun name(name: String?) = apply { this.name = name } + + /** Filter list of items by project name. */ + fun name(name: Optional) = name(name.orElse(null)) + + /** The page to return in a paginated query. */ + fun page(page: Long?) = apply { this.page = page } + + /** The page to return in a paginated query. */ + fun page(page: Long) = page(page as Long?) /** The page to return in a paginated query. */ - fun page(page: Long) = apply { this.page = page } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun page(page: Optional) = page(page.orElse(null) as Long?) /** Maximum number of items to return per page. */ - fun perPage(perPage: Long) = apply { this.perPage = perPage } + fun perPage(perPage: Long?) = apply { this.perPage = perPage } + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long) = perPage(perPage as Long?) + + /** Maximum number of items to return per page. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun perPage(perPage: Optional) = perPage(perPage.orElse(null) as Long?) + + /** Filter list of items by task type. */ + fun taskType(taskType: TaskType?) = apply { this.taskType = taskType } /** Filter list of items by task type. */ - fun taskType(taskType: TaskType) = apply { this.taskType = taskType } + fun taskType(taskType: Optional) = taskType(taskType.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -195,6 +220,7 @@ constructor( ) } + /** Filter list of items by task type. */ class TaskType @JsonCreator private constructor( diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt index df9e294c..f4fe5d71 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt @@ -6,42 +6,47 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.Enum import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = ProjectListResponse.Builder::class) @NoAutoDetect class ProjectListResponse +@JsonCreator private constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") + @ExcludeMissing + private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun items(): List = items.getRequired("items") - @JsonProperty("items") @ExcludeMissing fun _items() = items + @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): ProjectListResponse = apply { - if (!validated) { - items().forEach { it.validate() } - validated = true + if (validated) { + return@apply } + + items().forEach { it.validate() } + validated = true } fun toBuilder() = Builder().from(this) @@ -53,86 +58,144 @@ private constructor( class Builder { - private var items: JsonField> = JsonMissing.of() + private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(projectListResponse: ProjectListResponse) = apply { - this.items = projectListResponse.items - additionalProperties(projectListResponse.additionalProperties) + items = projectListResponse.items.map { it.toMutableList() } + additionalProperties = projectListResponse.additionalProperties.toMutableMap() } fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") - @ExcludeMissing - fun items(items: JsonField>) = apply { this.items = items } + fun items(items: JsonField>) = apply { + this.items = items.map { it.toMutableList() } + } + + fun addItem(item: Item) = apply { + items = + (items ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(item) + } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): ProjectListResponse = - ProjectListResponse(items.map { it.toImmutable() }, additionalProperties.toImmutable()) + ProjectListResponse( + checkRequired("items", items).map { it.toImmutable() }, + additionalProperties.toImmutable() + ) } - @JsonDeserialize(builder = Item.Builder::class) @NoAutoDetect class Item + @JsonCreator private constructor( - private val id: JsonField, - private val workspaceId: JsonField, - private val creatorId: JsonField, - private val name: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val description: JsonField, - private val source: JsonField, - private val taskType: JsonField, - private val versionCount: JsonField, - private val inferencePipelineCount: JsonField, - private val goalCount: JsonField, - private val developmentGoalCount: JsonField, - private val monitoringGoalCount: JsonField, - private val links: JsonField, - private val gitRepo: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + private val creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("developmentGoalCount") + @ExcludeMissing + private val developmentGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("goalCount") + @ExcludeMissing + private val goalCount: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + private val inferencePipelineCount: JsonField = JsonMissing.of(), + @JsonProperty("links") + @ExcludeMissing + private val links: JsonField = JsonMissing.of(), + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + private val monitoringGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("source") + @ExcludeMissing + private val source: JsonField = JsonMissing.of(), + @JsonProperty("taskType") + @ExcludeMissing + private val taskType: JsonField = JsonMissing.of(), + @JsonProperty("versionCount") + @ExcludeMissing + private val versionCount: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + private val workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("gitRepo") + @ExcludeMissing + private val gitRepo: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The project id. */ fun id(): String = id.getRequired("id") - /** The workspace id. */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The project creator id. */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The project name. */ - fun name(): String = name.getRequired("name") - /** The project creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") /** The project last updated date. */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The project description. */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") + + /** The total number of tests in the project. */ + fun goalCount(): Long = goalCount.getRequired("goalCount") + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(): Long = + inferencePipelineCount.getRequired("inferencePipelineCount") + + /** Links to the project. */ + fun links(): Links = links.getRequired("links") + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") + + /** The project name. */ + fun name(): String = name.getRequired("name") /** The source of the project. */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) @@ -143,101 +206,107 @@ private constructor( /** The number of versions (commits) in the project. */ fun versionCount(): Long = versionCount.getRequired("versionCount") - /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(): Long = - inferencePipelineCount.getRequired("inferencePipelineCount") - - /** The total number of tests in the project. */ - fun goalCount(): Long = goalCount.getRequired("goalCount") - - /** The number of tests in the development mode of the project. */ - fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") - - /** The number of tests in the monitoring mode of the project. */ - fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") + /** The workspace id. */ + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** Links to the project. */ - fun links(): Links = links.getRequired("links") + /** The project description. */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) /** The project id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id - - /** The workspace id. */ - @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId() = workspaceId + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The project creator id. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId - - /** The project name. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId /** The project creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated /** The project last updated date. */ - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated - - /** The project description. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description - - /** The source of the project. */ - @JsonProperty("source") @ExcludeMissing fun _source() = source + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - /** The task type of the project. */ - @JsonProperty("taskType") @ExcludeMissing fun _taskType() = taskType + /** The number of tests in the development mode of the project. */ + @JsonProperty("developmentGoalCount") + @ExcludeMissing + fun _developmentGoalCount(): JsonField = developmentGoalCount - /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") @ExcludeMissing fun _versionCount() = versionCount + /** The total number of tests in the project. */ + @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount /** The number of inference pipelines in the project. */ @JsonProperty("inferencePipelineCount") @ExcludeMissing - fun _inferencePipelineCount() = inferencePipelineCount - - /** The total number of tests in the project. */ - @JsonProperty("goalCount") @ExcludeMissing fun _goalCount() = goalCount + fun _inferencePipelineCount(): JsonField = inferencePipelineCount - /** The number of tests in the development mode of the project. */ - @JsonProperty("developmentGoalCount") - @ExcludeMissing - fun _developmentGoalCount() = developmentGoalCount + /** Links to the project. */ + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links /** The number of tests in the monitoring mode of the project. */ @JsonProperty("monitoringGoalCount") @ExcludeMissing - fun _monitoringGoalCount() = monitoringGoalCount + fun _monitoringGoalCount(): JsonField = monitoringGoalCount - /** Links to the project. */ - @JsonProperty("links") @ExcludeMissing fun _links() = links + /** The project name. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** The source of the project. */ + @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source + + /** The task type of the project. */ + @JsonProperty("taskType") @ExcludeMissing fun _taskType(): JsonField = taskType + + /** The number of versions (commits) in the project. */ + @JsonProperty("versionCount") + @ExcludeMissing + fun _versionCount(): JsonField = versionCount + + /** The workspace id. */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** The project description. */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description - @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo() = gitRepo + @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Item = apply { - if (!validated) { - id() - workspaceId() - creatorId() - name() - dateCreated() - dateUpdated() - description() - source() - taskType() - versionCount() - inferencePipelineCount() - goalCount() - developmentGoalCount() - monitoringGoalCount() - links().validate() - gitRepo().map { it.validate() } - validated = true + if (validated) { + return@apply } + + id() + creatorId() + dateCreated() + dateUpdated() + developmentGoalCount() + goalCount() + inferencePipelineCount() + links().validate() + monitoringGoalCount() + name() + source() + taskType() + versionCount() + workspaceId() + description() + gitRepo().ifPresent { it.validate() } + validated = true } fun toBuilder() = Builder().from(this) @@ -249,85 +318,64 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var workspaceId: JsonField = JsonMissing.of() - private var creatorId: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var developmentGoalCount: JsonField? = null + private var goalCount: JsonField? = null + private var inferencePipelineCount: JsonField? = null + private var links: JsonField? = null + private var monitoringGoalCount: JsonField? = null + private var name: JsonField? = null + private var source: JsonField? = null + private var taskType: JsonField? = null + private var versionCount: JsonField? = null + private var workspaceId: JsonField? = null private var description: JsonField = JsonMissing.of() - private var source: JsonField = JsonMissing.of() - private var taskType: JsonField = JsonMissing.of() - private var versionCount: JsonField = JsonMissing.of() - private var inferencePipelineCount: JsonField = JsonMissing.of() - private var goalCount: JsonField = JsonMissing.of() - private var developmentGoalCount: JsonField = JsonMissing.of() - private var monitoringGoalCount: JsonField = JsonMissing.of() - private var links: JsonField = JsonMissing.of() private var gitRepo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(item: Item) = apply { - this.id = item.id - this.workspaceId = item.workspaceId - this.creatorId = item.creatorId - this.name = item.name - this.dateCreated = item.dateCreated - this.dateUpdated = item.dateUpdated - this.description = item.description - this.source = item.source - this.taskType = item.taskType - this.versionCount = item.versionCount - this.inferencePipelineCount = item.inferencePipelineCount - this.goalCount = item.goalCount - this.developmentGoalCount = item.developmentGoalCount - this.monitoringGoalCount = item.monitoringGoalCount - this.links = item.links - this.gitRepo = item.gitRepo - additionalProperties(item.additionalProperties) + id = item.id + creatorId = item.creatorId + dateCreated = item.dateCreated + dateUpdated = item.dateUpdated + developmentGoalCount = item.developmentGoalCount + goalCount = item.goalCount + inferencePipelineCount = item.inferencePipelineCount + links = item.links + monitoringGoalCount = item.monitoringGoalCount + name = item.name + source = item.source + taskType = item.taskType + versionCount = item.versionCount + workspaceId = item.workspaceId + description = item.description + gitRepo = item.gitRepo + additionalProperties = item.additionalProperties.toMutableMap() } /** The project id. */ fun id(id: String) = id(JsonField.of(id)) /** The project id. */ - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - /** The workspace id. */ - fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) - - /** The workspace id. */ - @JsonProperty("workspaceId") - @ExcludeMissing - fun workspaceId(workspaceId: JsonField) = apply { - this.workspaceId = workspaceId - } + /** The project creator id. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The project creator id. */ - fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) /** The project creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } - /** The project name. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The project name. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) /** The project creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -336,163 +384,176 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) /** The project last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - /** The project description. */ - fun description(description: String) = description(JsonField.of(description)) + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: Long) = + developmentGoalCount(JsonField.of(developmentGoalCount)) - /** The project description. */ - @JsonProperty("description") - @ExcludeMissing - fun description(description: JsonField) = apply { - this.description = description + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: JsonField) = apply { + this.developmentGoalCount = developmentGoalCount + } + + /** The total number of tests in the project. */ + fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) + + /** The total number of tests in the project. */ + fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(inferencePipelineCount: Long) = + inferencePipelineCount(JsonField.of(inferencePipelineCount)) + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { + this.inferencePipelineCount = inferencePipelineCount } + /** Links to the project. */ + fun links(links: Links) = links(JsonField.of(links)) + + /** Links to the project. */ + fun links(links: JsonField) = apply { this.links = links } + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(monitoringGoalCount: Long) = + monitoringGoalCount(JsonField.of(monitoringGoalCount)) + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { + this.monitoringGoalCount = monitoringGoalCount + } + + /** The project name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The project name. */ + fun name(name: JsonField) = apply { this.name = name } + /** The source of the project. */ - fun source(source: Source) = source(JsonField.of(source)) + fun source(source: Source?) = source(JsonField.ofNullable(source)) + + /** The source of the project. */ + fun source(source: Optional) = source(source.orElse(null)) /** The source of the project. */ - @JsonProperty("source") - @ExcludeMissing fun source(source: JsonField) = apply { this.source = source } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) /** The task type of the project. */ - @JsonProperty("taskType") - @ExcludeMissing fun taskType(taskType: JsonField) = apply { this.taskType = taskType } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") - @ExcludeMissing fun versionCount(versionCount: JsonField) = apply { this.versionCount = versionCount } - /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(inferencePipelineCount: Long) = - inferencePipelineCount(JsonField.of(inferencePipelineCount)) - - /** The number of inference pipelines in the project. */ - @JsonProperty("inferencePipelineCount") - @ExcludeMissing - fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { - this.inferencePipelineCount = inferencePipelineCount - } - - /** The total number of tests in the project. */ - fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) - - /** The total number of tests in the project. */ - @JsonProperty("goalCount") - @ExcludeMissing - fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } + /** The workspace id. */ + fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) - /** The number of tests in the development mode of the project. */ - fun developmentGoalCount(developmentGoalCount: Long) = - developmentGoalCount(JsonField.of(developmentGoalCount)) + /** The workspace id. */ + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.orElse(null)) - /** The number of tests in the development mode of the project. */ - @JsonProperty("developmentGoalCount") - @ExcludeMissing - fun developmentGoalCount(developmentGoalCount: JsonField) = apply { - this.developmentGoalCount = developmentGoalCount + /** The workspace id. */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId } - /** The number of tests in the monitoring mode of the project. */ - fun monitoringGoalCount(monitoringGoalCount: Long) = - monitoringGoalCount(JsonField.of(monitoringGoalCount)) + /** The project description. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) - /** The number of tests in the monitoring mode of the project. */ - @JsonProperty("monitoringGoalCount") - @ExcludeMissing - fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { - this.monitoringGoalCount = monitoringGoalCount - } + /** The project description. */ + fun description(description: Optional) = description(description.orElse(null)) - /** Links to the project. */ - fun links(links: Links) = links(JsonField.of(links)) + /** The project description. */ + fun description(description: JsonField) = apply { + this.description = description + } - /** Links to the project. */ - @JsonProperty("links") - @ExcludeMissing - fun links(links: JsonField) = apply { this.links = links } + fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) - fun gitRepo(gitRepo: GitRepo) = gitRepo(JsonField.of(gitRepo)) + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.orElse(null)) - @JsonProperty("gitRepo") - @ExcludeMissing fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Item = Item( - id, - workspaceId, - creatorId, - name, - dateCreated, - dateUpdated, + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("developmentGoalCount", developmentGoalCount), + checkRequired("goalCount", goalCount), + checkRequired("inferencePipelineCount", inferencePipelineCount), + checkRequired("links", links), + checkRequired("monitoringGoalCount", monitoringGoalCount), + checkRequired("name", name), + checkRequired("source", source), + checkRequired("taskType", taskType), + checkRequired("versionCount", versionCount), + checkRequired("workspaceId", workspaceId), description, - source, - taskType, - versionCount, - inferencePipelineCount, - goalCount, - developmentGoalCount, - monitoringGoalCount, - links, gitRepo, additionalProperties.toImmutable(), ) } /** Links to the project. */ - @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect class Links + @JsonCreator private constructor( - private val app: JsonField, - private val additionalProperties: Map, + @JsonProperty("app") + @ExcludeMissing + private val app: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun app(): String = app.getRequired("app") - @JsonProperty("app") @ExcludeMissing fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Links = apply { - if (!validated) { - app() - validated = true + if (validated) { + return@apply } + + app() + validated = true } fun toBuilder() = Builder().from(this) @@ -504,29 +565,26 @@ private constructor( class Builder { - private var app: JsonField = JsonMissing.of() + private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) + app = links.app + additionalProperties = links.additionalProperties.toMutableMap() } fun app(app: String) = app(JsonField.of(app)) - @JsonProperty("app") - @ExcludeMissing fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -534,7 +592,16 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toImmutable()) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Links = + Links(checkRequired("app", app), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -554,6 +621,7 @@ private constructor( override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } + /** The source of the project. */ class Source @JsonCreator private constructor( @@ -617,6 +685,7 @@ private constructor( override fun toString() = value.toString() } + /** The task type of the project. */ class TaskType @JsonCreator private constructor( @@ -686,95 +755,130 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = GitRepo.Builder::class) @NoAutoDetect class GitRepo + @JsonCreator private constructor( - private val id: JsonField, - private val gitId: JsonField, - private val dateConnected: JsonField, - private val dateUpdated: JsonField, - private val branch: JsonField, - private val name: JsonField, - private val private_: JsonField, - private val slug: JsonField, - private val url: JsonField, - private val rootDir: JsonField, - private val projectId: JsonField, - private val gitAccountId: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("dateConnected") + @ExcludeMissing + private val dateConnected: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("gitAccountId") + @ExcludeMissing + private val gitAccountId: JsonField = JsonMissing.of(), + @JsonProperty("gitId") + @ExcludeMissing + private val gitId: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("private") + @ExcludeMissing + private val private_: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + private val projectId: JsonField = JsonMissing.of(), + @JsonProperty("slug") + @ExcludeMissing + private val slug: JsonField = JsonMissing.of(), + @JsonProperty("url") + @ExcludeMissing + private val url: JsonField = JsonMissing.of(), + @JsonProperty("branch") + @ExcludeMissing + private val branch: JsonField = JsonMissing.of(), + @JsonProperty("rootDir") + @ExcludeMissing + private val rootDir: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): String = id.getRequired("id") - fun gitId(): Long = gitId.getRequired("gitId") - fun dateConnected(): OffsetDateTime = dateConnected.getRequired("dateConnected") fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + + fun gitId(): Long = gitId.getRequired("gitId") fun name(): String = name.getRequired("name") fun private_(): Boolean = private_.getRequired("private") + fun projectId(): String = projectId.getRequired("projectId") + fun slug(): String = slug.getRequired("slug") fun url(): String = url.getRequired("url") - fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) - - fun projectId(): String = projectId.getRequired("projectId") + fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) - fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - @JsonProperty("gitId") @ExcludeMissing fun _gitId() = gitId + @JsonProperty("dateConnected") + @ExcludeMissing + fun _dateConnected(): JsonField = dateConnected - @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected() = dateConnected + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + @JsonProperty("gitAccountId") + @ExcludeMissing + fun _gitAccountId(): JsonField = gitAccountId - @JsonProperty("branch") @ExcludeMissing fun _branch() = branch + @JsonProperty("gitId") @ExcludeMissing fun _gitId(): JsonField = gitId - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - @JsonProperty("private") @ExcludeMissing fun _private_() = private_ + @JsonProperty("private") @ExcludeMissing fun _private_(): JsonField = private_ - @JsonProperty("slug") @ExcludeMissing fun _slug() = slug + @JsonProperty("projectId") + @ExcludeMissing + fun _projectId(): JsonField = projectId - @JsonProperty("url") @ExcludeMissing fun _url() = url + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - @JsonProperty("rootDir") @ExcludeMissing fun _rootDir() = rootDir + @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch - @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId() = gitAccountId + @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): GitRepo = apply { - if (!validated) { - id() - gitId() - dateConnected() - dateUpdated() - branch() - name() - private_() - slug() - url() - rootDir() - projectId() - gitAccountId() - validated = true + if (validated) { + return@apply } + + id() + dateConnected() + dateUpdated() + gitAccountId() + gitId() + name() + private_() + projectId() + slug() + url() + branch() + rootDir() + validated = true } fun toBuilder() = Builder().from(this) @@ -786,54 +890,44 @@ private constructor( class Builder { - private var id: JsonField = JsonMissing.of() - private var gitId: JsonField = JsonMissing.of() - private var dateConnected: JsonField = JsonMissing.of() - private var dateUpdated: JsonField = JsonMissing.of() + private var id: JsonField? = null + private var dateConnected: JsonField? = null + private var dateUpdated: JsonField? = null + private var gitAccountId: JsonField? = null + private var gitId: JsonField? = null + private var name: JsonField? = null + private var private_: JsonField? = null + private var projectId: JsonField? = null + private var slug: JsonField? = null + private var url: JsonField? = null private var branch: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var private_: JsonField = JsonMissing.of() - private var slug: JsonField = JsonMissing.of() - private var url: JsonField = JsonMissing.of() private var rootDir: JsonField = JsonMissing.of() - private var projectId: JsonField = JsonMissing.of() - private var gitAccountId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(gitRepo: GitRepo) = apply { - this.id = gitRepo.id - this.gitId = gitRepo.gitId - this.dateConnected = gitRepo.dateConnected - this.dateUpdated = gitRepo.dateUpdated - this.branch = gitRepo.branch - this.name = gitRepo.name - this.private_ = gitRepo.private_ - this.slug = gitRepo.slug - this.url = gitRepo.url - this.rootDir = gitRepo.rootDir - this.projectId = gitRepo.projectId - this.gitAccountId = gitRepo.gitAccountId - additionalProperties(gitRepo.additionalProperties) + id = gitRepo.id + dateConnected = gitRepo.dateConnected + dateUpdated = gitRepo.dateUpdated + gitAccountId = gitRepo.gitAccountId + gitId = gitRepo.gitId + name = gitRepo.name + private_ = gitRepo.private_ + projectId = gitRepo.projectId + slug = gitRepo.slug + url = gitRepo.url + branch = gitRepo.branch + rootDir = gitRepo.rootDir + additionalProperties = gitRepo.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) - - @JsonProperty("gitId") - @ExcludeMissing - fun gitId(gitId: JsonField) = apply { this.gitId = gitId } - fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) - @JsonProperty("dateConnected") - @ExcludeMissing fun dateConnected(dateConnected: JsonField) = apply { this.dateConnected = dateConnected } @@ -841,70 +935,55 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - @JsonProperty("dateUpdated") - @ExcludeMissing fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } - fun branch(branch: String) = branch(JsonField.of(branch)) + fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) - @JsonProperty("branch") - @ExcludeMissing - fun branch(branch: JsonField) = apply { this.branch = branch } + fun gitAccountId(gitAccountId: JsonField) = apply { + this.gitAccountId = gitAccountId + } + + fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) + + fun gitId(gitId: JsonField) = apply { this.gitId = gitId } fun name(name: String) = name(JsonField.of(name)) - @JsonProperty("name") - @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } fun private_(private_: Boolean) = private_(JsonField.of(private_)) - @JsonProperty("private") - @ExcludeMissing fun private_(private_: JsonField) = apply { this.private_ = private_ } + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + fun slug(slug: String) = slug(JsonField.of(slug)) - @JsonProperty("slug") - @ExcludeMissing fun slug(slug: JsonField) = apply { this.slug = slug } fun url(url: String) = url(JsonField.of(url)) - @JsonProperty("url") - @ExcludeMissing fun url(url: JsonField) = apply { this.url = url } - fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) - - @JsonProperty("rootDir") - @ExcludeMissing - fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } - - fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + fun branch(branch: String) = branch(JsonField.of(branch)) - @JsonProperty("projectId") - @ExcludeMissing - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + fun branch(branch: JsonField) = apply { this.branch = branch } - fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) + fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) - @JsonProperty("gitAccountId") - @ExcludeMissing - fun gitAccountId(gitAccountId: JsonField) = apply { - this.gitAccountId = gitAccountId - } + fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -912,20 +991,28 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): GitRepo = GitRepo( - id, - gitId, - dateConnected, - dateUpdated, + checkRequired("id", id), + checkRequired("dateConnected", dateConnected), + checkRequired("dateUpdated", dateUpdated), + checkRequired("gitAccountId", gitAccountId), + checkRequired("gitId", gitId), + checkRequired("name", name), + checkRequired("private_", private_), + checkRequired("projectId", projectId), + checkRequired("slug", slug), + checkRequired("url", url), branch, - name, - private_, - slug, - url, rootDir, - projectId, - gitAccountId, additionalProperties.toImmutable(), ) } @@ -935,17 +1022,17 @@ private constructor( return true } - return /* spotless:off */ other is GitRepo && id == other.id && gitId == other.gitId && dateConnected == other.dateConnected && dateUpdated == other.dateUpdated && branch == other.branch && name == other.name && private_ == other.private_ && slug == other.slug && url == other.url && rootDir == other.rootDir && projectId == other.projectId && gitAccountId == other.gitAccountId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GitRepo && id == other.id && dateConnected == other.dateConnected && dateUpdated == other.dateUpdated && gitAccountId == other.gitAccountId && gitId == other.gitId && name == other.name && private_ == other.private_ && projectId == other.projectId && slug == other.slug && url == other.url && branch == other.branch && rootDir == other.rootDir && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, gitId, dateConnected, dateUpdated, branch, name, private_, slug, url, rootDir, projectId, gitAccountId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dateConnected, dateUpdated, gitAccountId, gitId, name, private_, projectId, slug, url, branch, rootDir, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GitRepo{id=$id, gitId=$gitId, dateConnected=$dateConnected, dateUpdated=$dateUpdated, branch=$branch, name=$name, private_=$private_, slug=$slug, url=$url, rootDir=$rootDir, projectId=$projectId, gitAccountId=$gitAccountId, additionalProperties=$additionalProperties}" + "GitRepo{id=$id, dateConnected=$dateConnected, dateUpdated=$dateUpdated, gitAccountId=$gitAccountId, gitId=$gitId, name=$name, private_=$private_, projectId=$projectId, slug=$slug, url=$url, branch=$branch, rootDir=$rootDir, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -953,17 +1040,17 @@ private constructor( return true } - return /* spotless:off */ other is Item && id == other.id && workspaceId == other.workspaceId && creatorId == other.creatorId && name == other.name && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && description == other.description && source == other.source && taskType == other.taskType && versionCount == other.versionCount && inferencePipelineCount == other.inferencePipelineCount && goalCount == other.goalCount && developmentGoalCount == other.developmentGoalCount && monitoringGoalCount == other.monitoringGoalCount && links == other.links && gitRepo == other.gitRepo && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Item && id == other.id && creatorId == other.creatorId && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && developmentGoalCount == other.developmentGoalCount && goalCount == other.goalCount && inferencePipelineCount == other.inferencePipelineCount && links == other.links && monitoringGoalCount == other.monitoringGoalCount && name == other.name && source == other.source && taskType == other.taskType && versionCount == other.versionCount && workspaceId == other.workspaceId && description == other.description && gitRepo == other.gitRepo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, workspaceId, creatorId, name, dateCreated, dateUpdated, description, source, taskType, versionCount, inferencePipelineCount, goalCount, developmentGoalCount, monitoringGoalCount, links, gitRepo, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, creatorId, dateCreated, dateUpdated, developmentGoalCount, goalCount, inferencePipelineCount, links, monitoringGoalCount, name, source, taskType, versionCount, workspaceId, description, gitRepo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Item{id=$id, workspaceId=$workspaceId, creatorId=$creatorId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, source=$source, taskType=$taskType, versionCount=$versionCount, inferencePipelineCount=$inferencePipelineCount, goalCount=$goalCount, developmentGoalCount=$developmentGoalCount, monitoringGoalCount=$monitoringGoalCount, links=$links, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" + "Item{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, developmentGoalCount=$developmentGoalCount, goalCount=$goalCount, inferencePipelineCount=$inferencePipelineCount, links=$links, monitoringGoalCount=$monitoringGoalCount, name=$name, source=$source, taskType=$taskType, versionCount=$versionCount, workspaceId=$workspaceId, description=$description, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt index e1d6917d..a7926f6d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt @@ -4,12 +4,14 @@ package com.openlayer.api.models import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams import com.openlayer.api.core.toImmutable import java.util.Objects import java.util.Optional +/** Retrieve a presigned url to post storage artifacts. */ class StoragePresignedUrlCreateParams constructor( private val objectName: String, @@ -18,6 +20,7 @@ constructor( private val additionalBodyProperties: Map, ) { + /** The name of the object. */ fun objectName(): String = objectName fun _additionalHeaders(): Headers = additionalHeaders @@ -27,9 +30,8 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties @JvmSynthetic - internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - } + internal fun getBody(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -192,7 +194,7 @@ constructor( fun build(): StoragePresignedUrlCreateParams = StoragePresignedUrlCreateParams( - checkNotNull(objectName) { "`objectName` is required but was not set" }, + checkRequired("objectName", objectName), additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt index bfbca982..ff957199 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt @@ -4,53 +4,59 @@ package com.openlayer.api.models import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import java.util.Objects -@JsonDeserialize(builder = StoragePresignedUrlCreateResponse.Builder::class) @NoAutoDetect class StoragePresignedUrlCreateResponse +@JsonCreator private constructor( - private val url: JsonField, - private val fields: JsonValue, - private val storageUri: JsonField, - private val additionalProperties: Map, + @JsonProperty("storageUri") + @ExcludeMissing + private val storageUri: JsonField = JsonMissing.of(), + @JsonProperty("url") @ExcludeMissing private val url: JsonField = JsonMissing.of(), + @JsonProperty("fields") @ExcludeMissing private val fields: JsonValue = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** The presigned url. */ - fun url(): String = url.getRequired("url") - /** The storage URI to send back to the backend after the upload was completed. */ fun storageUri(): String = storageUri.getRequired("storageUri") /** The presigned url. */ - @JsonProperty("url") @ExcludeMissing fun _url() = url + fun url(): String = url.getRequired("url") /** Fields to include in the body of the upload. Only needed by s3 */ - @JsonProperty("fields") @ExcludeMissing fun _fields() = fields + @JsonProperty("fields") @ExcludeMissing fun _fields(): JsonValue = fields /** The storage URI to send back to the backend after the upload was completed. */ - @JsonProperty("storageUri") @ExcludeMissing fun _storageUri() = storageUri + @JsonProperty("storageUri") @ExcludeMissing fun _storageUri(): JsonField = storageUri + + /** The presigned url. */ + @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): StoragePresignedUrlCreateResponse = apply { - if (!validated) { - url() - storageUri() - validated = true + if (validated) { + return@apply } + + storageUri() + url() + validated = true } fun toBuilder() = Builder().from(this) @@ -62,60 +68,60 @@ private constructor( class Builder { - private var url: JsonField = JsonMissing.of() + private var storageUri: JsonField? = null + private var url: JsonField? = null private var fields: JsonValue = JsonMissing.of() - private var storageUri: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(storagePresignedUrlCreateResponse: StoragePresignedUrlCreateResponse) = apply { - this.url = storagePresignedUrlCreateResponse.url - this.fields = storagePresignedUrlCreateResponse.fields - this.storageUri = storagePresignedUrlCreateResponse.storageUri - additionalProperties(storagePresignedUrlCreateResponse.additionalProperties) + storageUri = storagePresignedUrlCreateResponse.storageUri + url = storagePresignedUrlCreateResponse.url + fields = storagePresignedUrlCreateResponse.fields + additionalProperties = + storagePresignedUrlCreateResponse.additionalProperties.toMutableMap() } + /** The storage URI to send back to the backend after the upload was completed. */ + fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) + + /** The storage URI to send back to the backend after the upload was completed. */ + fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } + /** The presigned url. */ fun url(url: String) = url(JsonField.of(url)) /** The presigned url. */ - @JsonProperty("url") - @ExcludeMissing fun url(url: JsonField) = apply { this.url = url } /** Fields to include in the body of the upload. Only needed by s3 */ - @JsonProperty("fields") - @ExcludeMissing fun fields(fields: JsonValue) = apply { this.fields = fields } - /** The storage URI to send back to the backend after the upload was completed. */ - fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) - - /** The storage URI to send back to the backend after the upload was completed. */ - @JsonProperty("storageUri") - @ExcludeMissing - fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): StoragePresignedUrlCreateResponse = StoragePresignedUrlCreateResponse( - url, + checkRequired("storageUri", storageUri), + checkRequired("url", url), fields, - storageUri, additionalProperties.toImmutable(), ) } @@ -125,15 +131,15 @@ private constructor( return true } - return /* spotless:off */ other is StoragePresignedUrlCreateResponse && url == other.url && fields == other.fields && storageUri == other.storageUri && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is StoragePresignedUrlCreateResponse && storageUri == other.storageUri && url == other.url && fields == other.fields && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(url, fields, storageUri, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(storageUri, url, fields, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "StoragePresignedUrlCreateResponse{url=$url, fields=$fields, storageUri=$storageUri, additionalProperties=$additionalProperties}" + "StoragePresignedUrlCreateResponse{storageUri=$storageUri, url=$url, fields=$fields, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt index 9fcf0d46..3d3f2df6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt @@ -7,7 +7,7 @@ import com.openlayer.api.services.async.commits.TestResultServiceAsync import com.openlayer.api.services.async.commits.TestResultServiceAsyncImpl class CommitServiceAsyncImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : CommitServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt index 62b8afb1..5aa1e5c0 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt @@ -27,7 +27,7 @@ import com.openlayer.api.services.async.inferencePipelines.TestResultServiceAsyn import java.util.concurrent.CompletableFuture class InferencePipelineServiceAsyncImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : InferencePipelineServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt index ac41df99..e9f58966 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt @@ -23,7 +23,7 @@ import com.openlayer.api.services.async.projects.InferencePipelineServiceAsyncIm import java.util.concurrent.CompletableFuture class ProjectServiceAsyncImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : ProjectServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsyncImpl.kt index 088fa251..adb388e2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsyncImpl.kt @@ -7,7 +7,7 @@ import com.openlayer.api.services.async.storage.PresignedUrlServiceAsync import com.openlayer.api.services.async.storage.PresignedUrlServiceAsyncImpl class StorageServiceAsyncImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : StorageServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt index 9c554b1c..51fd2d0a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt @@ -16,7 +16,7 @@ import com.openlayer.api.models.CommitTestResultListResponse import java.util.concurrent.CompletableFuture class TestResultServiceAsyncImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : TestResultServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt index cc3c822f..f27bf91a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt @@ -17,7 +17,7 @@ import com.openlayer.api.models.InferencePipelineDataStreamResponse import java.util.concurrent.CompletableFuture class DataServiceAsyncImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : DataServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt index a54c2680..43dae3d1 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt @@ -17,7 +17,7 @@ import com.openlayer.api.models.InferencePipelineRowUpdateResponse import java.util.concurrent.CompletableFuture class RowServiceAsyncImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : RowServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt index 2474a456..7123589b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt @@ -16,7 +16,7 @@ import com.openlayer.api.models.InferencePipelineTestResultListResponse import java.util.concurrent.CompletableFuture class TestResultServiceAsyncImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : TestResultServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt index b0440f48..bdcb6f3a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt @@ -19,7 +19,7 @@ import com.openlayer.api.models.ProjectCommitListResponse import java.util.concurrent.CompletableFuture class CommitServiceAsyncImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : CommitServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt index e02d1237..3256a2a2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt @@ -19,7 +19,7 @@ import com.openlayer.api.models.ProjectInferencePipelineListResponse import java.util.concurrent.CompletableFuture class InferencePipelineServiceAsyncImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : InferencePipelineServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt index 89153fde..23679f37 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt @@ -17,7 +17,7 @@ import com.openlayer.api.models.StoragePresignedUrlCreateResponse import java.util.concurrent.CompletableFuture class PresignedUrlServiceAsyncImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : PresignedUrlServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt index 50222a85..20fdeafc 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt @@ -7,7 +7,7 @@ import com.openlayer.api.services.blocking.commits.TestResultService import com.openlayer.api.services.blocking.commits.TestResultServiceImpl class CommitServiceImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : CommitService { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt index 40eb3ee1..23e2221a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt @@ -26,7 +26,7 @@ import com.openlayer.api.services.blocking.inferencePipelines.TestResultService import com.openlayer.api.services.blocking.inferencePipelines.TestResultServiceImpl class InferencePipelineServiceImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : InferencePipelineService { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt index b90d15a5..f5e35697 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt @@ -22,7 +22,7 @@ import com.openlayer.api.services.blocking.projects.InferencePipelineService import com.openlayer.api.services.blocking.projects.InferencePipelineServiceImpl class ProjectServiceImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : ProjectService { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageServiceImpl.kt index f33a55fc..c233c0df 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageServiceImpl.kt @@ -7,7 +7,7 @@ import com.openlayer.api.services.blocking.storage.PresignedUrlService import com.openlayer.api.services.blocking.storage.PresignedUrlServiceImpl class StorageServiceImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : StorageService { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt index 272c1f56..bdeb4697 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt @@ -15,7 +15,7 @@ import com.openlayer.api.models.CommitTestResultListParams import com.openlayer.api.models.CommitTestResultListResponse class TestResultServiceImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : TestResultService { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt index b3309310..4cf77dec 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt @@ -16,7 +16,7 @@ import com.openlayer.api.models.InferencePipelineDataStreamParams import com.openlayer.api.models.InferencePipelineDataStreamResponse class DataServiceImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : DataService { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt index 537d7dac..5c3afde1 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt @@ -16,7 +16,7 @@ import com.openlayer.api.models.InferencePipelineRowUpdateParams import com.openlayer.api.models.InferencePipelineRowUpdateResponse class RowServiceImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : RowService { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt index ac767530..d1a6ab94 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt @@ -15,7 +15,7 @@ import com.openlayer.api.models.InferencePipelineTestResultListParams import com.openlayer.api.models.InferencePipelineTestResultListResponse class TestResultServiceImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : TestResultService { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt index 283067fd..ab0fa156 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt @@ -18,7 +18,7 @@ import com.openlayer.api.models.ProjectCommitListParams import com.openlayer.api.models.ProjectCommitListResponse class CommitServiceImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : CommitService { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt index 22268409..86169dd7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt @@ -18,7 +18,7 @@ import com.openlayer.api.models.ProjectInferencePipelineListParams import com.openlayer.api.models.ProjectInferencePipelineListResponse class InferencePipelineServiceImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : InferencePipelineService { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt index e89676fa..627c4cb5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt @@ -16,7 +16,7 @@ import com.openlayer.api.models.StoragePresignedUrlCreateParams import com.openlayer.api.models.StoragePresignedUrlCreateResponse class PresignedUrlServiceImpl -constructor( +internal constructor( private val clientOptions: ClientOptions, ) : PresignedUrlService { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt index dd83444a..3eab72ab 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt @@ -13,68 +13,57 @@ class CommitTestResultListResponseTest { fun createCommitTestResultListResponse() { val commitTestResultListResponse = CommitTestResultListResponse.builder() - .items( - listOf( - CommitTestResultListResponse.Item.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateDataEnds(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateDataStarts(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(CommitTestResultListResponse.Item.Status.RUNNING) - .statusMessage("Test successfully processed.") - .goal( - CommitTestResultListResponse.Item.Goal.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .commentCount(0L) - .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .description( - JsonValue.from( - "This test checks for duplicate rows in the dataset." - ) + .addItem( + CommitTestResultListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateDataEnds(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateDataStarts(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(CommitTestResultListResponse.Item.Status.RUNNING) + .statusMessage("Test successfully processed.") + .goal( + CommitTestResultListResponse.Item.Goal.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(0L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description( + JsonValue.from( + "This test checks for duplicate rows in the dataset." ) - .name("No duplicate rows") - .number(1L) - .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") - .suggested(false) - .thresholds( - listOf( - CommitTestResultListResponse.Item.Goal.Threshold - .builder() - .insightName("duplicateRowCount") - .insightParameters( - listOf(JsonValue.from(mapOf())) - ) - .measurement("duplicateRowCount") - .operator("<=") - .value( - CommitTestResultListResponse.Item.Goal.Threshold - .Value - .ofNumber(0.0) - ) - .build() - ) - ) - .type("integrity") - .archived(false) - .delayWindow(0.0) - .evaluationWindow(3600.0) - .usesMlModel(false) - .usesProductionData(false) - .usesReferenceDataset(false) - .usesTrainingDataset(false) - .usesValidationDataset(true) - .build() - ) - .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build() - ) + ) + .name("No duplicate rows") + .number(1L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(false) + .addThreshold( + CommitTestResultListResponse.Item.Goal.Threshold.builder() + .insightName("duplicateRowCount") + .addInsightParameter(JsonValue.from(mapOf())) + .measurement("duplicateRowCount") + .operator("<=") + .value(0.0) + .build() + ) + .type("integrity") + .archived(false) + .delayWindow(0.0) + .evaluationWindow(3600.0) + .usesMlModel(false) + .usesProductionData(false) + .usesReferenceDataset(false) + .usesTrainingDataset(false) + .usesValidationDataset(true) + .build() + ) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() ) .build() assertThat(commitTestResultListResponse).isNotNull @@ -108,21 +97,14 @@ class CommitTestResultListResponseTest { .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .subtype("duplicateRowCount") .suggested(false) - .thresholds( - listOf( - CommitTestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") - .insightParameters( - listOf(JsonValue.from(mapOf())) - ) - .measurement("duplicateRowCount") - .operator("<=") - .value( - CommitTestResultListResponse.Item.Goal.Threshold.Value - .ofNumber(0.0) - ) - .build() - ) + .addThreshold( + CommitTestResultListResponse.Item.Goal.Threshold.builder() + .insightName("duplicateRowCount") + .addInsightParameter(JsonValue.from(mapOf())) + .measurement("duplicateRowCount") + .operator("<=") + .value(0.0) + .build() ) .type("integrity") .archived(false) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt index 3c97a0d4..5015e97d 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt @@ -13,32 +13,65 @@ class InferencePipelineDataStreamParamsTest { InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() + ) + .build() + } + + @Test + fun getBody() { + val params = + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( InferencePipelineDataStreamParams.Config.LlmData.builder() .outputColumnName("output") .contextColumnName("context") .costColumnName("cost") .groundTruthColumnName("ground_truth") .inferenceIdColumnName("id") - .inputVariableNames(listOf("user_query")) + .addInputVariableName("user_query") .latencyColumnName("latency") .metadata(JsonValue.from(mapOf())) .numOfTokenColumnName("tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build() - ) + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() ) .questionColumnName("question") .timestampColumnName("timestamp") .build() ) - ) - .rows( - listOf( + .addRow( InferencePipelineDataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) @@ -47,52 +80,6 @@ class InferencePipelineDataStreamParamsTest { .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - ) - .build() - } - - @Test - fun getBody() { - val params = - InferencePipelineDataStreamParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .inputVariableNames(listOf("user_query")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - ) - .rows( - listOf( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) - ) .build() val body = params.getBody() assertThat(body).isNotNull @@ -105,17 +92,15 @@ class InferencePipelineDataStreamParamsTest { .costColumnName("cost") .groundTruthColumnName("ground_truth") .inferenceIdColumnName("id") - .inputVariableNames(listOf("user_query")) + .addInputVariableName("user_query") .latencyColumnName("latency") .metadata(JsonValue.from(mapOf())) .numOfTokenColumnName("tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build() - ) + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() ) .questionColumnName("question") .timestampColumnName("timestamp") @@ -142,22 +127,18 @@ class InferencePipelineDataStreamParamsTest { InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .build() - ) + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .build() ) - .rows( - listOf( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() ) .build() val body = params.getBody() @@ -190,22 +171,18 @@ class InferencePipelineDataStreamParamsTest { InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .build() - ) + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .build() ) - .rows( - listOf( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() ) .build() assertThat(params).isNotNull diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParamsTest.kt index cb3cfc65..b4ee0dd9 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParamsTest.kt @@ -12,7 +12,7 @@ class InferencePipelineRetrieveParamsTest { fun createInferencePipelineRetrieveParams() { InferencePipelineRetrieveParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .expand(listOf(InferencePipelineRetrieveParams.Expand.PROJECT)) + .addExpand(InferencePipelineRetrieveParams.Expand.PROJECT) .build() } @@ -21,7 +21,7 @@ class InferencePipelineRetrieveParamsTest { val params = InferencePipelineRetrieveParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .expand(listOf(InferencePipelineRetrieveParams.Expand.PROJECT)) + .addExpand(InferencePipelineRetrieveParams.Expand.PROJECT) .build() val expected = QueryParams.builder() expected.put("expand", InferencePipelineRetrieveParams.Expand.PROJECT.toString()) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponseTest.kt index 9b516de7..b3c43c88 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponseTest.kt @@ -89,18 +89,15 @@ class InferencePipelineRetrieveResponseTest { .projectCount(0L) .slug("openlayer") .status(InferencePipelineRetrieveResponse.Workspace.Status.ACTIVE) - .inviteCode("inviteCode") - .monthlyUsage( - listOf( - InferencePipelineRetrieveResponse.Workspace.MonthlyUsage.builder() - .executionTimeMs(0L) - .monthYear(LocalDate.parse("2019-12-27")) - .predictionCount(0L) - .build() - ) + .addMonthlyUsage( + InferencePipelineRetrieveResponse.Workspace.MonthlyUsage.builder() + .executionTimeMs(0L) + .monthYear(LocalDate.parse("2019-12-27")) + .predictionCount(0L) + .build() ) .samlOnlyAccess(true) - .wildcardDomains(listOf("string")) + .addWildcardDomain("string") .build() ) .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") @@ -195,18 +192,15 @@ class InferencePipelineRetrieveResponseTest { .projectCount(0L) .slug("openlayer") .status(InferencePipelineRetrieveResponse.Workspace.Status.ACTIVE) - .inviteCode("inviteCode") - .monthlyUsage( - listOf( - InferencePipelineRetrieveResponse.Workspace.MonthlyUsage.builder() - .executionTimeMs(0L) - .monthYear(LocalDate.parse("2019-12-27")) - .predictionCount(0L) - .build() - ) + .addMonthlyUsage( + InferencePipelineRetrieveResponse.Workspace.MonthlyUsage.builder() + .executionTimeMs(0L) + .monthYear(LocalDate.parse("2019-12-27")) + .predictionCount(0L) + .build() ) .samlOnlyAccess(true) - .wildcardDomains(listOf("string")) + .addWildcardDomain("string") .build() ) assertThat(inferencePipelineRetrieveResponse.workspaceId()) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt index 8eb0ac36..2206704a 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt @@ -81,9 +81,9 @@ class InferencePipelineRowUpdateParamsTest { .build() val body = params.getBody() assertThat(body).isNotNull - assertThat(body.row()).isEqualTo(JsonValue.from(mapOf())) + assertThat(body._row()).isEqualTo(JsonValue.from(mapOf())) assertThat(body.config()) - .isEqualTo( + .contains( InferencePipelineRowUpdateParams.Config.builder() .groundTruthColumnName("ground_truth") .humanFeedbackColumnName("human_feedback") @@ -104,7 +104,7 @@ class InferencePipelineRowUpdateParamsTest { .build() val body = params.getBody() assertThat(body).isNotNull - assertThat(body.row()).isEqualTo(JsonValue.from(mapOf())) + assertThat(body._row()).isEqualTo(JsonValue.from(mapOf())) } @Test diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt index fb5a0e01..9bd6bfae 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt @@ -13,71 +13,58 @@ class InferencePipelineTestResultListResponseTest { fun createInferencePipelineTestResultListResponse() { val inferencePipelineTestResultListResponse = InferencePipelineTestResultListResponse.builder() - .items( - listOf( - InferencePipelineTestResultListResponse.Item.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateDataEnds(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateDataStarts(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineTestResultListResponse.Item.Status.RUNNING) - .statusMessage("Test successfully processed.") - .goal( - InferencePipelineTestResultListResponse.Item.Goal.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .commentCount(0L) - .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .description( - JsonValue.from( - "This test checks for duplicate rows in the dataset." - ) + .addItem( + InferencePipelineTestResultListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateDataEnds(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateDataStarts(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(InferencePipelineTestResultListResponse.Item.Status.RUNNING) + .statusMessage("Test successfully processed.") + .goal( + InferencePipelineTestResultListResponse.Item.Goal.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(0L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description( + JsonValue.from( + "This test checks for duplicate rows in the dataset." ) - .name("No duplicate rows") - .number(1L) - .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") - .suggested(false) - .thresholds( - listOf( - InferencePipelineTestResultListResponse.Item.Goal - .Threshold - .builder() - .insightName("duplicateRowCount") - .insightParameters( - listOf(JsonValue.from(mapOf())) - ) - .measurement("duplicateRowCount") - .operator("<=") - .value( - InferencePipelineTestResultListResponse.Item - .Goal - .Threshold - .Value - .ofNumber(0.0) - ) - .build() - ) - ) - .type("integrity") - .archived(false) - .delayWindow(0.0) - .evaluationWindow(3600.0) - .usesMlModel(false) - .usesProductionData(false) - .usesReferenceDataset(false) - .usesTrainingDataset(false) - .usesValidationDataset(true) - .build() - ) - .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build() - ) + ) + .name("No duplicate rows") + .number(1L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(false) + .addThreshold( + InferencePipelineTestResultListResponse.Item.Goal.Threshold + .builder() + .insightName("duplicateRowCount") + .addInsightParameter(JsonValue.from(mapOf())) + .measurement("duplicateRowCount") + .operator("<=") + .value(0.0) + .build() + ) + .type("integrity") + .archived(false) + .delayWindow(0.0) + .evaluationWindow(3600.0) + .usesMlModel(false) + .usesProductionData(false) + .usesReferenceDataset(false) + .usesTrainingDataset(false) + .usesValidationDataset(true) + .build() + ) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() ) .build() assertThat(inferencePipelineTestResultListResponse).isNotNull @@ -111,24 +98,15 @@ class InferencePipelineTestResultListResponseTest { .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .subtype("duplicateRowCount") .suggested(false) - .thresholds( - listOf( - InferencePipelineTestResultListResponse.Item.Goal.Threshold - .builder() - .insightName("duplicateRowCount") - .insightParameters( - listOf(JsonValue.from(mapOf())) - ) - .measurement("duplicateRowCount") - .operator("<=") - .value( - InferencePipelineTestResultListResponse.Item.Goal - .Threshold - .Value - .ofNumber(0.0) - ) - .build() - ) + .addThreshold( + InferencePipelineTestResultListResponse.Item.Goal.Threshold + .builder() + .insightName("duplicateRowCount") + .addInsightParameter(JsonValue.from(mapOf())) + .measurement("duplicateRowCount") + .operator("<=") + .value(0.0) + .build() ) .type("integrity") .archived(false) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateParamsTest.kt index 961e64be..4a4febec 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateParamsTest.kt @@ -28,9 +28,9 @@ class InferencePipelineUpdateParamsTest { .build() val body = params.getBody() assertThat(body).isNotNull - assertThat(body.description()).isEqualTo("This pipeline is used for production.") - assertThat(body.name()).isEqualTo("production") - assertThat(body.referenceDatasetUri()).isEqualTo("referenceDatasetUri") + assertThat(body.description()).contains("This pipeline is used for production.") + assertThat(body.name()).contains("production") + assertThat(body.referenceDatasetUri()).contains("referenceDatasetUri") } @Test diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponseTest.kt index 22921ec5..a8fc62c9 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponseTest.kt @@ -89,18 +89,15 @@ class InferencePipelineUpdateResponseTest { .projectCount(0L) .slug("openlayer") .status(InferencePipelineUpdateResponse.Workspace.Status.ACTIVE) - .inviteCode("inviteCode") - .monthlyUsage( - listOf( - InferencePipelineUpdateResponse.Workspace.MonthlyUsage.builder() - .executionTimeMs(0L) - .monthYear(LocalDate.parse("2019-12-27")) - .predictionCount(0L) - .build() - ) + .addMonthlyUsage( + InferencePipelineUpdateResponse.Workspace.MonthlyUsage.builder() + .executionTimeMs(0L) + .monthYear(LocalDate.parse("2019-12-27")) + .predictionCount(0L) + .build() ) .samlOnlyAccess(true) - .wildcardDomains(listOf("string")) + .addWildcardDomain("string") .build() ) .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") @@ -195,18 +192,15 @@ class InferencePipelineUpdateResponseTest { .projectCount(0L) .slug("openlayer") .status(InferencePipelineUpdateResponse.Workspace.Status.ACTIVE) - .inviteCode("inviteCode") - .monthlyUsage( - listOf( - InferencePipelineUpdateResponse.Workspace.MonthlyUsage.builder() - .executionTimeMs(0L) - .monthYear(LocalDate.parse("2019-12-27")) - .predictionCount(0L) - .build() - ) + .addMonthlyUsage( + InferencePipelineUpdateResponse.Workspace.MonthlyUsage.builder() + .executionTimeMs(0L) + .monthYear(LocalDate.parse("2019-12-27")) + .predictionCount(0L) + .build() ) .samlOnlyAccess(true) - .wildcardDomains(listOf("string")) + .addWildcardDomain("string") .build() ) assertThat(inferencePipelineUpdateResponse.workspaceId()) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitCreateParamsTest.kt index 40af250c..5655594d 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitCreateParamsTest.kt @@ -2,7 +2,6 @@ package com.openlayer.api.models -import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -13,20 +12,7 @@ class ProjectCommitCreateParamsTest { ProjectCommitCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .commit( - ProjectCommitCreateParams.Commit.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .fileSize(1024L) - .message("Updated the prompt.") - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .storageUri("s3://...") - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .gitCommitRef("main") - .gitCommitSha(0L) - .gitCommitUrl("gitCommitUrl") - .build() + ProjectCommitCreateParams.Commit.builder().message("Updated the prompt.").build() ) .storageUri("s3://...") .archived(false) @@ -41,18 +27,7 @@ class ProjectCommitCreateParamsTest { .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .commit( ProjectCommitCreateParams.Commit.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .fileSize(1024L) .message("Updated the prompt.") - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .storageUri("s3://...") - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .gitCommitRef("main") - .gitCommitSha(0L) - .gitCommitUrl("gitCommitUrl") .build() ) .storageUri("s3://...") @@ -63,24 +38,11 @@ class ProjectCommitCreateParamsTest { assertThat(body).isNotNull assertThat(body.commit()) .isEqualTo( - ProjectCommitCreateParams.Commit.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .fileSize(1024L) - .message("Updated the prompt.") - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .storageUri("s3://...") - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .gitCommitRef("main") - .gitCommitSha(0L) - .gitCommitUrl("gitCommitUrl") - .build() + ProjectCommitCreateParams.Commit.builder().message("Updated the prompt.").build() ) assertThat(body.storageUri()).isEqualTo("s3://...") - assertThat(body.archived()).isEqualTo(false) - assertThat(body.deploymentStatus()).isEqualTo("Deployed") + assertThat(body.archived()).contains(false) + assertThat(body.deploymentStatus()).contains("Deployed") } @Test @@ -90,14 +52,7 @@ class ProjectCommitCreateParamsTest { .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .commit( ProjectCommitCreateParams.Commit.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .fileSize(1024L) .message("Updated the prompt.") - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .storageUri("s3://...") - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .build() ) .storageUri("s3://...") @@ -106,16 +61,7 @@ class ProjectCommitCreateParamsTest { assertThat(body).isNotNull assertThat(body.commit()) .isEqualTo( - ProjectCommitCreateParams.Commit.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .fileSize(1024L) - .message("Updated the prompt.") - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .storageUri("s3://...") - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build() + ProjectCommitCreateParams.Commit.builder().message("Updated the prompt.").build() ) assertThat(body.storageUri()).isEqualTo("s3://...") } @@ -127,14 +73,7 @@ class ProjectCommitCreateParamsTest { .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .commit( ProjectCommitCreateParams.Commit.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .fileSize(1024L) .message("Updated the prompt.") - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .storageUri("s3://...") - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .build() ) .storageUri("s3://...") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitCreateResponseTest.kt index 9720a0e6..9e3483bc 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitCreateResponseTest.kt @@ -37,7 +37,6 @@ class ProjectCommitCreateResponseTest { .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .status(ProjectCommitCreateResponse.Status.QUEUED) .statusMessage("Commit successfully processed.") - .storageUri("s3://...") .totalGoalCount(6L) .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -85,7 +84,6 @@ class ProjectCommitCreateResponseTest { .isEqualTo(ProjectCommitCreateResponse.Status.QUEUED) assertThat(projectCommitCreateResponse.statusMessage()) .contains("Commit successfully processed.") - assertThat(projectCommitCreateResponse.storageUri()).isEqualTo("s3://...") assertThat(projectCommitCreateResponse.totalGoalCount()).isEqualTo(6L) assertThat(projectCommitCreateResponse.trainingDatasetId()) .contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt index a7aff626..3a26c91d 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt @@ -12,49 +12,46 @@ class ProjectCommitListResponseTest { fun createProjectCommitListResponse() { val projectCommitListResponse = ProjectCommitListResponse.builder() - .items( - listOf( - ProjectCommitListResponse.Item.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .commit( - ProjectCommitListResponse.Item.Commit.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .fileSize(1024L) - .message("Updated the prompt.") - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .storageUri("s3://...") - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .gitCommitRef("main") - .gitCommitSha(0L) - .gitCommitUrl("gitCommitUrl") - .build() - ) - .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .failingGoalCount(1L) - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .passingGoalCount(5L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectCommitListResponse.Item.Status.QUEUED) - .statusMessage("Commit successfully processed.") - .storageUri("s3://...") - .totalGoalCount(6L) - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .archived(false) - .deploymentStatus("Deployed") - .links( - ProjectCommitListResponse.Item.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .build() - ) + .addItem( + ProjectCommitListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commit( + ProjectCommitListResponse.Item.Commit.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .fileSize(1024L) + .message("Updated the prompt.") + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .storageUri("s3://...") + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .gitCommitRef("main") + .gitCommitSha(0L) + .gitCommitUrl("gitCommitUrl") + .build() + ) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(1L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectCommitListResponse.Item.Status.QUEUED) + .statusMessage("Commit successfully processed.") + .totalGoalCount(6L) + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .archived(false) + .deploymentStatus("Deployed") + .links( + ProjectCommitListResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .build() ) .build() assertThat(projectCommitListResponse).isNotNull @@ -86,7 +83,6 @@ class ProjectCommitListResponseTest { .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .status(ProjectCommitListResponse.Item.Status.QUEUED) .statusMessage("Commit successfully processed.") - .storageUri("s3://...") .totalGoalCount(6L) .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateParamsTest.kt index 2d6f944e..38296e4b 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateParamsTest.kt @@ -28,7 +28,7 @@ class ProjectCreateParamsTest { assertThat(body).isNotNull assertThat(body.name()).isEqualTo("My Project") assertThat(body.taskType()).isEqualTo(ProjectCreateParams.TaskType.LLM_BASE) - assertThat(body.description()).isEqualTo("My project description.") + assertThat(body.description()).contains("My project description.") } @Test diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt index fac797b0..41e75dca 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt @@ -2,8 +2,6 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -17,71 +15,18 @@ class ProjectInferencePipelineCreateParamsTest { .name("production") .project( ProjectInferencePipelineCreateParams.Project.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .developmentGoalCount(5L) - .goalCount(10L) - .inferencePipelineCount(1L) - .links( - ProjectInferencePipelineCreateParams.Project.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .monitoringGoalCount(5L) .name("My Project") - .source(ProjectInferencePipelineCreateParams.Project.Source.WEB) .taskType(ProjectInferencePipelineCreateParams.Project.TaskType.LLM_BASE) - .versionCount(2L) - .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") - .gitRepo( - ProjectInferencePipelineCreateParams.Project.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(0L) - .name("name") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("slug") - .url("url") - .branch("branch") - .rootDir("rootDir") - .build() - ) .build() ) .workspace( ProjectInferencePipelineCreateParams.Workspace.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .inviteCount(0L) - .memberCount(0L) .name("Openlayer") - .periodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .projectCount(0L) .slug("openlayer") - .status(ProjectInferencePipelineCreateParams.Workspace.Status.ACTIVE) .inviteCode("inviteCode") - .monthlyUsage( - listOf( - ProjectInferencePipelineCreateParams.Workspace.MonthlyUsage.builder() - .executionTimeMs(0L) - .monthYear(LocalDate.parse("2019-12-27")) - .predictionCount(0L) - .build() - ) - ) .samlOnlyAccess(true) - .wildcardDomains(listOf("string")) + .addWildcardDomain("string") .build() ) .build() @@ -96,148 +41,41 @@ class ProjectInferencePipelineCreateParamsTest { .name("production") .project( ProjectInferencePipelineCreateParams.Project.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .developmentGoalCount(5L) - .goalCount(10L) - .inferencePipelineCount(1L) - .links( - ProjectInferencePipelineCreateParams.Project.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .monitoringGoalCount(5L) .name("My Project") - .source(ProjectInferencePipelineCreateParams.Project.Source.WEB) .taskType(ProjectInferencePipelineCreateParams.Project.TaskType.LLM_BASE) - .versionCount(2L) - .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") - .gitRepo( - ProjectInferencePipelineCreateParams.Project.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(0L) - .name("name") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("slug") - .url("url") - .branch("branch") - .rootDir("rootDir") - .build() - ) .build() ) .workspace( ProjectInferencePipelineCreateParams.Workspace.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .inviteCount(0L) - .memberCount(0L) .name("Openlayer") - .periodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .projectCount(0L) .slug("openlayer") - .status(ProjectInferencePipelineCreateParams.Workspace.Status.ACTIVE) .inviteCode("inviteCode") - .monthlyUsage( - listOf( - ProjectInferencePipelineCreateParams.Workspace.MonthlyUsage - .builder() - .executionTimeMs(0L) - .monthYear(LocalDate.parse("2019-12-27")) - .predictionCount(0L) - .build() - ) - ) .samlOnlyAccess(true) - .wildcardDomains(listOf("string")) + .addWildcardDomain("string") .build() ) .build() val body = params.getBody() assertThat(body).isNotNull - assertThat(body.description()).isEqualTo("This pipeline is used for production.") + assertThat(body.description()).contains("This pipeline is used for production.") assertThat(body.name()).isEqualTo("production") assertThat(body.project()) - .isEqualTo( + .contains( ProjectInferencePipelineCreateParams.Project.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .developmentGoalCount(5L) - .goalCount(10L) - .inferencePipelineCount(1L) - .links( - ProjectInferencePipelineCreateParams.Project.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .monitoringGoalCount(5L) .name("My Project") - .source(ProjectInferencePipelineCreateParams.Project.Source.WEB) .taskType(ProjectInferencePipelineCreateParams.Project.TaskType.LLM_BASE) - .versionCount(2L) - .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") - .gitRepo( - ProjectInferencePipelineCreateParams.Project.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(0L) - .name("name") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("slug") - .url("url") - .branch("branch") - .rootDir("rootDir") - .build() - ) .build() ) assertThat(body.workspace()) - .isEqualTo( + .contains( ProjectInferencePipelineCreateParams.Workspace.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .inviteCount(0L) - .memberCount(0L) .name("Openlayer") - .periodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .projectCount(0L) .slug("openlayer") - .status(ProjectInferencePipelineCreateParams.Workspace.Status.ACTIVE) .inviteCode("inviteCode") - .monthlyUsage( - listOf( - ProjectInferencePipelineCreateParams.Workspace.MonthlyUsage.builder() - .executionTimeMs(0L) - .monthYear(LocalDate.parse("2019-12-27")) - .predictionCount(0L) - .build() - ) - ) .samlOnlyAccess(true) - .wildcardDomains(listOf("string")) + .addWildcardDomain("string") .build() ) } @@ -247,10 +85,12 @@ class ProjectInferencePipelineCreateParamsTest { val params = ProjectInferencePipelineCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("This pipeline is used for production.") .name("production") .build() val body = params.getBody() assertThat(body).isNotNull + assertThat(body.description()).contains("This pipeline is used for production.") assertThat(body.name()).isEqualTo("production") } @@ -259,6 +99,7 @@ class ProjectInferencePipelineCreateParamsTest { val params = ProjectInferencePipelineCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("This pipeline is used for production.") .name("production") .build() assertThat(params).isNotNull diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt index 646bc7ec..309cd4ff 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt @@ -89,19 +89,15 @@ class ProjectInferencePipelineCreateResponseTest { .projectCount(0L) .slug("openlayer") .status(ProjectInferencePipelineCreateResponse.Workspace.Status.ACTIVE) - .inviteCode("inviteCode") - .monthlyUsage( - listOf( - ProjectInferencePipelineCreateResponse.Workspace.MonthlyUsage - .builder() - .executionTimeMs(0L) - .monthYear(LocalDate.parse("2019-12-27")) - .predictionCount(0L) - .build() - ) + .addMonthlyUsage( + ProjectInferencePipelineCreateResponse.Workspace.MonthlyUsage.builder() + .executionTimeMs(0L) + .monthYear(LocalDate.parse("2019-12-27")) + .predictionCount(0L) + .build() ) .samlOnlyAccess(true) - .wildcardDomains(listOf("string")) + .addWildcardDomain("string") .build() ) .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") @@ -196,18 +192,15 @@ class ProjectInferencePipelineCreateResponseTest { .projectCount(0L) .slug("openlayer") .status(ProjectInferencePipelineCreateResponse.Workspace.Status.ACTIVE) - .inviteCode("inviteCode") - .monthlyUsage( - listOf( - ProjectInferencePipelineCreateResponse.Workspace.MonthlyUsage.builder() - .executionTimeMs(0L) - .monthYear(LocalDate.parse("2019-12-27")) - .predictionCount(0L) - .build() - ) + .addMonthlyUsage( + ProjectInferencePipelineCreateResponse.Workspace.MonthlyUsage.builder() + .executionTimeMs(0L) + .monthYear(LocalDate.parse("2019-12-27")) + .predictionCount(0L) + .build() ) .samlOnlyAccess(true) - .wildcardDomains(listOf("string")) + .addWildcardDomain("string") .build() ) assertThat(projectInferencePipelineCreateResponse.workspaceId()) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt index ec8ea795..bb24c8a7 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt @@ -13,122 +13,112 @@ class ProjectInferencePipelineListResponseTest { fun createProjectInferencePipelineListResponse() { val projectInferencePipelineListResponse = ProjectInferencePipelineListResponse.builder() - .items( - listOf( - ProjectInferencePipelineListResponse.Item.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateLastSampleReceived( - OffsetDateTime.parse("2024-03-22T11:31:01.185Z") - ) - .dateOfNextEvaluation(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .description("This pipeline is used for production.") - .failingGoalCount(1L) - .links( - ProjectInferencePipelineListResponse.Item.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .name("production") - .passingGoalCount(5L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineListResponse.Item.Status.QUEUED) - .statusMessage("Tests successfully evaluated") - .totalGoalCount(6L) - .project( - ProjectInferencePipelineListResponse.Item.Project.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .developmentGoalCount(5L) - .goalCount(10L) - .inferencePipelineCount(1L) - .links( - ProjectInferencePipelineListResponse.Item.Project.Links - .builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .monitoringGoalCount(5L) - .name("My Project") - .source( - ProjectInferencePipelineListResponse.Item.Project.Source.WEB - ) - .taskType( - ProjectInferencePipelineListResponse.Item.Project.TaskType - .LLM_BASE - ) - .versionCount(2L) - .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") - .description("My project description.") - .gitRepo( - ProjectInferencePipelineListResponse.Item.Project.GitRepo - .builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected( - OffsetDateTime.parse("2019-12-27T18:11:19.117Z") - ) - .dateUpdated( - OffsetDateTime.parse("2019-12-27T18:11:19.117Z") - ) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(0L) - .name("name") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("slug") - .url("url") - .branch("branch") - .rootDir("rootDir") - .build() - ) - .build() - ) - .workspace( - ProjectInferencePipelineListResponse.Item.Workspace.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .inviteCount(0L) - .memberCount(0L) - .name("Openlayer") - .periodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .periodStartDate( - OffsetDateTime.parse("2019-12-27T18:11:19.117Z") - ) - .projectCount(0L) - .slug("openlayer") - .status( - ProjectInferencePipelineListResponse.Item.Workspace.Status - .ACTIVE - ) - .inviteCode("inviteCode") - .monthlyUsage( - listOf( - ProjectInferencePipelineListResponse.Item.Workspace - .MonthlyUsage - .builder() - .executionTimeMs(0L) - .monthYear(LocalDate.parse("2019-12-27")) - .predictionCount(0L) - .build() + .addItem( + ProjectInferencePipelineListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastSampleReceived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description("This pipeline is used for production.") + .failingGoalCount(1L) + .links( + ProjectInferencePipelineListResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .name("production") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineListResponse.Item.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(6L) + .project( + ProjectInferencePipelineListResponse.Item.Project.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + ProjectInferencePipelineListResponse.Item.Project.Links + .builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) - ) - .samlOnlyAccess(true) - .wildcardDomains(listOf("string")) - .build() - ) - .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") - .build() - ) + .build() + ) + .monitoringGoalCount(5L) + .name("My Project") + .source( + ProjectInferencePipelineListResponse.Item.Project.Source.WEB + ) + .taskType( + ProjectInferencePipelineListResponse.Item.Project.TaskType + .LLM_BASE + ) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .description("My project description.") + .gitRepo( + ProjectInferencePipelineListResponse.Item.Project.GitRepo + .builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .dateUpdated( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .build() + ) + .workspace( + ProjectInferencePipelineListResponse.Item.Workspace.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .inviteCount(0L) + .memberCount(0L) + .name("Openlayer") + .periodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .projectCount(0L) + .slug("openlayer") + .status( + ProjectInferencePipelineListResponse.Item.Workspace.Status + .ACTIVE + ) + .addMonthlyUsage( + ProjectInferencePipelineListResponse.Item.Workspace.MonthlyUsage + .builder() + .executionTimeMs(0L) + .monthYear(LocalDate.parse("2019-12-27")) + .predictionCount(0L) + .build() + ) + .samlOnlyAccess(true) + .addWildcardDomain("string") + .build() + ) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .build() ) .build() assertThat(projectInferencePipelineListResponse).isNotNull @@ -215,19 +205,16 @@ class ProjectInferencePipelineListResponseTest { .status( ProjectInferencePipelineListResponse.Item.Workspace.Status.ACTIVE ) - .inviteCode("inviteCode") - .monthlyUsage( - listOf( - ProjectInferencePipelineListResponse.Item.Workspace.MonthlyUsage - .builder() - .executionTimeMs(0L) - .monthYear(LocalDate.parse("2019-12-27")) - .predictionCount(0L) - .build() - ) + .addMonthlyUsage( + ProjectInferencePipelineListResponse.Item.Workspace.MonthlyUsage + .builder() + .executionTimeMs(0L) + .monthYear(LocalDate.parse("2019-12-27")) + .predictionCount(0L) + .build() ) .samlOnlyAccess(true) - .wildcardDomains(listOf("string")) + .addWildcardDomain("string") .build() ) .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListResponseTest.kt index 26ef957e..33801d22 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListResponseTest.kt @@ -12,48 +12,46 @@ class ProjectListResponseTest { fun createProjectListResponse() { val projectListResponse = ProjectListResponse.builder() - .items( - listOf( - ProjectListResponse.Item.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .developmentGoalCount(5L) - .goalCount(10L) - .inferencePipelineCount(1L) - .links( - ProjectListResponse.Item.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .monitoringGoalCount(5L) - .name("My Project") - .source(ProjectListResponse.Item.Source.WEB) - .taskType(ProjectListResponse.Item.TaskType.LLM_BASE) - .versionCount(2L) - .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") - .description("My project description.") - .gitRepo( - ProjectListResponse.Item.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(0L) - .name("name") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("slug") - .url("url") - .branch("branch") - .rootDir("rootDir") - .build() - ) - .build() - ) + .addItem( + ProjectListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + ProjectListResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) + .name("My Project") + .source(ProjectListResponse.Item.Source.WEB) + .taskType(ProjectListResponse.Item.TaskType.LLM_BASE) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .description("My project description.") + .gitRepo( + ProjectListResponse.Item.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .build() ) .build() assertThat(projectListResponse).isNotNull diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt index b6311545..1508c204 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt @@ -58,41 +58,34 @@ class ErrorHandlingTest { InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .inputVariableNames(listOf("user_query")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() ) - .rows( - listOf( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() ) .build() @@ -112,41 +105,34 @@ class ErrorHandlingTest { InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .inputVariableNames(listOf("user_query")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() ) - .rows( - listOf( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() ) .build() @@ -167,41 +153,34 @@ class ErrorHandlingTest { InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .inputVariableNames(listOf("user_query")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() ) - .rows( - listOf( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() ) .build() @@ -222,41 +201,34 @@ class ErrorHandlingTest { InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .inputVariableNames(listOf("user_query")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() ) - .rows( - listOf( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() ) .build() @@ -281,41 +253,34 @@ class ErrorHandlingTest { InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .inputVariableNames(listOf("user_query")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() ) - .rows( - listOf( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() ) .build() @@ -336,41 +301,34 @@ class ErrorHandlingTest { InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .inputVariableNames(listOf("user_query")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() ) - .rows( - listOf( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() ) .build() @@ -395,41 +353,34 @@ class ErrorHandlingTest { InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .inputVariableNames(listOf("user_query")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() ) - .rows( - listOf( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() ) .build() @@ -450,41 +401,34 @@ class ErrorHandlingTest { InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .inputVariableNames(listOf("user_query")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() ) - .rows( - listOf( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() ) .build() @@ -509,41 +453,34 @@ class ErrorHandlingTest { InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .inputVariableNames(listOf("user_query")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() ) - .rows( - listOf( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() ) .build() @@ -569,41 +506,34 @@ class ErrorHandlingTest { InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .inputVariableNames(listOf("user_query")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() ) - .rows( - listOf( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() ) .build() @@ -623,41 +553,34 @@ class ErrorHandlingTest { InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .inputVariableNames(listOf("user_query")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() ) - .rows( - listOf( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() ) .build() diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt index 1348d1bc..c947464b 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt @@ -56,41 +56,34 @@ class ServiceParamsTest { InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .inputVariableNames(listOf("user_query")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() ) - .rows( - listOf( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() ) .additionalHeaders(additionalHeaders) .additionalBodyProperties(additionalBodyProperties) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt index 4fd11109..f2436f35 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt @@ -25,7 +25,7 @@ class InferencePipelineServiceTest { inferencePipelineService.retrieve( InferencePipelineRetrieveParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .expand(listOf(InferencePipelineRetrieveParams.Expand.PROJECT)) + .addExpand(InferencePipelineRetrieveParams.Expand.PROJECT) .build() ) println(inferencePipelineRetrieveResponse) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceTest.kt index 1146339a..4cfc44ab 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceTest.kt @@ -25,41 +25,34 @@ class DataServiceTest { InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .inputVariableNames(listOf("user_query")) - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .prompt( - listOf( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() ) - .rows( - listOf( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() ) .build() ) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt index 8bafae36..452f62fa 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt @@ -6,7 +6,6 @@ import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.ProjectCommitCreateParams import com.openlayer.api.models.ProjectCommitListParams -import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -27,18 +26,7 @@ class CommitServiceTest { .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .commit( ProjectCommitCreateParams.Commit.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .fileSize(1024L) .message("Updated the prompt.") - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .storageUri("s3://...") - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .gitCommitRef("main") - .gitCommitSha(0L) - .gitCommitUrl("gitCommitUrl") .build() ) .storageUri("s3://...") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt index c7a80a4e..e8af5cb7 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt @@ -6,8 +6,6 @@ import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.ProjectInferencePipelineCreateParams import com.openlayer.api.models.ProjectInferencePipelineListParams -import java.time.LocalDate -import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -30,74 +28,20 @@ class InferencePipelineServiceTest { .name("production") .project( ProjectInferencePipelineCreateParams.Project.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .developmentGoalCount(5L) - .goalCount(10L) - .inferencePipelineCount(1L) - .links( - ProjectInferencePipelineCreateParams.Project.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .monitoringGoalCount(5L) .name("My Project") - .source(ProjectInferencePipelineCreateParams.Project.Source.WEB) .taskType( ProjectInferencePipelineCreateParams.Project.TaskType.LLM_BASE ) - .versionCount(2L) - .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") - .gitRepo( - ProjectInferencePipelineCreateParams.Project.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(0L) - .name("name") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("slug") - .url("url") - .branch("branch") - .rootDir("rootDir") - .build() - ) .build() ) .workspace( ProjectInferencePipelineCreateParams.Workspace.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .inviteCount(0L) - .memberCount(0L) .name("Openlayer") - .periodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .projectCount(0L) .slug("openlayer") - .status(ProjectInferencePipelineCreateParams.Workspace.Status.ACTIVE) .inviteCode("inviteCode") - .monthlyUsage( - listOf( - ProjectInferencePipelineCreateParams.Workspace.MonthlyUsage - .builder() - .executionTimeMs(0L) - .monthYear(LocalDate.parse("2019-12-27")) - .predictionCount(0L) - .build() - ) - ) .samlOnlyAccess(true) - .wildcardDomains(listOf("string")) + .addWildcardDomain("string") .build() ) .build() From a62fb1f2042721f6ce4eb84ff33bfd9704829266 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 25 Jan 2025 18:13:21 +0000 Subject: [PATCH 04/74] chore(internal): codegen related update --- .../com/openlayer/api/client/okhttp/OkHttpClient.kt | 3 ++- .../src/main/kotlin/com/openlayer/api/core/Check.kt | 3 +-- .../com/openlayer/api/core/http/HttpRequest.kt | 3 ++- .../openlayer/api/core/http/RetryingHttpClient.kt | 3 ++- .../api/models/CommitTestResultListResponseTest.kt | 12 ++---------- .../InferencePipelineTestResultListResponseTest.kt | 12 ++---------- 6 files changed, 11 insertions(+), 25 deletions(-) diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt index cd4ff7dc..ac4f540a 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt @@ -1,6 +1,7 @@ package com.openlayer.api.client.okhttp import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.HttpClient import com.openlayer.api.core.http.HttpMethod @@ -192,7 +193,7 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val .callTimeout(if (timeout.seconds == 0L) timeout else timeout.plusSeconds(30)) .proxy(proxy) .build(), - checkNotNull(baseUrl) { "`baseUrl` is required but was not set" }, + checkRequired("baseUrl", baseUrl), ) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt index 90c3d44f..7769d6ed 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt @@ -2,8 +2,7 @@ package com.openlayer.api.core -@JvmSynthetic -internal fun checkRequired(name: String, value: T?): T = +fun checkRequired(name: String, value: T?): T = checkNotNull(value) { "`$name` is required, but was not set" } @JvmSynthetic diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt index 1acfcbc8..abe7a23e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt @@ -1,5 +1,6 @@ package com.openlayer.api.core.http +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.toImmutable class HttpRequest @@ -134,7 +135,7 @@ private constructor( fun build(): HttpRequest = HttpRequest( - checkNotNull(method) { "`method` is required but was not set" }, + checkRequired("method", method), url, pathSegments.toImmutable(), headers.build(), diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt index 56feff5c..5db3ccec 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt @@ -1,6 +1,7 @@ package com.openlayer.api.core.http import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired import com.openlayer.api.errors.OpenlayerIoException import java.io.IOException import java.time.Clock @@ -259,7 +260,7 @@ private constructor( fun build(): HttpClient = RetryingHttpClient( - checkNotNull(httpClient) { "`httpClient` is required but was not set" }, + checkRequired("httpClient", httpClient), clock, maxRetries, idempotencyHeader, diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt index 3eab72ab..7701f8bd 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt @@ -32,11 +32,7 @@ class CommitTestResultListResponseTest { .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .description( - JsonValue.from( - "This test checks for duplicate rows in the dataset." - ) - ) + .description("This test checks for duplicate rows in the dataset.") .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -87,11 +83,7 @@ class CommitTestResultListResponseTest { .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .description( - JsonValue.from( - "This test checks for duplicate rows in the dataset." - ) - ) + .description("This test checks for duplicate rows in the dataset.") .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt index 9bd6bfae..7869a1be 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt @@ -32,11 +32,7 @@ class InferencePipelineTestResultListResponseTest { .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .description( - JsonValue.from( - "This test checks for duplicate rows in the dataset." - ) - ) + .description("This test checks for duplicate rows in the dataset.") .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -88,11 +84,7 @@ class InferencePipelineTestResultListResponseTest { .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .description( - JsonValue.from( - "This test checks for duplicate rows in the dataset." - ) - ) + .description("This test checks for duplicate rows in the dataset.") .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") From 2885a5a402fa4cea4e5363a5dbec1bd255a9060b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 25 Jan 2025 20:03:40 +0000 Subject: [PATCH 05/74] chore(internal): codegen related update --- .../kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt index c6ccd9b7..517c669f 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt @@ -45,6 +45,7 @@ internal class RetryingHttpClientTest { val retryingClient = RetryingHttpClient.builder() .httpClient(httpClient) + .maxRetries(2) .idempotencyHeader("X-Some-Header") .build() val response = retryingClient.execute(request) From 207ba785d6409b4a6b5ede70f3944313cd625b6c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 28 Jan 2025 12:57:26 +0000 Subject: [PATCH 06/74] feat(client): add `close` method --- .../com/openlayer/api/client/OpenlayerClient.kt | 13 +++++++++++++ .../openlayer/api/client/OpenlayerClientAsync.kt | 13 +++++++++++++ .../api/client/OpenlayerClientAsyncImpl.kt | 2 ++ .../com/openlayer/api/client/OpenlayerClientImpl.kt | 2 ++ 4 files changed, 30 insertions(+) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt index b7d18d42..3ee150f6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt @@ -18,4 +18,17 @@ interface OpenlayerClient { fun inferencePipelines(): InferencePipelineService fun storage(): StorageService + + /** + * Closes this client, relinquishing any underlying resources. + * + * This is purposefully not inherited from [AutoCloseable] because the client is long-lived and + * usually should not be synchronously closed via try-with-resources. + * + * It's also usually not necessary to call this method at all. the default HTTP client + * automatically releases threads and connections if they remain idle, but if you are writing an + * application that needs to aggressively release unused resources, then you may call this + * method. + */ + fun close() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt index d9a6d7a1..83f6ff59 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt @@ -18,4 +18,17 @@ interface OpenlayerClientAsync { fun inferencePipelines(): InferencePipelineServiceAsync fun storage(): StorageServiceAsync + + /** + * Closes this client, relinquishing any underlying resources. + * + * This is purposefully not inherited from [AutoCloseable] because the client is long-lived and + * usually should not be synchronously closed via try-with-resources. + * + * It's also usually not necessary to call this method at all. the default HTTP client + * automatically releases threads and connections if they remain idle, but if you are writing an + * application that needs to aggressively release unused resources, then you may call this + * method. + */ + fun close() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt index 9335e18a..6c6ab1ab 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt @@ -54,4 +54,6 @@ constructor( override fun inferencePipelines(): InferencePipelineServiceAsync = inferencePipelines override fun storage(): StorageServiceAsync = storage + + override fun close() = clientOptions.httpClient.close() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt index 4577ea48..c4c12061 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt @@ -48,4 +48,6 @@ constructor( override fun inferencePipelines(): InferencePipelineService = inferencePipelines override fun storage(): StorageService = storage + + override fun close() = clientOptions.httpClient.close() } From ad4f217728a1fc01dacc4587004a086350f4ccc4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 28 Jan 2025 12:59:25 +0000 Subject: [PATCH 07/74] docs: add client documentation --- .../com/openlayer/api/client/OpenlayerClient.kt | 14 ++++++++++++++ .../openlayer/api/client/OpenlayerClientAsync.kt | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt index 3ee150f6..b903bf7c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt @@ -7,6 +7,20 @@ import com.openlayer.api.services.blocking.InferencePipelineService import com.openlayer.api.services.blocking.ProjectService import com.openlayer.api.services.blocking.StorageService +/** + * A client for interacting with the Openlayer REST API synchronously. You can also switch to + * asynchronous execution via the [async] method. + * + * This client performs best when you create a single instance and reuse it for all interactions + * with the REST API. This is because each client holds its own connection pool and thread pools. + * Reusing connections and threads reduces latency and saves memory. The client also handles rate + * limiting per client. This means that creating and using multiple instances at the same time will + * not respect rate limits. + * + * The threads and connections that are held will be released automatically if they remain idle. But + * if you are writing an application that needs to aggressively release unused resources, then you + * may call [close]. + */ interface OpenlayerClient { fun async(): OpenlayerClientAsync diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt index 83f6ff59..9e8528c8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt @@ -7,6 +7,20 @@ import com.openlayer.api.services.async.InferencePipelineServiceAsync import com.openlayer.api.services.async.ProjectServiceAsync import com.openlayer.api.services.async.StorageServiceAsync +/** + * A client for interacting with the Openlayer REST API asynchronously. You can also switch to + * synchronous execution via the [sync] method. + * + * This client performs best when you create a single instance and reuse it for all interactions + * with the REST API. This is because each client holds its own connection pool and thread pools. + * Reusing connections and threads reduces latency and saves memory. The client also handles rate + * limiting per client. This means that creating and using multiple instances at the same time will + * not respect rate limits. + * + * The threads and connections that are held will be released automatically if they remain idle. But + * if you are writing an application that needs to aggressively release unused resources, then you + * may call [close]. + */ interface OpenlayerClientAsync { fun sync(): OpenlayerClient From 0083c41a6cc82a368e64ec0a812935597fa330e5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 28 Jan 2025 13:01:20 +0000 Subject: [PATCH 08/74] docs: `async` and `sync` method comments --- .../main/kotlin/com/openlayer/api/client/OpenlayerClient.kt | 6 ++++++ .../kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt index b903bf7c..621c6e7a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt @@ -23,6 +23,12 @@ import com.openlayer.api.services.blocking.StorageService */ interface OpenlayerClient { + /** + * Returns a version of this client that uses asynchronous execution. + * + * The returned client shares its resources, like its connection pool and thread pools, with + * this client. + */ fun async(): OpenlayerClientAsync fun projects(): ProjectService diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt index 9e8528c8..f8c3b6de 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt @@ -23,6 +23,12 @@ import com.openlayer.api.services.async.StorageServiceAsync */ interface OpenlayerClientAsync { + /** + * Returns a version of this client that uses synchronous execution. + * + * The returned client shares its resources, like its connection pool and thread pools, with + * this client. + */ fun sync(): OpenlayerClient fun projects(): ProjectServiceAsync From 882eb61286bb52c15224a36677a934523ccb4fb3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 28 Jan 2025 13:18:59 +0000 Subject: [PATCH 09/74] fix(client): make some classes and constructors non-public chore(internal): remove some unnecessary `constructor` keywords --- .../api/client/okhttp/OkHttpClient.kt | 2 +- .../client/okhttp/OpenlayerOkHttpClient.kt | 2 +- .../okhttp/OpenlayerOkHttpClientAsync.kt | 2 +- .../api/client/OpenlayerClientAsyncImpl.kt | 3 +-- .../api/client/OpenlayerClientImpl.kt | 3 +-- .../com/openlayer/api/core/ClientOptions.kt | 2 +- .../com/openlayer/api/core/RequestOptions.kt | 3 ++- .../com/openlayer/api/core/http/Headers.kt | 2 +- .../openlayer/api/core/http/HttpRequest.kt | 2 +- .../openlayer/api/core/http/QueryParams.kt | 2 +- .../api/core/http/RetryingHttpClient.kt | 2 +- .../openlayer/api/errors/OpenlayerError.kt | 2 +- .../api/models/CommitTestResultListParams.kt | 4 ++-- .../models/CommitTestResultListResponse.kt | 12 +++++----- .../InferencePipelineDataStreamParams.kt | 22 +++++++++---------- .../InferencePipelineDataStreamResponse.kt | 2 +- .../models/InferencePipelineDeleteParams.kt | 4 ++-- .../models/InferencePipelineRetrieveParams.kt | 4 ++-- .../InferencePipelineRetrieveResponse.kt | 14 ++++++------ .../InferencePipelineRowUpdateParams.kt | 8 +++---- .../InferencePipelineRowUpdateResponse.kt | 2 +- .../InferencePipelineTestResultListParams.kt | 4 ++-- ...InferencePipelineTestResultListResponse.kt | 12 +++++----- .../models/InferencePipelineUpdateParams.kt | 6 ++--- .../models/InferencePipelineUpdateResponse.kt | 14 ++++++------ .../api/models/ProjectCommitCreateParams.kt | 10 ++++----- .../api/models/ProjectCommitCreateResponse.kt | 6 ++--- .../api/models/ProjectCommitListParams.kt | 4 ++-- .../api/models/ProjectCommitListResponse.kt | 8 +++---- .../api/models/ProjectCreateParams.kt | 10 ++++----- .../api/models/ProjectCreateResponse.kt | 6 ++--- .../ProjectInferencePipelineCreateParams.kt | 18 +++++++-------- .../ProjectInferencePipelineCreateResponse.kt | 14 ++++++------ .../ProjectInferencePipelineListParams.kt | 4 ++-- .../ProjectInferencePipelineListResponse.kt | 16 +++++++------- .../openlayer/api/models/ProjectListParams.kt | 4 ++-- .../api/models/ProjectListResponse.kt | 8 +++---- .../models/StoragePresignedUrlCreateParams.kt | 4 ++-- .../StoragePresignedUrlCreateResponse.kt | 2 +- .../openlayer/api/core/http/SerializerTest.kt | 3 ++- 40 files changed, 126 insertions(+), 126 deletions(-) diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt index ac4f540a..7706749b 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt @@ -171,7 +171,7 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var baseUrl: HttpUrl? = null // The default timeout is 1 minute. diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt index 9138e7c9..fa03b8fd 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt @@ -22,7 +22,7 @@ class OpenlayerOkHttpClient private constructor() { @JvmStatic fun fromEnv(): OpenlayerClient = builder().fromEnv().build() } - class Builder { + class Builder internal constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() private var baseUrl: String = ClientOptions.PRODUCTION_URL diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt index 10399f40..5b2da04e 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt @@ -22,7 +22,7 @@ class OpenlayerOkHttpClientAsync private constructor() { @JvmStatic fun fromEnv(): OpenlayerClientAsync = builder().fromEnv().build() } - class Builder { + class Builder internal constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() private var baseUrl: String = ClientOptions.PRODUCTION_URL diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt index 6c6ab1ab..8ccceb3e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt @@ -13,8 +13,7 @@ import com.openlayer.api.services.async.ProjectServiceAsyncImpl import com.openlayer.api.services.async.StorageServiceAsync import com.openlayer.api.services.async.StorageServiceAsyncImpl -class OpenlayerClientAsyncImpl -constructor( +class OpenlayerClientAsyncImpl( private val clientOptions: ClientOptions, ) : OpenlayerClientAsync { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt index c4c12061..046be9d3 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt @@ -13,8 +13,7 @@ import com.openlayer.api.services.blocking.ProjectServiceImpl import com.openlayer.api.services.blocking.StorageService import com.openlayer.api.services.blocking.StorageServiceImpl -class OpenlayerClientImpl -constructor( +class OpenlayerClientImpl( private val clientOptions: ClientOptions, ) : OpenlayerClient { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt index c06e289a..6c8988df 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt @@ -36,7 +36,7 @@ private constructor( @JvmStatic fun fromEnv(): ClientOptions = builder().fromEnv().build() } - class Builder { + class Builder internal constructor() { private var httpClient: HttpClient? = null private var jsonMapper: JsonMapper = jsonMapper() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt index 2b862a37..a1d98a37 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt @@ -23,7 +23,8 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { + private var responseValidation: Boolean? = null private var timeout: Duration? = null diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/Headers.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/Headers.kt index 8b934c1b..f0f29ecd 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/Headers.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/Headers.kt @@ -22,7 +22,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private val map: MutableMap> = TreeMap(String.CASE_INSENSITIVE_ORDER) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt index abe7a23e..348bd8d7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt @@ -22,7 +22,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var method: HttpMethod? = null private var url: String? = null diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/QueryParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/QueryParams.kt index 4a53fb0a..8f4648a3 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/QueryParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/QueryParams.kt @@ -21,7 +21,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private val map: MutableMap> = mutableMapOf() private var size: Int = 0 diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt index 5db3ccec..959d9f3c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt @@ -243,7 +243,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var httpClient: HttpClient? = null private var clock: Clock = Clock.systemUTC() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt index 1ab31a45..e5f84260 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt @@ -30,7 +30,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var additionalProperties: MutableMap = mutableMapOf() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt index b78e4045..a20fb93c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt @@ -15,7 +15,7 @@ import java.util.Optional /** List the test results for a project commit (project version). */ class CommitTestResultListParams -constructor( +private constructor( private val projectVersionId: String, private val includeArchived: Boolean?, private val page: Long?, @@ -82,7 +82,7 @@ constructor( } @NoAutoDetect - class Builder { + class Builder internal constructor() { private var projectVersionId: String? = null private var includeArchived: Boolean? = null diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt index afc2c48d..ba96cacc 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt @@ -66,7 +66,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -274,7 +274,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var dateCreated: JsonField? = null @@ -807,7 +807,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var commentCount: JsonField? = null @@ -1211,7 +1211,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var insightName: JsonField = JsonMissing.of() private var insightParameters: JsonField>? = null @@ -1438,7 +1438,7 @@ private constructor( } } - class Deserializer : BaseDeserializer(Value::class) { + internal class Deserializer : BaseDeserializer(Value::class) { override fun ObjectCodec.deserialize(node: JsonNode): Value { val json = JsonValue.fromJsonNode(node) @@ -1460,7 +1460,7 @@ private constructor( } } - class Serializer : BaseSerializer(Value::class) { + internal class Serializer : BaseSerializer(Value::class) { override fun serialize( value: Value, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt index d1920ba8..70a3587d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt @@ -32,7 +32,7 @@ import java.util.Optional /** Publish an inference data point to an inference pipeline. */ class InferencePipelineDataStreamParams -constructor( +private constructor( private val inferencePipelineId: String, private val body: InferencePipelineDataStreamBody, private val additionalHeaders: Headers, @@ -121,7 +121,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var config: JsonField? = null private var rows: JsonField>? = null @@ -244,7 +244,7 @@ constructor( } @NoAutoDetect - class Builder { + class Builder internal constructor() { private var inferencePipelineId: String? = null private var body: InferencePipelineDataStreamBody.Builder = @@ -574,7 +574,7 @@ constructor( } } - class Deserializer : BaseDeserializer(Config::class) { + internal class Deserializer : BaseDeserializer(Config::class) { override fun ObjectCodec.deserialize(node: JsonNode): Config { val json = JsonValue.fromJsonNode(node) @@ -600,7 +600,7 @@ constructor( } } - class Serializer : BaseSerializer(Config::class) { + internal class Serializer : BaseSerializer(Config::class) { override fun serialize( value: Config, @@ -819,7 +819,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var outputColumnName: JsonField? = null private var contextColumnName: JsonField = JsonMissing.of() @@ -1107,7 +1107,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var content: JsonField = JsonMissing.of() private var role: JsonField = JsonMissing.of() @@ -1385,7 +1385,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var classNames: JsonField>? = null private var categoricalFeatureNames: JsonField>? = null @@ -1789,7 +1789,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var categoricalFeatureNames: JsonField>? = null private var featureNames: JsonField>? = null @@ -2156,7 +2156,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var classNames: JsonField>? = null private var inferenceIdColumnName: JsonField = JsonMissing.of() @@ -2393,7 +2393,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var additionalProperties: MutableMap = mutableMapOf() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt index 68ad1416..f8c664f5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt @@ -54,7 +54,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var success: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt index 5fa52bd8..42943018 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt @@ -13,7 +13,7 @@ import java.util.Optional /** Delete inference pipeline. */ class InferencePipelineDeleteParams -constructor( +private constructor( private val inferencePipelineId: String, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, @@ -51,7 +51,7 @@ constructor( } @NoAutoDetect - class Builder { + class Builder internal constructor() { private var inferencePipelineId: String? = null private var additionalHeaders: Headers.Builder = Headers.builder() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt index a0580c01..3b3e01c2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt @@ -16,7 +16,7 @@ import java.util.Optional /** Retrieve inference pipeline. */ class InferencePipelineRetrieveParams -constructor( +private constructor( private val inferencePipelineId: String, private val expand: List?, private val additionalHeaders: Headers, @@ -57,7 +57,7 @@ constructor( } @NoAutoDetect - class Builder { + class Builder internal constructor() { private var inferencePipelineId: String? = null private var expand: MutableList? = null diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt index ea9f73fa..4eeb70f0 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt @@ -241,7 +241,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var dateCreated: JsonField? = null @@ -515,7 +515,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -856,7 +856,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var creatorId: JsonField? = null @@ -1103,7 +1103,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -1428,7 +1428,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var dateConnected: JsonField? = null @@ -1802,7 +1802,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var creatorId: JsonField? = null @@ -2187,7 +2187,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var executionTimeMs: JsonField = JsonMissing.of() private var monthYear: JsonField = JsonMissing.of() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt index 54db74f4..ce204d5a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt @@ -21,7 +21,7 @@ import java.util.Optional /** Update an inference data point in an inference pipeline. */ class InferencePipelineRowUpdateParams -constructor( +private constructor( private val inferencePipelineId: String, private val inferenceId: String, private val body: InferencePipelineRowUpdateBody, @@ -105,7 +105,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var row: JsonValue? = null private var config: JsonField = JsonMissing.of() @@ -181,7 +181,7 @@ constructor( } @NoAutoDetect - class Builder { + class Builder internal constructor() { private var inferencePipelineId: String? = null private var inferenceId: String? = null @@ -449,7 +449,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var groundTruthColumnName: JsonField = JsonMissing.of() private var humanFeedbackColumnName: JsonField = JsonMissing.of() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt index 2fe5f58f..8af684b7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt @@ -54,7 +54,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var success: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt index a2aad46e..7163a486 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt @@ -15,7 +15,7 @@ import java.util.Optional /** List the latest test results for an inference pipeline. */ class InferencePipelineTestResultListParams -constructor( +private constructor( private val inferencePipelineId: String, private val page: Long?, private val perPage: Long?, @@ -77,7 +77,7 @@ constructor( } @NoAutoDetect - class Builder { + class Builder internal constructor() { private var inferencePipelineId: String? = null private var page: Long? = null diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt index 7493604c..e6b1fdf9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt @@ -66,7 +66,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -277,7 +277,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var dateCreated: JsonField? = null @@ -810,7 +810,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var commentCount: JsonField? = null @@ -1214,7 +1214,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var insightName: JsonField = JsonMissing.of() private var insightParameters: JsonField>? = null @@ -1441,7 +1441,7 @@ private constructor( } } - class Deserializer : BaseDeserializer(Value::class) { + internal class Deserializer : BaseDeserializer(Value::class) { override fun ObjectCodec.deserialize(node: JsonNode): Value { val json = JsonValue.fromJsonNode(node) @@ -1463,7 +1463,7 @@ private constructor( } } - class Serializer : BaseSerializer(Value::class) { + internal class Serializer : BaseSerializer(Value::class) { override fun serialize( value: Value, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt index a1019f64..26fec815 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt @@ -21,7 +21,7 @@ import java.util.Optional /** Update inference pipeline. */ class InferencePipelineUpdateParams -constructor( +private constructor( private val inferencePipelineId: String, private val body: InferencePipelineUpdateBody, private val additionalHeaders: Headers, @@ -144,7 +144,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var description: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() @@ -253,7 +253,7 @@ constructor( } @NoAutoDetect - class Builder { + class Builder internal constructor() { private var inferencePipelineId: String? = null private var body: InferencePipelineUpdateBody.Builder = diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt index cc29a2d6..3ac4ce07 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt @@ -241,7 +241,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var dateCreated: JsonField? = null @@ -515,7 +515,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -856,7 +856,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var creatorId: JsonField? = null @@ -1103,7 +1103,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -1428,7 +1428,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var dateConnected: JsonField? = null @@ -1802,7 +1802,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var creatorId: JsonField? = null @@ -2187,7 +2187,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var executionTimeMs: JsonField = JsonMissing.of() private var monthYear: JsonField = JsonMissing.of() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt index 1aebe85c..8ebac2dc 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt @@ -24,7 +24,7 @@ import java.util.Optional /** Create a new commit (project version) in a project. */ class ProjectCommitCreateParams -constructor( +private constructor( private val projectId: String, private val body: ProjectCommitCreateBody, private val additionalHeaders: Headers, @@ -150,7 +150,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var commit: JsonField? = null private var storageUri: JsonField? = null @@ -256,7 +256,7 @@ constructor( } @NoAutoDetect - class Builder { + class Builder internal constructor() { private var projectId: String? = null private var body: ProjectCommitCreateBody.Builder = ProjectCommitCreateBody.builder() @@ -602,7 +602,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var authorId: JsonField? = null @@ -914,7 +914,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt index 94035610..7eb6d873 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt @@ -241,7 +241,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var commit: JsonField? = null @@ -651,7 +651,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var authorId: JsonField? = null @@ -963,7 +963,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt index f2bdc7f2..d3a6d930 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt @@ -11,7 +11,7 @@ import java.util.Optional /** List the commits (project versions) in a project. */ class ProjectCommitListParams -constructor( +private constructor( private val projectId: String, private val page: Long?, private val perPage: Long?, @@ -57,7 +57,7 @@ constructor( } @NoAutoDetect - class Builder { + class Builder internal constructor() { private var projectId: String? = null private var page: Long? = null diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt index fe718fa4..564a6b9b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt @@ -56,7 +56,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -338,7 +338,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var commit: JsonField? = null @@ -753,7 +753,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var authorId: JsonField? = null @@ -1073,7 +1073,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt index aeacc396..a9c3ca17 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt @@ -24,7 +24,7 @@ import java.util.Optional /** Create a project in your workspace. */ class ProjectCreateParams -constructor( +private constructor( private val body: ProjectCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, @@ -122,7 +122,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var name: JsonField? = null private var taskType: JsonField? = null @@ -214,7 +214,7 @@ constructor( } @NoAutoDetect - class Builder { + class Builder internal constructor() { private var body: ProjectCreateBody.Builder = ProjectCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() @@ -409,7 +409,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -725,7 +725,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var dateConnected: JsonField? = null diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt index 42d2d38e..9853033f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt @@ -215,7 +215,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var creatorId: JsonField? = null @@ -454,7 +454,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -770,7 +770,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var dateConnected: JsonField? = null diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt index ef83c6c7..6b5a69f9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt @@ -25,7 +25,7 @@ import java.util.Optional /** Create an inference pipeline in a project. */ class ProjectInferencePipelineCreateParams -constructor( +private constructor( private val projectId: String, private val body: ProjectInferencePipelineCreateBody, private val additionalHeaders: Headers, @@ -144,7 +144,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var description: JsonField? = null private var name: JsonField? = null @@ -248,7 +248,7 @@ constructor( } @NoAutoDetect - class Builder { + class Builder internal constructor() { private var projectId: String? = null private var body: ProjectInferencePipelineCreateBody.Builder = @@ -457,7 +457,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -798,7 +798,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var creatorId: JsonField? = null @@ -1045,7 +1045,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -1370,7 +1370,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var dateConnected: JsonField? = null @@ -1744,7 +1744,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var creatorId: JsonField? = null @@ -2129,7 +2129,7 @@ constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var executionTimeMs: JsonField = JsonMissing.of() private var monthYear: JsonField = JsonMissing.of() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt index 291f142d..8e44f17a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt @@ -241,7 +241,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var dateCreated: JsonField? = null @@ -516,7 +516,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -857,7 +857,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var creatorId: JsonField? = null @@ -1104,7 +1104,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -1429,7 +1429,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var dateConnected: JsonField? = null @@ -1803,7 +1803,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var creatorId: JsonField? = null @@ -2188,7 +2188,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var executionTimeMs: JsonField = JsonMissing.of() private var monthYear: JsonField = JsonMissing.of() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt index 8e15f0ca..eb121ab1 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt @@ -11,7 +11,7 @@ import java.util.Optional /** List the inference pipelines in a project. */ class ProjectInferencePipelineListParams -constructor( +private constructor( private val projectId: String, private val name: String?, private val page: Long?, @@ -62,7 +62,7 @@ constructor( } @NoAutoDetect - class Builder { + class Builder internal constructor() { private var projectId: String? = null private var name: String? = null diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt index 56cc95b5..850e2d46 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt @@ -57,7 +57,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -348,7 +348,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var dateCreated: JsonField? = null @@ -626,7 +626,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -978,7 +978,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var creatorId: JsonField? = null @@ -1234,7 +1234,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -1563,7 +1563,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var dateConnected: JsonField? = null @@ -1945,7 +1945,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var creatorId: JsonField? = null @@ -2341,7 +2341,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var executionTimeMs: JsonField = JsonMissing.of() private var monthYear: JsonField = JsonMissing.of() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt index 56b6e224..c65063e2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt @@ -14,7 +14,7 @@ import java.util.Optional /** List your workspace's projects. */ class ProjectListParams -constructor( +private constructor( private val name: String?, private val page: Long?, private val perPage: Long?, @@ -60,7 +60,7 @@ constructor( } @NoAutoDetect - class Builder { + class Builder internal constructor() { private var name: String? = null private var page: Long? = null diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt index f4fe5d71..a7b1493a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt @@ -56,7 +56,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -316,7 +316,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var creatorId: JsonField? = null @@ -563,7 +563,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var app: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -888,7 +888,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var id: JsonField? = null private var dateConnected: JsonField? = null diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt index a7926f6d..8152147a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt @@ -13,7 +13,7 @@ import java.util.Optional /** Retrieve a presigned url to post storage artifacts. */ class StoragePresignedUrlCreateParams -constructor( +private constructor( private val objectName: String, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, @@ -51,7 +51,7 @@ constructor( } @NoAutoDetect - class Builder { + class Builder internal constructor() { private var objectName: String? = null private var additionalHeaders: Headers.Builder = Headers.builder() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt index ff957199..befeacaa 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt @@ -66,7 +66,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - class Builder { + class Builder internal constructor() { private var storageUri: JsonField? = null private var url: JsonField? = null diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt index 1acef186..e79b185f 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt @@ -65,7 +65,8 @@ internal class SerializerTest { } @NoAutoDetect - class Builder { + class Builder internal constructor() { + private var isActive: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() From 5f394f52f0d57b38f9664f135e58fa89f98a19d5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 28 Jan 2025 14:29:59 +0000 Subject: [PATCH 10/74] docs: builder, enum, and union comments --- .../client/okhttp/OpenlayerOkHttpClient.kt | 1 + .../okhttp/OpenlayerOkHttpClientAsync.kt | 1 + .../com/openlayer/api/core/ClientOptions.kt | 1 + .../openlayer/api/errors/OpenlayerError.kt | 1 + .../api/models/CommitTestResultListParams.kt | 71 ++++++++ .../models/CommitTestResultListResponse.kt | 55 ++++++ .../InferencePipelineDataStreamParams.kt | 19 +++ .../InferencePipelineDataStreamResponse.kt | 36 ++++ .../models/InferencePipelineDeleteParams.kt | 1 + .../models/InferencePipelineRetrieveParams.kt | 36 ++++ .../InferencePipelineRetrieveResponse.kt | 153 +++++++++++++++++ .../InferencePipelineRowUpdateParams.kt | 3 + .../InferencePipelineRowUpdateResponse.kt | 36 ++++ .../InferencePipelineTestResultListParams.kt | 71 ++++++++ ...InferencePipelineTestResultListResponse.kt | 55 ++++++ .../models/InferencePipelineUpdateParams.kt | 2 + .../models/InferencePipelineUpdateResponse.kt | 153 +++++++++++++++++ .../api/models/ProjectCommitCreateParams.kt | 39 +++++ .../api/models/ProjectCommitCreateResponse.kt | 38 +++++ .../api/models/ProjectCommitListParams.kt | 1 + .../api/models/ProjectCommitListResponse.kt | 41 +++++ .../api/models/ProjectCreateParams.kt | 74 ++++++++ .../api/models/ProjectCreateResponse.kt | 73 ++++++++ .../ProjectInferencePipelineCreateParams.kt | 154 +++++++++++++++++ .../ProjectInferencePipelineCreateResponse.kt | 153 +++++++++++++++++ .../ProjectInferencePipelineListParams.kt | 1 + .../ProjectInferencePipelineListResponse.kt | 159 ++++++++++++++++++ .../openlayer/api/models/ProjectListParams.kt | 36 ++++ .../api/models/ProjectListResponse.kt | 78 +++++++++ .../models/StoragePresignedUrlCreateParams.kt | 1 + .../StoragePresignedUrlCreateResponse.kt | 1 + 31 files changed, 1544 insertions(+) diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt index fa03b8fd..56f960da 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt @@ -22,6 +22,7 @@ class OpenlayerOkHttpClient private constructor() { @JvmStatic fun fromEnv(): OpenlayerClient = builder().fromEnv().build() } + /** A builder for [OpenlayerOkHttpClient]. */ class Builder internal constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt index 5b2da04e..ecb83599 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt @@ -22,6 +22,7 @@ class OpenlayerOkHttpClientAsync private constructor() { @JvmStatic fun fromEnv(): OpenlayerClientAsync = builder().fromEnv().build() } + /** A builder for [OpenlayerOkHttpClientAsync]. */ class Builder internal constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt index 6c8988df..9c72c1ad 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt @@ -36,6 +36,7 @@ private constructor( @JvmStatic fun fromEnv(): ClientOptions = builder().fromEnv().build() } + /** A builder for [ClientOptions]. */ class Builder internal constructor() { private var httpClient: HttpClient? = null diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt index e5f84260..7fcb45a5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt @@ -30,6 +30,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [OpenlayerError]. */ class Builder internal constructor() { private var additionalProperties: MutableMap = mutableMapOf() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt index a20fb93c..3c61bb8f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt @@ -81,6 +81,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CommitTestResultListParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -287,6 +288,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -304,6 +313,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { RUNNING, PASSING, @@ -312,15 +322,32 @@ private constructor( ERROR, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { RUNNING, PASSING, FAILING, SKIPPED, ERROR, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { RUNNING -> Value.RUNNING @@ -331,6 +358,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { RUNNING -> Known.RUNNING @@ -366,6 +402,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -383,6 +427,7 @@ private constructor( @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } + /** An enum containing [Type]'s known values. */ enum class Known { INTEGRITY, CONSISTENCY, @@ -391,15 +436,32 @@ private constructor( ROBUSTNESS, } + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { INTEGRITY, CONSISTENCY, PERFORMANCE, FAIRNESS, ROBUSTNESS, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { INTEGRITY -> Value.INTEGRITY @@ -410,6 +472,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { INTEGRITY -> Known.INTEGRITY diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt index ba96cacc..0862ab8f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt @@ -66,6 +66,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CommitTestResultListResponse]. */ class Builder internal constructor() { private var items: JsonField>? = null @@ -274,6 +275,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Item]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -454,6 +456,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -471,6 +481,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { RUNNING, PASSING, @@ -479,15 +490,34 @@ private constructor( ERROR, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { RUNNING, PASSING, FAILING, SKIPPED, ERROR, + /** + * An enum member indicating that [Status] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { RUNNING -> Value.RUNNING @@ -498,6 +528,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { RUNNING -> Known.RUNNING @@ -807,6 +846,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Goal]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -1211,6 +1251,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Threshold]. */ class Builder internal constructor() { private var insightName: JsonField = JsonMissing.of() @@ -1423,6 +1464,10 @@ private constructor( @JvmStatic fun ofStrings(strings: List) = Value(strings = strings) } + /** + * An interface that defines how to map each variant of [Value] to a value of + * type [T]. + */ interface Visitor { fun visitNumber(number: Double): T @@ -1433,6 +1478,16 @@ private constructor( fun visitStrings(strings: List): T + /** + * Maps an unknown variant of [Value] to a value of type [T]. + * + * An instance of [Value] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, + * if the SDK is on an older version than the API, then the API may respond + * with new variants that the SDK is unaware of. + * + * @throws OpenlayerInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenlayerInvalidDataException("Unknown Value: $json") } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt index 70a3587d..c9d9632d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt @@ -121,6 +121,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [InferencePipelineDataStreamBody]. */ class Builder internal constructor() { private var config: JsonField? = null @@ -243,6 +244,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [InferencePipelineDataStreamParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -557,6 +559,7 @@ private constructor( Config(textClassificationData = textClassificationData) } + /** An interface that defines how to map each variant of [Config] to a value of type [T]. */ interface Visitor { fun visitLlmData(llmData: LlmData): T @@ -569,6 +572,16 @@ private constructor( fun visitTextClassificationData(textClassificationData: TextClassificationData): T + /** + * Maps an unknown variant of [Config] to a value of type [T]. + * + * An instance of [Config] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws OpenlayerInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenlayerInvalidDataException("Unknown Config: $json") } @@ -819,6 +832,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [LlmData]. */ class Builder internal constructor() { private var outputColumnName: JsonField? = null @@ -1107,6 +1121,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Prompt]. */ class Builder internal constructor() { private var content: JsonField = JsonMissing.of() @@ -1385,6 +1400,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [TabularClassificationData]. */ class Builder internal constructor() { private var classNames: JsonField>? = null @@ -1789,6 +1805,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [TabularRegressionData]. */ class Builder internal constructor() { private var categoricalFeatureNames: JsonField>? = null @@ -2156,6 +2173,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [TextClassificationData]. */ class Builder internal constructor() { private var classNames: JsonField>? = null @@ -2393,6 +2411,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Row]. */ class Builder internal constructor() { private var additionalProperties: MutableMap = mutableMapOf() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt index f8c664f5..5e1ffd1b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt @@ -54,6 +54,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [InferencePipelineDataStreamResponse]. */ class Builder internal constructor() { private var success: JsonField? = null @@ -104,6 +105,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -113,21 +122,48 @@ private constructor( @JvmStatic fun of(value: Boolean) = Success(JsonField.of(value)) } + /** An enum containing [Success]'s known values. */ enum class Known { TRUE, } + /** + * An enum containing [Success]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Success] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { TRUE, + /** An enum member indicating that [Success] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { TRUE -> Value.TRUE else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { TRUE -> Known.TRUE diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt index 42943018..ce45f4d2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt @@ -50,6 +50,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [InferencePipelineDeleteParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt index 3b3e01c2..d634968d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt @@ -56,6 +56,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [InferencePipelineRetrieveParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -202,6 +203,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -213,17 +222,35 @@ private constructor( @JvmStatic fun of(value: String) = Expand(JsonField.of(value)) } + /** An enum containing [Expand]'s known values. */ enum class Known { PROJECT, WORKSPACE, } + /** + * An enum containing [Expand]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Expand] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { PROJECT, WORKSPACE, + /** An enum member indicating that [Expand] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { PROJECT -> Value.PROJECT @@ -231,6 +258,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { PROJECT -> Known.PROJECT diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt index 4eeb70f0..709d9e38 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt @@ -241,6 +241,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [InferencePipelineRetrieveResponse]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -515,6 +516,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Links]. */ class Builder internal constructor() { private var app: JsonField? = null @@ -577,6 +579,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -596,6 +606,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { QUEUED, RUNNING, @@ -605,6 +616,15 @@ private constructor( UNKNOWN, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { QUEUED, RUNNING, @@ -612,9 +632,17 @@ private constructor( FAILED, COMPLETED, UNKNOWN, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { QUEUED -> Value.QUEUED @@ -626,6 +654,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { QUEUED -> Known.QUEUED @@ -856,6 +893,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Project]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -1103,6 +1141,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Links]. */ class Builder internal constructor() { private var app: JsonField? = null @@ -1168,6 +1207,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1181,19 +1228,39 @@ private constructor( @JvmStatic fun of(value: String) = Source(JsonField.of(value)) } + /** An enum containing [Source]'s known values. */ enum class Known { WEB, API, NULL, } + /** + * An enum containing [Source]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Source] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { WEB, API, NULL, + /** + * An enum member indicating that [Source] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { WEB -> Value.WEB @@ -1202,6 +1269,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { WEB -> Known.WEB @@ -1232,6 +1308,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1247,6 +1331,7 @@ private constructor( @JvmStatic fun of(value: String) = TaskType(JsonField.of(value)) } + /** An enum containing [TaskType]'s known values. */ enum class Known { LLM_BASE, TABULAR_CLASSIFICATION, @@ -1254,14 +1339,33 @@ private constructor( TEXT_CLASSIFICATION, } + /** + * An enum containing [TaskType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [TaskType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { LLM_BASE, TABULAR_CLASSIFICATION, TABULAR_REGRESSION, TEXT_CLASSIFICATION, + /** + * An enum member indicating that [TaskType] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { LLM_BASE -> Value.LLM_BASE @@ -1271,6 +1375,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { LLM_BASE -> Known.LLM_BASE @@ -1428,6 +1541,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [GitRepo]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -1802,6 +1916,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Workspace]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2038,6 +2153,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -2061,6 +2184,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { ACTIVE, PAST_DUE, @@ -2072,6 +2196,15 @@ private constructor( PAUSED, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { ACTIVE, PAST_DUE, @@ -2081,9 +2214,19 @@ private constructor( INCOMPLETE_EXPIRED, TRIALING, PAUSED, + /** + * An enum member indicating that [Status] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { ACTIVE -> Value.ACTIVE @@ -2097,6 +2240,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { ACTIVE -> Known.ACTIVE @@ -2187,6 +2339,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [MonthlyUsage]. */ class Builder internal constructor() { private var executionTimeMs: JsonField = JsonMissing.of() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt index ce204d5a..cd91be41 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt @@ -105,6 +105,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [InferencePipelineRowUpdateBody]. */ class Builder internal constructor() { private var row: JsonValue? = null @@ -180,6 +181,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [InferencePipelineRowUpdateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -449,6 +451,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Config]. */ class Builder internal constructor() { private var groundTruthColumnName: JsonField = JsonMissing.of() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt index 8af684b7..91c785f5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt @@ -54,6 +54,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [InferencePipelineRowUpdateResponse]. */ class Builder internal constructor() { private var success: JsonField? = null @@ -103,6 +104,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -112,21 +121,48 @@ private constructor( @JvmStatic fun of(value: Boolean) = Success(JsonField.of(value)) } + /** An enum containing [Success]'s known values. */ enum class Known { TRUE, } + /** + * An enum containing [Success]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Success] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { TRUE, + /** An enum member indicating that [Success] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { TRUE -> Value.TRUE else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { TRUE -> Known.TRUE diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt index 7163a486..410a7272 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt @@ -76,6 +76,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [InferencePipelineTestResultListParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -269,6 +270,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -286,6 +295,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { RUNNING, PASSING, @@ -294,15 +304,32 @@ private constructor( ERROR, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { RUNNING, PASSING, FAILING, SKIPPED, ERROR, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { RUNNING -> Value.RUNNING @@ -313,6 +340,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { RUNNING -> Known.RUNNING @@ -348,6 +384,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -365,6 +409,7 @@ private constructor( @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } + /** An enum containing [Type]'s known values. */ enum class Known { INTEGRITY, CONSISTENCY, @@ -373,15 +418,32 @@ private constructor( ROBUSTNESS, } + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { INTEGRITY, CONSISTENCY, PERFORMANCE, FAIRNESS, ROBUSTNESS, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { INTEGRITY -> Value.INTEGRITY @@ -392,6 +454,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { INTEGRITY -> Known.INTEGRITY diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt index e6b1fdf9..0a4e0b10 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt @@ -66,6 +66,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [InferencePipelineTestResultListResponse]. */ class Builder internal constructor() { private var items: JsonField>? = null @@ -277,6 +278,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Item]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -457,6 +459,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -474,6 +484,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { RUNNING, PASSING, @@ -482,15 +493,34 @@ private constructor( ERROR, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { RUNNING, PASSING, FAILING, SKIPPED, ERROR, + /** + * An enum member indicating that [Status] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { RUNNING -> Value.RUNNING @@ -501,6 +531,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { RUNNING -> Known.RUNNING @@ -810,6 +849,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Goal]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -1214,6 +1254,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Threshold]. */ class Builder internal constructor() { private var insightName: JsonField = JsonMissing.of() @@ -1426,6 +1467,10 @@ private constructor( @JvmStatic fun ofStrings(strings: List) = Value(strings = strings) } + /** + * An interface that defines how to map each variant of [Value] to a value of + * type [T]. + */ interface Visitor { fun visitNumber(number: Double): T @@ -1436,6 +1481,16 @@ private constructor( fun visitStrings(strings: List): T + /** + * Maps an unknown variant of [Value] to a value of type [T]. + * + * An instance of [Value] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, + * if the SDK is on an older version than the API, then the API may respond + * with new variants that the SDK is unaware of. + * + * @throws OpenlayerInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenlayerInvalidDataException("Unknown Value: $json") } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt index 26fec815..f8c651b8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt @@ -144,6 +144,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [InferencePipelineUpdateBody]. */ class Builder internal constructor() { private var description: JsonField = JsonMissing.of() @@ -252,6 +253,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [InferencePipelineUpdateParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt index 3ac4ce07..a3dcda39 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt @@ -241,6 +241,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [InferencePipelineUpdateResponse]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -515,6 +516,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Links]. */ class Builder internal constructor() { private var app: JsonField? = null @@ -577,6 +579,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -596,6 +606,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { QUEUED, RUNNING, @@ -605,6 +616,15 @@ private constructor( UNKNOWN, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { QUEUED, RUNNING, @@ -612,9 +632,17 @@ private constructor( FAILED, COMPLETED, UNKNOWN, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { QUEUED -> Value.QUEUED @@ -626,6 +654,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { QUEUED -> Known.QUEUED @@ -856,6 +893,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Project]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -1103,6 +1141,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Links]. */ class Builder internal constructor() { private var app: JsonField? = null @@ -1168,6 +1207,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1181,19 +1228,39 @@ private constructor( @JvmStatic fun of(value: String) = Source(JsonField.of(value)) } + /** An enum containing [Source]'s known values. */ enum class Known { WEB, API, NULL, } + /** + * An enum containing [Source]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Source] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { WEB, API, NULL, + /** + * An enum member indicating that [Source] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { WEB -> Value.WEB @@ -1202,6 +1269,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { WEB -> Known.WEB @@ -1232,6 +1308,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1247,6 +1331,7 @@ private constructor( @JvmStatic fun of(value: String) = TaskType(JsonField.of(value)) } + /** An enum containing [TaskType]'s known values. */ enum class Known { LLM_BASE, TABULAR_CLASSIFICATION, @@ -1254,14 +1339,33 @@ private constructor( TEXT_CLASSIFICATION, } + /** + * An enum containing [TaskType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [TaskType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { LLM_BASE, TABULAR_CLASSIFICATION, TABULAR_REGRESSION, TEXT_CLASSIFICATION, + /** + * An enum member indicating that [TaskType] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { LLM_BASE -> Value.LLM_BASE @@ -1271,6 +1375,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { LLM_BASE -> Known.LLM_BASE @@ -1428,6 +1541,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [GitRepo]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -1802,6 +1916,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Workspace]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2038,6 +2153,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -2061,6 +2184,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { ACTIVE, PAST_DUE, @@ -2072,6 +2196,15 @@ private constructor( PAUSED, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { ACTIVE, PAST_DUE, @@ -2081,9 +2214,19 @@ private constructor( INCOMPLETE_EXPIRED, TRIALING, PAUSED, + /** + * An enum member indicating that [Status] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { ACTIVE -> Value.ACTIVE @@ -2097,6 +2240,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { ACTIVE -> Known.ACTIVE @@ -2187,6 +2339,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [MonthlyUsage]. */ class Builder internal constructor() { private var executionTimeMs: JsonField = JsonMissing.of() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt index 8ebac2dc..abb2dbc7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt @@ -150,6 +150,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ProjectCommitCreateBody]. */ class Builder internal constructor() { private var commit: JsonField? = null @@ -255,6 +256,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ProjectCommitCreateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -602,6 +604,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Commit]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -804,6 +807,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -823,6 +834,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { QUEUED, RUNNING, @@ -832,6 +844,15 @@ private constructor( UNKNOWN, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { QUEUED, RUNNING, @@ -839,9 +860,17 @@ private constructor( FAILED, COMPLETED, UNKNOWN, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { QUEUED -> Value.QUEUED @@ -853,6 +882,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { QUEUED -> Known.QUEUED @@ -914,6 +952,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Links]. */ class Builder internal constructor() { private var app: JsonField? = null diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt index 7eb6d873..e85d9861 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt @@ -241,6 +241,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ProjectCommitCreateResponse]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -651,6 +652,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Commit]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -853,6 +855,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -872,6 +882,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { QUEUED, RUNNING, @@ -881,6 +892,15 @@ private constructor( UNKNOWN, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { QUEUED, RUNNING, @@ -888,9 +908,17 @@ private constructor( FAILED, COMPLETED, UNKNOWN, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { QUEUED -> Value.QUEUED @@ -902,6 +930,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { QUEUED -> Known.QUEUED @@ -963,6 +1000,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Links]. */ class Builder internal constructor() { private var app: JsonField? = null diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt index d3a6d930..b13613d0 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt @@ -56,6 +56,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ProjectCommitListParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt index 564a6b9b..f364f8f5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt @@ -56,6 +56,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ProjectCommitListResponse]. */ class Builder internal constructor() { private var items: JsonField>? = null @@ -338,6 +339,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Item]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -753,6 +755,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Commit]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -961,6 +964,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -980,6 +991,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { QUEUED, RUNNING, @@ -989,6 +1001,15 @@ private constructor( UNKNOWN, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { QUEUED, RUNNING, @@ -996,9 +1017,19 @@ private constructor( FAILED, COMPLETED, UNKNOWN, + /** + * An enum member indicating that [Status] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { QUEUED -> Value.QUEUED @@ -1010,6 +1041,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { QUEUED -> Known.QUEUED @@ -1073,6 +1113,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Links]. */ class Builder internal constructor() { private var app: JsonField? = null diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt index a9c3ca17..ddbb0165 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt @@ -122,6 +122,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ProjectCreateBody]. */ class Builder internal constructor() { private var name: JsonField? = null @@ -213,6 +214,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ProjectCreateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -409,6 +411,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Links]. */ class Builder internal constructor() { private var app: JsonField? = null @@ -471,6 +474,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -484,19 +495,37 @@ private constructor( @JvmStatic fun of(value: String) = Source(JsonField.of(value)) } + /** An enum containing [Source]'s known values. */ enum class Known { WEB, API, NULL, } + /** + * An enum containing [Source]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Source] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { WEB, API, NULL, + /** An enum member indicating that [Source] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { WEB -> Value.WEB @@ -505,6 +534,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { WEB -> Known.WEB @@ -535,6 +573,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -550,6 +596,7 @@ private constructor( @JvmStatic fun of(value: String) = TaskType(JsonField.of(value)) } + /** An enum containing [TaskType]'s known values. */ enum class Known { LLM_BASE, TABULAR_CLASSIFICATION, @@ -557,14 +604,31 @@ private constructor( TEXT_CLASSIFICATION, } + /** + * An enum containing [TaskType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [TaskType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { LLM_BASE, TABULAR_CLASSIFICATION, TABULAR_REGRESSION, TEXT_CLASSIFICATION, + /** An enum member indicating that [TaskType] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { LLM_BASE -> Value.LLM_BASE @@ -574,6 +638,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { LLM_BASE -> Known.LLM_BASE @@ -725,6 +798,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [GitRepo]. */ class Builder internal constructor() { private var id: JsonField? = null diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt index 9853033f..f9ac7b4c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt @@ -215,6 +215,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ProjectCreateResponse]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -454,6 +455,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Links]. */ class Builder internal constructor() { private var app: JsonField? = null @@ -516,6 +518,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -529,19 +539,37 @@ private constructor( @JvmStatic fun of(value: String) = Source(JsonField.of(value)) } + /** An enum containing [Source]'s known values. */ enum class Known { WEB, API, NULL, } + /** + * An enum containing [Source]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Source] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { WEB, API, NULL, + /** An enum member indicating that [Source] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { WEB -> Value.WEB @@ -550,6 +578,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { WEB -> Known.WEB @@ -580,6 +617,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -595,6 +640,7 @@ private constructor( @JvmStatic fun of(value: String) = TaskType(JsonField.of(value)) } + /** An enum containing [TaskType]'s known values. */ enum class Known { LLM_BASE, TABULAR_CLASSIFICATION, @@ -602,14 +648,31 @@ private constructor( TEXT_CLASSIFICATION, } + /** + * An enum containing [TaskType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [TaskType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { LLM_BASE, TABULAR_CLASSIFICATION, TABULAR_REGRESSION, TEXT_CLASSIFICATION, + /** An enum member indicating that [TaskType] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { LLM_BASE -> Value.LLM_BASE @@ -619,6 +682,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { LLM_BASE -> Known.LLM_BASE @@ -770,6 +842,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [GitRepo]. */ class Builder internal constructor() { private var id: JsonField? = null diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt index 6b5a69f9..1951a5a9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt @@ -144,6 +144,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ProjectInferencePipelineCreateBody]. */ class Builder internal constructor() { private var description: JsonField? = null @@ -247,6 +248,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ProjectInferencePipelineCreateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -457,6 +459,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Links]. */ class Builder internal constructor() { private var app: JsonField? = null @@ -519,6 +522,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -538,6 +549,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { QUEUED, RUNNING, @@ -547,6 +559,15 @@ private constructor( UNKNOWN, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { QUEUED, RUNNING, @@ -554,9 +575,17 @@ private constructor( FAILED, COMPLETED, UNKNOWN, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { QUEUED -> Value.QUEUED @@ -568,6 +597,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { QUEUED -> Known.QUEUED @@ -798,6 +836,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Project]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -1045,6 +1084,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Links]. */ class Builder internal constructor() { private var app: JsonField? = null @@ -1110,6 +1150,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1123,19 +1171,39 @@ private constructor( @JvmStatic fun of(value: String) = Source(JsonField.of(value)) } + /** An enum containing [Source]'s known values. */ enum class Known { WEB, API, NULL, } + /** + * An enum containing [Source]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Source] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { WEB, API, NULL, + /** + * An enum member indicating that [Source] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { WEB -> Value.WEB @@ -1144,6 +1212,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { WEB -> Known.WEB @@ -1174,6 +1251,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1189,6 +1274,7 @@ private constructor( @JvmStatic fun of(value: String) = TaskType(JsonField.of(value)) } + /** An enum containing [TaskType]'s known values. */ enum class Known { LLM_BASE, TABULAR_CLASSIFICATION, @@ -1196,14 +1282,33 @@ private constructor( TEXT_CLASSIFICATION, } + /** + * An enum containing [TaskType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [TaskType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { LLM_BASE, TABULAR_CLASSIFICATION, TABULAR_REGRESSION, TEXT_CLASSIFICATION, + /** + * An enum member indicating that [TaskType] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { LLM_BASE -> Value.LLM_BASE @@ -1213,6 +1318,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { LLM_BASE -> Known.LLM_BASE @@ -1370,6 +1484,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [GitRepo]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -1744,6 +1859,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Workspace]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -1980,6 +2096,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -2003,6 +2127,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { ACTIVE, PAST_DUE, @@ -2014,6 +2139,15 @@ private constructor( PAUSED, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { ACTIVE, PAST_DUE, @@ -2023,9 +2157,19 @@ private constructor( INCOMPLETE_EXPIRED, TRIALING, PAUSED, + /** + * An enum member indicating that [Status] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { ACTIVE -> Value.ACTIVE @@ -2039,6 +2183,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { ACTIVE -> Known.ACTIVE @@ -2129,6 +2282,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [MonthlyUsage]. */ class Builder internal constructor() { private var executionTimeMs: JsonField = JsonMissing.of() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt index 8e44f17a..b0f56fd0 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt @@ -241,6 +241,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ProjectInferencePipelineCreateResponse]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -516,6 +517,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Links]. */ class Builder internal constructor() { private var app: JsonField? = null @@ -578,6 +580,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -597,6 +607,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { QUEUED, RUNNING, @@ -606,6 +617,15 @@ private constructor( UNKNOWN, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { QUEUED, RUNNING, @@ -613,9 +633,17 @@ private constructor( FAILED, COMPLETED, UNKNOWN, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { QUEUED -> Value.QUEUED @@ -627,6 +655,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { QUEUED -> Known.QUEUED @@ -857,6 +894,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Project]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -1104,6 +1142,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Links]. */ class Builder internal constructor() { private var app: JsonField? = null @@ -1169,6 +1208,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1182,19 +1229,39 @@ private constructor( @JvmStatic fun of(value: String) = Source(JsonField.of(value)) } + /** An enum containing [Source]'s known values. */ enum class Known { WEB, API, NULL, } + /** + * An enum containing [Source]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Source] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { WEB, API, NULL, + /** + * An enum member indicating that [Source] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { WEB -> Value.WEB @@ -1203,6 +1270,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { WEB -> Known.WEB @@ -1233,6 +1309,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1248,6 +1332,7 @@ private constructor( @JvmStatic fun of(value: String) = TaskType(JsonField.of(value)) } + /** An enum containing [TaskType]'s known values. */ enum class Known { LLM_BASE, TABULAR_CLASSIFICATION, @@ -1255,14 +1340,33 @@ private constructor( TEXT_CLASSIFICATION, } + /** + * An enum containing [TaskType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [TaskType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { LLM_BASE, TABULAR_CLASSIFICATION, TABULAR_REGRESSION, TEXT_CLASSIFICATION, + /** + * An enum member indicating that [TaskType] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { LLM_BASE -> Value.LLM_BASE @@ -1272,6 +1376,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { LLM_BASE -> Known.LLM_BASE @@ -1429,6 +1542,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [GitRepo]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -1803,6 +1917,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Workspace]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2039,6 +2154,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -2062,6 +2185,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { ACTIVE, PAST_DUE, @@ -2073,6 +2197,15 @@ private constructor( PAUSED, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { ACTIVE, PAST_DUE, @@ -2082,9 +2215,19 @@ private constructor( INCOMPLETE_EXPIRED, TRIALING, PAUSED, + /** + * An enum member indicating that [Status] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { ACTIVE -> Value.ACTIVE @@ -2098,6 +2241,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { ACTIVE -> Known.ACTIVE @@ -2188,6 +2340,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [MonthlyUsage]. */ class Builder internal constructor() { private var executionTimeMs: JsonField = JsonMissing.of() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt index eb121ab1..a7fba728 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt @@ -61,6 +61,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ProjectInferencePipelineListParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt index 850e2d46..3d105201 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt @@ -57,6 +57,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ProjectInferencePipelineListResponse]. */ class Builder internal constructor() { private var items: JsonField>? = null @@ -348,6 +349,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Item]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -626,6 +628,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Links]. */ class Builder internal constructor() { private var app: JsonField? = null @@ -691,6 +694,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -710,6 +721,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { QUEUED, RUNNING, @@ -719,6 +731,15 @@ private constructor( UNKNOWN, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { QUEUED, RUNNING, @@ -726,9 +747,19 @@ private constructor( FAILED, COMPLETED, UNKNOWN, + /** + * An enum member indicating that [Status] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { QUEUED -> Value.QUEUED @@ -740,6 +771,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { QUEUED -> Known.QUEUED @@ -978,6 +1018,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Project]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -1234,6 +1275,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Links]. */ class Builder internal constructor() { private var app: JsonField? = null @@ -1300,6 +1342,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1313,19 +1363,40 @@ private constructor( @JvmStatic fun of(value: String) = Source(JsonField.of(value)) } + /** An enum containing [Source]'s known values. */ enum class Known { WEB, API, NULL, } + /** + * An enum containing [Source]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Source] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { WEB, API, NULL, + /** + * An enum member indicating that [Source] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ fun value(): Value = when (this) { WEB -> Value.WEB @@ -1334,6 +1405,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ fun known(): Known = when (this) { WEB -> Known.WEB @@ -1364,6 +1444,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1379,6 +1467,7 @@ private constructor( @JvmStatic fun of(value: String) = TaskType(JsonField.of(value)) } + /** An enum containing [TaskType]'s known values. */ enum class Known { LLM_BASE, TABULAR_CLASSIFICATION, @@ -1386,14 +1475,34 @@ private constructor( TEXT_CLASSIFICATION, } + /** + * An enum containing [TaskType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [TaskType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { LLM_BASE, TABULAR_CLASSIFICATION, TABULAR_REGRESSION, TEXT_CLASSIFICATION, + /** + * An enum member indicating that [TaskType] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ fun value(): Value = when (this) { LLM_BASE -> Value.LLM_BASE @@ -1403,6 +1512,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ fun known(): Known = when (this) { LLM_BASE -> Known.LLM_BASE @@ -1563,6 +1681,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [GitRepo]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -1945,6 +2064,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Workspace]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2192,6 +2312,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -2215,6 +2343,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { ACTIVE, PAST_DUE, @@ -2226,6 +2355,15 @@ private constructor( PAUSED, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { ACTIVE, PAST_DUE, @@ -2235,9 +2373,20 @@ private constructor( INCOMPLETE_EXPIRED, TRIALING, PAUSED, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ fun value(): Value = when (this) { ACTIVE -> Value.ACTIVE @@ -2251,6 +2400,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ fun known(): Known = when (this) { ACTIVE -> Known.ACTIVE @@ -2341,6 +2499,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [MonthlyUsage]. */ class Builder internal constructor() { private var executionTimeMs: JsonField = JsonMissing.of() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt index c65063e2..2efc37a4 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt @@ -59,6 +59,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ProjectListParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -227,6 +228,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -242,6 +251,7 @@ private constructor( @JvmStatic fun of(value: String) = TaskType(JsonField.of(value)) } + /** An enum containing [TaskType]'s known values. */ enum class Known { LLM_BASE, TABULAR_CLASSIFICATION, @@ -249,14 +259,31 @@ private constructor( TEXT_CLASSIFICATION, } + /** + * An enum containing [TaskType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [TaskType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { LLM_BASE, TABULAR_CLASSIFICATION, TABULAR_REGRESSION, TEXT_CLASSIFICATION, + /** An enum member indicating that [TaskType] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { LLM_BASE -> Value.LLM_BASE @@ -266,6 +293,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { LLM_BASE -> Known.LLM_BASE diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt index a7b1493a..9b858e55 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt @@ -56,6 +56,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ProjectListResponse]. */ class Builder internal constructor() { private var items: JsonField>? = null @@ -316,6 +317,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Item]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -563,6 +565,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Links]. */ class Builder internal constructor() { private var app: JsonField? = null @@ -628,6 +631,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -641,19 +652,39 @@ private constructor( @JvmStatic fun of(value: String) = Source(JsonField.of(value)) } + /** An enum containing [Source]'s known values. */ enum class Known { WEB, API, NULL, } + /** + * An enum containing [Source]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Source] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { WEB, API, NULL, + /** + * An enum member indicating that [Source] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { WEB -> Value.WEB @@ -662,6 +693,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { WEB -> Known.WEB @@ -692,6 +732,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -707,6 +755,7 @@ private constructor( @JvmStatic fun of(value: String) = TaskType(JsonField.of(value)) } + /** An enum containing [TaskType]'s known values. */ enum class Known { LLM_BASE, TABULAR_CLASSIFICATION, @@ -714,14 +763,33 @@ private constructor( TEXT_CLASSIFICATION, } + /** + * An enum containing [TaskType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [TaskType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { LLM_BASE, TABULAR_CLASSIFICATION, TABULAR_REGRESSION, TEXT_CLASSIFICATION, + /** + * An enum member indicating that [TaskType] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { LLM_BASE -> Value.LLM_BASE @@ -731,6 +799,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { LLM_BASE -> Known.LLM_BASE @@ -888,6 +965,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [GitRepo]. */ class Builder internal constructor() { private var id: JsonField? = null diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt index 8152147a..56d6be1e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt @@ -50,6 +50,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [StoragePresignedUrlCreateParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt index befeacaa..1d9b3561 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt @@ -66,6 +66,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [StoragePresignedUrlCreateResponse]. */ class Builder internal constructor() { private var storageUri: JsonField? = null From c23eea21cd8a3895c7ed616998516df64ac1b9dd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 06:56:39 +0000 Subject: [PATCH 11/74] chore(internal): codegen related update --- .github/workflows/ci.yml | 5 +- README.md | 411 ++++++++--- SECURITY.md | 4 +- buildSrc/build.gradle.kts | 6 +- .../src/main/kotlin/openlayer.java.gradle.kts | 6 +- .../main/kotlin/openlayer.kotlin.gradle.kts | 11 +- gradle.properties | 3 +- .../api/client/okhttp/OkHttpClient.kt | 111 +-- .../api/client/OpenlayerClientAsyncImpl.kt | 4 +- .../api/client/OpenlayerClientImpl.kt | 4 +- .../openlayer/api/core/BaseDeserializer.kt | 6 +- .../openlayer/api/core/HttpRequestBodies.kt | 11 +- .../kotlin/com/openlayer/api/core/Params.kt | 16 + .../com/openlayer/api/core/PrepareRequest.kt | 24 + .../com/openlayer/api/core/RequestOptions.kt | 6 +- .../kotlin/com/openlayer/api/core/Utils.kt | 36 + .../kotlin/com/openlayer/api/core/Values.kt | 137 ++-- .../com/openlayer/api/core/http/Headers.kt | 4 +- .../com/openlayer/api/core/http/HttpClient.kt | 3 + .../api/core/http/HttpRequestBody.kt | 4 +- .../openlayer/api/core/http/HttpResponse.kt | 3 + .../http/PhantomReachableClosingHttpClient.kt | 7 +- .../openlayer/api/core/http/QueryParams.kt | 2 +- .../api/core/http/RetryingHttpClient.kt | 49 +- .../api/errors/BadRequestException.kt | 7 +- .../openlayer/api/errors/NotFoundException.kt | 7 +- .../openlayer/api/errors/OpenlayerError.kt | 2 +- .../api/errors/OpenlayerServiceException.kt | 2 +- .../api/errors/PermissionDeniedException.kt | 7 +- .../api/errors/RateLimitException.kt | 7 +- .../api/errors/UnauthorizedException.kt | 7 +- .../errors/UnprocessableEntityException.kt | 7 +- .../api/models/CommitTestResultListParams.kt | 48 +- .../models/CommitTestResultListResponse.kt | 24 +- .../InferencePipelineDataStreamParams.kt | 53 +- .../InferencePipelineDataStreamResponse.kt | 21 +- .../models/InferencePipelineDeleteParams.kt | 9 +- .../models/InferencePipelineRetrieveParams.kt | 28 +- .../InferencePipelineRetrieveResponse.kt | 81 ++- .../InferencePipelineRowUpdateParams.kt | 47 +- .../InferencePipelineRowUpdateResponse.kt | 21 +- .../InferencePipelineTestResultListParams.kt | 48 +- ...InferencePipelineTestResultListResponse.kt | 24 +- .../models/InferencePipelineUpdateParams.kt | 46 +- .../models/InferencePipelineUpdateResponse.kt | 81 ++- .../api/models/ProjectCommitCreateParams.kt | 584 ++++++++++++++- .../api/models/ProjectCommitCreateResponse.kt | 20 +- .../api/models/ProjectCommitListParams.kt | 8 +- .../api/models/ProjectCommitListResponse.kt | 22 +- .../api/models/ProjectCreateParams.kt | 545 +++++++++++++- .../api/models/ProjectCreateResponse.kt | 40 +- .../ProjectInferencePipelineCreateParams.kt | 663 ++++++++++++++++-- .../ProjectInferencePipelineCreateResponse.kt | 81 ++- .../ProjectInferencePipelineListParams.kt | 8 +- .../ProjectInferencePipelineListResponse.kt | 85 ++- .../openlayer/api/models/ProjectListParams.kt | 30 +- .../api/models/ProjectListResponse.kt | 43 +- .../models/StoragePresignedUrlCreateParams.kt | 10 +- .../services/async/CommitServiceAsyncImpl.kt | 6 +- .../async/InferencePipelineServiceAsync.kt | 8 +- .../InferencePipelineServiceAsyncImpl.kt | 77 +- .../api/services/async/ProjectServiceAsync.kt | 10 +- .../services/async/ProjectServiceAsyncImpl.kt | 61 +- .../services/async/StorageServiceAsyncImpl.kt | 6 +- .../async/commits/TestResultServiceAsync.kt | 2 +- .../commits/TestResultServiceAsyncImpl.kt | 33 +- .../inferencePipelines/DataServiceAsync.kt | 2 +- .../DataServiceAsyncImpl.kt | 35 +- .../inferencePipelines/RowServiceAsync.kt | 2 +- .../inferencePipelines/RowServiceAsyncImpl.kt | 35 +- .../TestResultServiceAsync.kt | 2 +- .../TestResultServiceAsyncImpl.kt | 33 +- .../async/projects/CommitServiceAsync.kt | 4 +- .../async/projects/CommitServiceAsyncImpl.kt | 61 +- .../projects/InferencePipelineServiceAsync.kt | 4 +- .../InferencePipelineServiceAsyncImpl.kt | 59 +- .../async/storage/PresignedUrlServiceAsync.kt | 2 +- .../storage/PresignedUrlServiceAsyncImpl.kt | 35 +- .../services/blocking/CommitServiceImpl.kt | 6 +- .../blocking/InferencePipelineService.kt | 6 +- .../blocking/InferencePipelineServiceImpl.kt | 65 +- .../api/services/blocking/ProjectService.kt | 10 +- .../services/blocking/ProjectServiceImpl.kt | 53 +- .../services/blocking/StorageServiceImpl.kt | 6 +- .../blocking/commits/TestResultService.kt | 2 +- .../blocking/commits/TestResultServiceImpl.kt | 29 +- .../inferencePipelines/DataService.kt | 2 +- .../inferencePipelines/DataServiceImpl.kt | 30 +- .../blocking/inferencePipelines/RowService.kt | 2 +- .../inferencePipelines/RowServiceImpl.kt | 30 +- .../inferencePipelines/TestResultService.kt | 2 +- .../TestResultServiceImpl.kt | 29 +- .../blocking/projects/CommitService.kt | 4 +- .../blocking/projects/CommitServiceImpl.kt | 53 +- .../projects/InferencePipelineService.kt | 4 +- .../projects/InferencePipelineServiceImpl.kt | 53 +- .../blocking/storage/PresignedUrlService.kt | 2 +- .../storage/PresignedUrlServiceImpl.kt | 31 +- .../com/openlayer/api/TestServerExtension.kt | 2 +- .../api/core/PhantomReachableTest.kt | 2 +- .../com/openlayer/api/core/UtilsTest.kt | 33 + .../com/openlayer/api/core/ValuesTest.kt | 144 ++++ .../openlayer/api/core/http/HeadersTest.kt | 64 +- .../api/core/http/QueryParamsTest.kt | 50 +- .../api/core/http/RetryingHttpClientTest.kt | 146 +++- .../openlayer/api/core/http/SerializerTest.kt | 11 +- .../models/CommitTestResultListParamsTest.kt | 10 +- .../InferencePipelineDataStreamParamsTest.kt | 19 +- .../InferencePipelineDeleteParamsTest.kt | 2 +- .../InferencePipelineRetrieveParamsTest.kt | 10 +- .../InferencePipelineRowUpdateParamsTest.kt | 31 +- ...ferencePipelineTestResultListParamsTest.kt | 10 +- .../InferencePipelineUpdateParamsTest.kt | 19 +- .../models/ProjectCommitCreateParamsTest.kt | 180 ++++- .../api/models/ProjectCommitListParamsTest.kt | 10 +- .../api/models/ProjectCreateParamsTest.kt | 161 ++++- ...rojectInferencePipelineCreateParamsTest.kt | 302 +++++++- .../ProjectInferencePipelineListParamsTest.kt | 10 +- .../api/models/ProjectListParamsTest.kt | 10 +- .../StoragePresignedUrlCreateParamsTest.kt | 10 +- .../api/services/ErrorHandlingTest.kt | 16 +- .../api/services/ServiceParamsTest.kt | 53 +- .../InferencePipelineServiceAsyncTest.kt | 78 +++ .../services/async/ProjectServiceAsyncTest.kt | 94 +++ .../commits/TestResultServiceAsyncTest.kt | 38 + .../DataServiceAsyncTest.kt | 64 ++ .../inferencePipelines/RowServiceAsyncTest.kt | 44 ++ .../TestResultServiceAsyncTest.kt | 37 + .../async/projects/CommitServiceAsyncTest.kt | 95 +++ .../InferencePipelineServiceAsyncTest.kt | 150 ++++ .../storage/PresignedUrlServiceAsyncTest.kt | 31 + .../blocking/InferencePipelineServiceTest.kt | 21 +- .../services/blocking/ProjectServiceTest.kt | 53 +- .../blocking/commits/TestResultServiceTest.kt | 9 +- .../inferencePipelines/DataServiceTest.kt | 9 +- .../inferencePipelines/RowServiceTest.kt | 10 +- .../TestResultServiceTest.kt | 9 +- .../blocking/projects/CommitServiceTest.kt | 49 +- .../projects/InferencePipelineServiceTest.kt | 93 ++- .../storage/PresignedUrlServiceTest.kt | 9 +- scripts/format | 2 +- scripts/lint | 2 +- scripts/test | 2 +- 143 files changed, 5148 insertions(+), 1541 deletions(-) create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Params.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/core/PrepareRequest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/core/UtilsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/core/ValuesTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncTest.kt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5c77a38..2e2883ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Validate Gradle wrapper - uses: gradle/actions/wrapper-validation@v3 - - name: Set up Java uses: actions/setup-java@v4 with: @@ -30,7 +27,7 @@ jobs: cache: gradle - name: Set up Gradle - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v4 - name: Run lints run: ./scripts/lint diff --git a/README.md b/README.md index f4351177..b4545652 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The Openlayer Java SDK provides convenient access to the Openlayer REST API from applications written in Java. -It is generated with [Stainless](https://www.stainlessapi.com/). +It is generated with [Stainless](https://www.stainless.com/). The REST API documentation can be found on [openlayer.com](https://openlayer.com/docs/api-reference/rest/overview). @@ -40,41 +40,110 @@ This library requires Java 8 or later. ## Usage -### Configure the client +```java +import com.openlayer.api.client.OpenlayerClient; +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient; +import com.openlayer.api.core.JsonValue; +import com.openlayer.api.models.InferencePipelineDataStreamParams; +import com.openlayer.api.models.InferencePipelineDataStreamResponse; + +// Configures using the `OPENLAYER_API_KEY` environment variable +OpenlayerClient client = OpenlayerOkHttpClient.fromEnv(); + +InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config(InferencePipelineDataStreamParams.Config.LlmData.builder() + .addInputVariableName("user_query") + .outputColumnName("output") + .numOfTokenColumnName("tokens") + .costColumnName("cost") + .timestampColumnName("timestamp") + .build()) + .addRow(InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("what is the meaning of life?")) + .putAdditionalProperty("output", JsonValue.from("42")) + .putAdditionalProperty("tokens", JsonValue.from(7)) + .putAdditionalProperty("cost", JsonValue.from(0.02)) + .putAdditionalProperty("timestamp", JsonValue.from(1610000000)) + .build()) + .build(); +InferencePipelineDataStreamResponse response = client.inferencePipelines().data().stream(params); +``` -Use `OpenlayerOkHttpClient.builder()` to configure the client. +## Client configuration -Alternately, set the environment with `OPENLAYER_API_KEY`, and use `OpenlayerOkHttpClient.fromEnv()` to read from the environment. +Configure the client using environment variables: ```java import com.openlayer.api.client.OpenlayerClient; import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient; +// Configures using the `OPENLAYER_API_KEY` environment variable OpenlayerClient client = OpenlayerOkHttpClient.fromEnv(); +``` + +Or manually: + +```java +import com.openlayer.api.client.OpenlayerClient; +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient; + +OpenlayerClient client = OpenlayerOkHttpClient.builder() + .apiKey("My API Key") + .build(); +``` + +Or using a combination of the two approaches: + +```java +import com.openlayer.api.client.OpenlayerClient; +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient; -// Note: you can also call fromEnv() from the client builder, for example if you need to set additional properties OpenlayerClient client = OpenlayerOkHttpClient.builder() + // Configures using the `OPENLAYER_API_KEY` environment variable .fromEnv() - // ... set properties on the builder + .apiKey("My API Key") .build(); ``` -| Property | Environment variable | Required | Default value | +See this table for the available options: + +| Setter | Environment variable | Required | Default value | | -------- | -------------------- | -------- | ------------- | -| apiKey | `OPENLAYER_API_KEY` | false | — | +| `apiKey` | `OPENLAYER_API_KEY` | false | - | + +> [!TIP] +> Don't create more than one client in the same application. Each client has a connection pool and +> thread pools, which are more efficient to share between requests. + +## Requests and responses + +To send a request to the Openlayer API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class. + +For example, `client.inferencePipelines().data().stream(...)` should be called with an instance of `InferencePipelineDataStreamParams`, and it will return an instance of `InferencePipelineDataStreamResponse`. -Read the documentation for more configuration options. +## Immutability ---- +Each class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it. -### Example: creating a resource +Each class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy. -To create a new inference pipeline data, first use the `InferencePipelineDataStreamParams` builder to specify attributes, then pass that to the `stream` method of the `data` service. +Because each class is immutable, builder modification will _never_ affect already built class instances. + +## Asynchronous execution + +The default client is synchronous. To switch to asynchronous execution, call the `async()` method: ```java +import com.openlayer.api.client.OpenlayerClient; +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient; import com.openlayer.api.core.JsonValue; import com.openlayer.api.models.InferencePipelineDataStreamParams; import com.openlayer.api.models.InferencePipelineDataStreamResponse; +import java.util.concurrent.CompletableFuture; + +// Configures using the `OPENLAYER_API_KEY` environment variable +OpenlayerClient client = OpenlayerOkHttpClient.fromEnv(); InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -93,109 +162,100 @@ InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.bui .putAdditionalProperty("timestamp", JsonValue.from(1610000000)) .build()) .build(); -InferencePipelineDataStreamResponse response = client.inferencePipelines().data().stream(params); +CompletableFuture response = client.async().inferencePipelines().data().stream(params); ``` ---- - -## Requests - -### Parameters and bodies - -To make a request to the Openlayer API, you generally build an instance of the appropriate `Params` class. - -In [Example: creating a resource](#example-creating-a-resource) above, we used the `InferencePipelineDataStreamParams.builder()` to pass to the `stream` method of the `data` service. - -Sometimes, the API may support other properties that are not yet supported in the Java SDK types. In that case, you can attach them using the `putAdditionalProperty` method. +Or create an asynchronous client from the beginning: ```java +import com.openlayer.api.client.OpenlayerClientAsync; +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync; import com.openlayer.api.core.JsonValue; import com.openlayer.api.models.InferencePipelineDataStreamParams; +import com.openlayer.api.models.InferencePipelineDataStreamResponse; +import java.util.concurrent.CompletableFuture; + +// Configures using the `OPENLAYER_API_KEY` environment variable +OpenlayerClientAsync client = OpenlayerOkHttpClientAsync.fromEnv(); InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() - // ... normal properties - .putAdditionalProperty("secret_param", JsonValue.from("4242")) + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config(InferencePipelineDataStreamParams.Config.LlmData.builder() + .addInputVariableName("user_query") + .outputColumnName("output") + .numOfTokenColumnName("tokens") + .costColumnName("cost") + .timestampColumnName("timestamp") + .build()) + .addRow(InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("what is the meaning of life?")) + .putAdditionalProperty("output", JsonValue.from("42")) + .putAdditionalProperty("tokens", JsonValue.from(7)) + .putAdditionalProperty("cost", JsonValue.from(0.02)) + .putAdditionalProperty("timestamp", JsonValue.from(1610000000)) + .build()) .build(); +CompletableFuture response = client.inferencePipelines().data().stream(params); ``` -## Responses - -### Response validation - -When receiving a response, the Openlayer Java SDK will deserialize it into instances of the typed model classes. In rare cases, the API may return a response property that doesn't match the expected Java type. If you directly access the mistaken property, the SDK will throw an unchecked `OpenlayerInvalidDataException` at runtime. If you would prefer to check in advance that that response is completely well-typed, call `.validate()` on the returned model. - -```java -import com.openlayer.api.models.InferencePipelineDataStreamResponse; +The asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s. -InferencePipelineDataStreamResponse response = client.inferencePipelines().data().stream().validate(); -``` +## Error handling -### Response properties as JSON +The SDK throws custom unchecked exception types: -In rare cases, you may want to access the underlying JSON value for a response property rather than using the typed version provided by this SDK. Each model property has a corresponding JSON version, with an underscore before the method name, which returns a `JsonField` value. +- [`OpenlayerServiceException`](openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code: -```java -import com.openlayer.api.core.JsonField; -import java.util.Optional; + | Status | Exception | + | ------ | ------------------------------- | + | 400 | `BadRequestException` | + | 401 | `AuthenticationException` | + | 403 | `PermissionDeniedException` | + | 404 | `NotFoundException` | + | 422 | `UnprocessableEntityException` | + | 429 | `RateLimitException` | + | 5xx | `InternalServerException` | + | others | `UnexpectedStatusCodeException` | -JsonField field = responseObj._field(); +- [`OpenlayerIoException`](openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerIoException.kt): I/O networking errors. -if (field.isMissing()) { - // Value was not specified in the JSON response -} else if (field.isNull()) { - // Value was provided as a literal null -} else { - // See if value was provided as a string - Optional jsonString = field.asString(); +- [`OpenlayerInvalidDataException`](openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that's supposed to be required, but the API unexpectedly omitted it from the response. - // If the value given by the API did not match the shape that the SDK expects - // you can deserialise into a custom type - MyClass myObj = responseObj._field().asUnknown().orElseThrow().convert(MyClass.class); -} -``` +- [`OpenlayerException`](openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class. -### Additional model properties +## Logging -Sometimes, the server response may include additional properties that are not yet available in this library's types. You can access them using the model's `_additionalProperties` method: +The SDK uses the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor). -```java -import com.openlayer.api.core.JsonValue; +Enable logging by setting the `OPENLAYER_LOG` environment variable to `info`: -JsonValue secret = projectCreateResponse._additionalProperties().get("secret_field"); +```sh +$ export OPENLAYER_LOG=info ``` ---- - ---- - -## Error handling +Or to `debug` for more verbose logging: -This library throws exceptions in a single hierarchy for easy handling: +```sh +$ export OPENLAYER_LOG=debug +``` -- **`OpenlayerException`** - Base exception for all exceptions +## Network options -- **`OpenlayerServiceException`** - HTTP errors with a well-formed response body we were able to parse. The exception message and the `.debuggingRequestId()` will be set by the server. +### Retries - | 400 | BadRequestException | - | ------ | ----------------------------- | - | 401 | AuthenticationException | - | 403 | PermissionDeniedException | - | 404 | NotFoundException | - | 422 | UnprocessableEntityException | - | 429 | RateLimitException | - | 5xx | InternalServerException | - | others | UnexpectedStatusCodeException | +The SDK automatically retries 2 times by default, with a short exponential backoff. -- **`OpenlayerIoException`** - I/O networking errors -- **`OpenlayerInvalidDataException`** - any other exceptions on the client side, e.g.: - - We failed to serialize the request body - - We failed to parse the response body (has access to response code and body) +Only the following error types are retried: -## Network options +- Connection errors (for example, due to a network connectivity problem) +- 408 Request Timeout +- 409 Conflict +- 429 Rate Limit +- 5xx Internal -### Retries +The API may also explicitly instruct the SDK to retry or not retry a response. -Requests that experience certain errors are automatically retried 2 times by default, with a short exponential backoff. Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors will all be retried by default. You can provide a `maxRetries` on the client builder to configure this: +To set a custom number of retries, configure the client using the `maxRetries` method: ```java import com.openlayer.api.client.OpenlayerClient; @@ -209,7 +269,21 @@ OpenlayerClient client = OpenlayerOkHttpClient.builder() ### Timeouts -Requests time out after 1 minute by default. You can configure this on the client builder: +Requests time out after 1 minute by default. + +To set a custom timeout, configure the method call using the `timeout` method: + +```java +import com.openlayer.api.core.JsonValue; +import com.openlayer.api.models.InferencePipelineDataStreamParams; +import com.openlayer.api.models.InferencePipelineDataStreamResponse; + +InferencePipelineDataStreamResponse response = client.inferencePipelines().data().stream( + params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build() +); +``` + +Or configure the default for all method calls at the client level: ```java import com.openlayer.api.client.OpenlayerClient; @@ -224,7 +298,7 @@ OpenlayerClient client = OpenlayerOkHttpClient.builder() ### Proxies -Requests can be routed through a proxy. You can configure this on the client builder: +To route requests through a proxy, configure the client using the `proxy` method: ```java import com.openlayer.api.client.OpenlayerClient; @@ -234,45 +308,176 @@ import java.net.Proxy; OpenlayerClient client = OpenlayerOkHttpClient.builder() .fromEnv() - .proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("example.com", 8080))) + .proxy(new Proxy( + Proxy.Type.HTTP, new InetSocketAddress( + "https://example.com", 8080 + ) + )) .build(); ``` -## Making custom/undocumented requests +## Undocumented API functionality -This library is typed for convenient access to the documented API. If you need to access undocumented params or response properties, the library can still be used. +The SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API. -### Undocumented request params +### Parameters -To make requests using undocumented parameters, you can provide or override parameters on the params object while building it. +To set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class: ```java -FooCreateParams address = FooCreateParams.builder() - .id("my_id") - .putAdditionalProperty("secret_prop", JsonValue.from("hello")) +import com.openlayer.api.core.JsonValue; +import com.openlayer.api.models.InferencePipelineDataStreamParams; + +InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() + .putAdditionalHeader("Secret-Header", "42") + .putAdditionalQueryParam("secret_query_param", "42") + .putAdditionalBodyProperty("secretProperty", JsonValue.from("42")) .build(); ``` -### Undocumented response properties +These can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods. You can also set undocumented parameters on nested headers, query params, or body classes using the `putAdditionalProperty` method. These properties can be accessed on the built object later using the `_additionalProperties()` method. -To access undocumented response properties, you can use `res._additionalProperties()` on a response object to get a map of untyped fields of type `Map`. You can then access fields like `._additionalProperties().get("secret_prop").asString()` or use other helpers defined on the `JsonValue` class to extract it to a desired type. +To set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](openlayer-java-core/src/main/kotlin/com/openlayer/api/core/JsonValue.kt) object to its setter: -## Logging +```java +import com.openlayer.api.core.JsonValue; +import com.openlayer.api.models.InferencePipelineDataStreamParams; + +InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config(InferencePipelineDataStreamParams.Config.LlmData.builder() + .addInputVariableName("user_query") + .outputColumnName("output") + .numOfTokenColumnName("tokens") + .costColumnName("cost") + .timestampColumnName("timestamp") + .build()) + .rows(JsonValue.from(42)) + .build(); +``` -We use the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor). +### Response properties -You can enable logging by setting the environment variable `OPENLAYER_LOG` to `info`. +To access undocumented response properties, call the `_additionalProperties()` method: -```sh -$ export OPENLAYER_LOG=info +```java +import com.openlayer.api.core.JsonValue; +import java.util.Map; + +Map additionalProperties = client.inferencePipelines().data().stream(params)._additionalProperties(); +JsonValue secretPropertyValue = additionalProperties.get("secretProperty"); + +String result = secretPropertyValue.accept(new JsonValue.Visitor<>() { + @Override + public String visitNull() { + return "It's null!"; + } + + @Override + public String visitBoolean(boolean value) { + return "It's a boolean!"; + } + + @Override + public String visitNumber(Number value) { + return "It's a number!"; + } + + // Other methods include `visitMissing`, `visitString`, `visitArray`, and `visitObject` + // The default implementation of each unimplemented method delegates to `visitDefault`, which throws by default, but can also be overridden +}); ``` -Or to `debug` for more verbose logging. +To access a property's raw JSON value, which may be undocumented, call its `_` prefixed method: -```sh -$ export OPENLAYER_LOG=debug +```java +import com.openlayer.api.core.JsonField; +import com.openlayer.api.models.InferencePipelineDataStreamParams; +import java.util.Optional; + +JsonField config = client.inferencePipelines().data().stream(params)._config(); + +if (config.isMissing()) { + // The property is absent from the JSON response +} else if (config.isNull()) { + // The property was set to literal null +} else { + // Check if value was provided as a string + // Other methods include `asNumber()`, `asBoolean()`, etc. + Optional jsonString = config.asString(); + + // Try to deserialize into a custom type + MyClass myObject = config.asUnknown().orElseThrow().convert(MyClass.class); +} +``` + +### Response validation + +In rare cases, the API may return a response that doesn't match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else. + +By default, the SDK will not throw an exception in this case. It will throw [`OpenlayerInvalidDataException`](openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerInvalidDataException.kt) only if you directly access the property. + +If you would prefer to check that the response is completely well-typed upfront, then either call `validate()`: + +```java +import com.openlayer.api.models.InferencePipelineDataStreamResponse; + +InferencePipelineDataStreamResponse response = client.inferencePipelines().data().stream(params).validate(); ``` +Or configure the method call to validate the response using the `responseValidation` method: + +```java +import com.openlayer.api.core.JsonValue; +import com.openlayer.api.models.InferencePipelineDataStreamParams; +import com.openlayer.api.models.InferencePipelineDataStreamResponse; + +InferencePipelineDataStreamResponse response = client.inferencePipelines().data().stream( + params, RequestOptions.builder().responseValidation(true).build() +); +``` + +Or configure the default for all method calls at the client level: + +```java +import com.openlayer.api.client.OpenlayerClient; +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient; + +OpenlayerClient client = OpenlayerOkHttpClient.builder() + .fromEnv() + .responseValidation(true) + .build(); +``` + +## FAQ + +### Why don't you use plain `enum` classes? + +Java `enum` classes are not trivially [forwards compatible](https://www.stainless.com/blog/making-java-enums-forwards-compatible). Using them in the SDK could cause runtime exceptions if the API is updated to respond with a new enum value. + +### Why do you represent fields using `JsonField` instead of just plain `T`? + +Using `JsonField` enables a few features: + +- Allowing usage of [undocumented API functionality](#undocumented-api-functionality) +- Lazily [validating the API response against the expected shape](#response-validation) +- Representing absent vs explicitly null values + +### Why don't you use [`data` classes](https://kotlinlang.org/docs/data-classes.html)? + +It is not [backwards compatible to add new fields to a data class](https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html#avoid-using-data-classes-in-your-api) and we don't want to introduce a breaking change every time we add a field to a class. + +### Why don't you use checked exceptions? + +Checked exceptions are widely considered a mistake in the Java programming language. In fact, they were omitted from Kotlin for this reason. + +Checked exceptions: + +- Are verbose to handle +- Encourage error handling at the wrong level of abstraction, where nothing can be done about the error +- Are tedious to propagate due to the [function coloring problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function) +- Don't play well with lambdas (also due to the function coloring problem) + ## Semantic versioning This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions: diff --git a/SECURITY.md b/SECURITY.md index 6dfa13e4..8614b059 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,9 +2,9 @@ ## Reporting Security Issues -This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. +This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. -To report a security issue, please contact the Stainless team at security@stainlessapi.com. +To report a security issue, please contact the Stainless team at security@stainless.com. ## Responsible Disclosure diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 8a1d7a10..d1ed374d 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,6 +1,6 @@ plugins { `kotlin-dsl` - kotlin("jvm") version "2.1.0" + kotlin("jvm") version "2.1.10" id("com.vanniktech.maven.publish") version "0.28.0" } @@ -10,7 +10,7 @@ repositories { } dependencies { - implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23") + implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.2") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.10") implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0") } diff --git a/buildSrc/src/main/kotlin/openlayer.java.gradle.kts b/buildSrc/src/main/kotlin/openlayer.java.gradle.kts index a2c35b93..597b6e80 100644 --- a/buildSrc/src/main/kotlin/openlayer.java.gradle.kts +++ b/buildSrc/src/main/kotlin/openlayer.java.gradle.kts @@ -39,9 +39,13 @@ tasks.named("jar") { } } -tasks.named("test") { +tasks.withType().configureEach { useJUnitPlatform() + // Run tests in parallel to some degree. + maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1) + forkEvery = 100 + testLogging { exceptionFormat = TestExceptionFormat.FULL } diff --git a/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts b/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts index bc361253..7e46247b 100644 --- a/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts @@ -1,4 +1,5 @@ import com.diffplug.gradle.spotless.SpotlessExtension +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -20,13 +21,19 @@ configure { } tasks.withType().configureEach { - kotlinOptions { + compilerOptions { freeCompilerArgs = listOf( "-Xjvm-default=all", "-Xjdk-release=1.8", // Suppress deprecation warnings because we may still reference and test deprecated members. "-Xsuppress-warning=DEPRECATION" ) - jvmTarget = "1.8" + jvmTarget.set(JvmTarget.JVM_1_8) } } + +// Run tests in parallel to some degree. +tasks.withType().configureEach { + maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1) + forkEvery = 100 +} diff --git a/gradle.properties b/gradle.properties index a3bc58f2..0c8d4ded 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,5 @@ org.gradle.caching=true -org.gradle.jvmargs=-Xmx4g org.gradle.parallel=true +org.gradle.daemon=false +org.gradle.jvmargs=-Xmx4g kotlin.daemon.jvmargs=-Xmx4g diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt index 7706749b..d5dc82df 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt @@ -31,38 +31,8 @@ class OkHttpClient private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val baseUrl: HttpUrl) : HttpClient { - private fun getClient(requestOptions: RequestOptions): okhttp3.OkHttpClient { - val clientBuilder = okHttpClient.newBuilder() - - val logLevel = - when (System.getenv("OPENLAYER_LOG")?.lowercase()) { - "info" -> HttpLoggingInterceptor.Level.BASIC - "debug" -> HttpLoggingInterceptor.Level.BODY - else -> null - } - if (logLevel != null) { - clientBuilder.addNetworkInterceptor( - HttpLoggingInterceptor().setLevel(logLevel).apply { redactHeader("Authorization") } - ) - } - - val timeout = requestOptions.timeout - if (timeout != null) { - clientBuilder - .connectTimeout(timeout) - .readTimeout(timeout) - .writeTimeout(timeout) - .callTimeout(if (timeout.seconds == 0L) timeout else timeout.plusSeconds(30)) - } - - return clientBuilder.build() - } - - override fun execute( - request: HttpRequest, - requestOptions: RequestOptions, - ): HttpResponse { - val call = getClient(requestOptions).newCall(request.toRequest()) + override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse { + val call = newCall(request, requestOptions) return try { call.execute().toResponse() @@ -81,18 +51,18 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val request.body?.run { future.whenComplete { _, _ -> close() } } - val call = getClient(requestOptions).newCall(request.toRequest()) - call.enqueue( - object : Callback { - override fun onResponse(call: Call, response: Response) { - future.complete(response.toResponse()) - } + newCall(request, requestOptions) + .enqueue( + object : Callback { + override fun onResponse(call: Call, response: Response) { + future.complete(response.toResponse()) + } - override fun onFailure(call: Call, e: IOException) { - future.completeExceptionally(OpenlayerIoException("Request failed", e)) + override fun onFailure(call: Call, e: IOException) { + future.completeExceptionally(OpenlayerIoException("Request failed", e)) + } } - } - ) + ) return future } @@ -103,10 +73,37 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val okHttpClient.cache?.close() } - private fun HttpRequest.toRequest(): Request { + private fun newCall(request: HttpRequest, requestOptions: RequestOptions): Call { + val clientBuilder = okHttpClient.newBuilder() + + val logLevel = + when (System.getenv("OPENLAYER_LOG")?.lowercase()) { + "info" -> HttpLoggingInterceptor.Level.BASIC + "debug" -> HttpLoggingInterceptor.Level.BODY + else -> null + } + if (logLevel != null) { + clientBuilder.addNetworkInterceptor( + HttpLoggingInterceptor().setLevel(logLevel).apply { redactHeader("Authorization") } + ) + } + + val timeout = requestOptions.timeout + if (timeout != null) { + clientBuilder + .connectTimeout(timeout) + .readTimeout(timeout) + .writeTimeout(timeout) + .callTimeout(if (timeout.seconds == 0L) timeout else timeout.plusSeconds(30)) + } + + val client = clientBuilder.build() + return client.newCall(request.toRequest(client)) + } + + private fun HttpRequest.toRequest(client: okhttp3.OkHttpClient): Request { var body: RequestBody? = body?.toRequestBody() - // OkHttpClient always requires a request body for PUT and POST methods. - if (body == null && (method == HttpMethod.PUT || method == HttpMethod.POST)) { + if (body == null && requiresBody(method)) { body = "".toRequestBody() } @@ -115,9 +112,33 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val headers.values(name).forEach { builder.header(name, it) } } + if ( + !headers.names().contains("X-Stainless-Read-Timeout") && client.readTimeoutMillis != 0 + ) { + builder.header( + "X-Stainless-Read-Timeout", + Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString(), + ) + } + if (!headers.names().contains("X-Stainless-Timeout") && client.callTimeoutMillis != 0) { + builder.header( + "X-Stainless-Timeout", + Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString(), + ) + } + return builder.build() } + /** `OkHttpClient` always requires a request body for some methods. */ + private fun requiresBody(method: HttpMethod): Boolean = + when (method) { + HttpMethod.POST, + HttpMethod.PUT, + HttpMethod.PATCH -> true + else -> false + } + private fun HttpRequest.toUrl(): String { url?.let { return it diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt index 8ccceb3e..85b8f6e6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt @@ -13,9 +13,7 @@ import com.openlayer.api.services.async.ProjectServiceAsyncImpl import com.openlayer.api.services.async.StorageServiceAsync import com.openlayer.api.services.async.StorageServiceAsyncImpl -class OpenlayerClientAsyncImpl( - private val clientOptions: ClientOptions, -) : OpenlayerClientAsync { +class OpenlayerClientAsyncImpl(private val clientOptions: ClientOptions) : OpenlayerClientAsync { private val clientOptionsWithUserAgent = if (clientOptions.headers.names().contains("User-Agent")) clientOptions diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt index 046be9d3..3b607e5f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt @@ -13,9 +13,7 @@ import com.openlayer.api.services.blocking.ProjectServiceImpl import com.openlayer.api.services.blocking.StorageService import com.openlayer.api.services.blocking.StorageServiceImpl -class OpenlayerClientImpl( - private val clientOptions: ClientOptions, -) : OpenlayerClient { +class OpenlayerClientImpl(private val clientOptions: ClientOptions) : OpenlayerClient { private val clientOptionsWithUserAgent = if (clientOptions.headers.names().contains("User-Agent")) clientOptions diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt index 0573e162..b95fa1a3 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt @@ -18,7 +18,7 @@ abstract class BaseDeserializer(type: KClass) : override fun createContextual( context: DeserializationContext, - property: BeanProperty? + property: BeanProperty?, ): JsonDeserializer { return this } @@ -32,7 +32,7 @@ abstract class BaseDeserializer(type: KClass) : protected fun ObjectCodec.tryDeserialize( node: JsonNode, type: TypeReference, - validate: (T) -> Unit = {} + validate: (T) -> Unit = {}, ): T? { return try { readValue(treeAsTokens(node), type).apply(validate) @@ -46,7 +46,7 @@ abstract class BaseDeserializer(type: KClass) : protected fun ObjectCodec.tryDeserialize( node: JsonNode, type: JavaType, - validate: (T) -> Unit = {} + validate: (T) -> Unit = {}, ): T? { return try { readValue(treeAsTokens(node), type).apply(validate) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/HttpRequestBodies.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/HttpRequestBodies.kt index 8838f20c..9372483c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/HttpRequestBodies.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/HttpRequestBodies.kt @@ -10,10 +10,7 @@ import java.io.OutputStream import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder @JvmSynthetic -internal inline fun json( - jsonMapper: JsonMapper, - value: T, -): HttpRequestBody { +internal inline fun json(jsonMapper: JsonMapper, value: T): HttpRequestBody { return object : HttpRequestBody { private var cachedBytes: ByteArray? = null @@ -49,7 +46,7 @@ internal inline fun json( @JvmSynthetic internal fun multipartFormData( jsonMapper: JsonMapper, - parts: Array?> + parts: Array?>, ): HttpRequestBody { val builder = MultipartEntityBuilder.create() parts.forEach { part -> @@ -66,14 +63,14 @@ internal fun multipartFormData( part.name, buffer.toByteArray(), part.contentType, - part.filename + part.filename, ) } is Boolean -> builder.addTextBody( part.name, if (part.value) "true" else "false", - part.contentType + part.contentType, ) is Int -> builder.addTextBody(part.name, part.value.toString(), part.contentType) is Long -> builder.addTextBody(part.name, part.value.toString(), part.contentType) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Params.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Params.kt new file mode 100644 index 00000000..62cbb730 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Params.kt @@ -0,0 +1,16 @@ +package com.openlayer.api.core + +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams + +/** An interface representing parameters passed to a service method. */ +interface Params { + /** The full set of headers in the parameters, including both fixed and additional headers. */ + fun _headers(): Headers + + /** + * The full set of query params in the parameters, including both fixed and additional query + * params. + */ + fun _queryParams(): QueryParams +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/PrepareRequest.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/PrepareRequest.kt new file mode 100644 index 00000000..adf85bd8 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/PrepareRequest.kt @@ -0,0 +1,24 @@ +@file:JvmName("PrepareRequest") + +package com.openlayer.api.core + +import com.openlayer.api.core.http.HttpRequest +import java.util.concurrent.CompletableFuture + +@JvmSynthetic +internal fun HttpRequest.prepare(clientOptions: ClientOptions, params: Params): HttpRequest = + toBuilder() + .putAllQueryParams(clientOptions.queryParams) + .replaceAllQueryParams(params._queryParams()) + .putAllHeaders(clientOptions.headers) + .replaceAllHeaders(params._headers()) + .build() + +@JvmSynthetic +internal fun HttpRequest.prepareAsync( + clientOptions: ClientOptions, + params: Params, +): CompletableFuture = + // This async version exists to make it easier to add async specific preparation logic in the + // future. + CompletableFuture.completedFuture(prepare(clientOptions, params)) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt index a1d98a37..0bf29708 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt @@ -2,11 +2,7 @@ package com.openlayer.api.core import java.time.Duration -class RequestOptions -private constructor( - val responseValidation: Boolean?, - val timeout: Duration?, -) { +class RequestOptions private constructor(val responseValidation: Boolean?, val timeout: Duration?) { fun applyDefaults(options: RequestOptions): RequestOptions { return RequestOptions( responseValidation = this.responseValidation ?: options.responseValidation, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt index 898b7a66..396e33d3 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt @@ -25,4 +25,40 @@ internal fun , V> SortedMap.toImmutable(): SortedMap { fun asBoolean(): Optional = when (this) { is JsonBoolean -> Optional.of(value) + is KnownValue -> Optional.ofNullable(value as? Boolean) else -> Optional.empty() } fun asNumber(): Optional = when (this) { is JsonNumber -> Optional.of(value) + is KnownValue -> Optional.ofNullable(value as? Number) else -> Optional.empty() } fun asString(): Optional = when (this) { is JsonString -> Optional.of(value) + is KnownValue -> Optional.ofNullable(value as? String) else -> Optional.empty() } fun asStringOrThrow(): String = - when (this) { - is JsonString -> value - else -> throw OpenlayerInvalidDataException("Value is not a string") - } + asString().orElseThrow { OpenlayerInvalidDataException("Value is not a string") } fun asArray(): Optional> = when (this) { is JsonArray -> Optional.of(values) + is KnownValue -> + Optional.ofNullable( + (value as? List<*>)?.map { + try { + JsonValue.from(it) + } catch (e: IllegalArgumentException) { + // The known value is a list, but not all values are convertible to + // `JsonValue`. + return Optional.empty() + } + } + ) else -> Optional.empty() } fun asObject(): Optional> = when (this) { is JsonObject -> Optional.of(values) + is KnownValue -> + Optional.ofNullable( + (value as? Map<*, *>) + ?.map { (key, value) -> + if (key !is String) { + return Optional.empty() + } + + val jsonValue = + try { + JsonValue.from(value) + } catch (e: IllegalArgumentException) { + // The known value is a map, but not all items are convertible + // to `JsonValue`. + return Optional.empty() + } + + key to jsonValue + } + ?.toMap() + ) else -> Optional.empty() } @@ -96,9 +129,9 @@ sealed class JsonField { internal fun getRequired(name: String): T = when (this) { is KnownValue -> value - is JsonMissing -> throw OpenlayerInvalidDataException("'${name}' is not set") - is JsonNull -> throw OpenlayerInvalidDataException("'${name}' is null") - else -> throw OpenlayerInvalidDataException("'${name}' is invalid, received ${this}") + is JsonMissing -> throw OpenlayerInvalidDataException("`$name` is not set") + is JsonNull -> throw OpenlayerInvalidDataException("`$name` is null") + else -> throw OpenlayerInvalidDataException("`$name` is invalid, received $this") } @JvmSynthetic @@ -107,7 +140,7 @@ sealed class JsonField { is KnownValue -> value is JsonMissing -> null is JsonNull -> null - else -> throw OpenlayerInvalidDataException("'${name}' is invalid, received ${this}") + else -> throw OpenlayerInvalidDataException("`$name` is invalid, received $this") } @JvmSynthetic @@ -140,8 +173,11 @@ sealed class JsonField { } } - // This class is a Jackson filter that can be used to exclude missing properties from objects - // This filter should not be used directly and should instead use the @ExcludeMissing annotation + /** + * This class is a Jackson filter that can be used to exclude missing properties from objects. + * This filter should not be used directly and should instead use the @ExcludeMissing + * annotation. + */ class IsMissing { override fun equals(other: Any?): Boolean = other is JsonMissing @@ -154,18 +190,13 @@ sealed class JsonField { override fun createContextual( context: DeserializationContext, property: BeanProperty?, - ): JsonDeserializer> { - return Deserializer(context.contextualType?.containedType(0)) - } + ): JsonDeserializer> = Deserializer(context.contextualType?.containedType(0)) - override fun ObjectCodec.deserialize(node: JsonNode): JsonField<*> { - return type?.let { tryDeserialize(node, type) }?.let { of(it) } + override fun ObjectCodec.deserialize(node: JsonNode): JsonField<*> = + type?.let { tryDeserialize(node, type) }?.let { of(it) } ?: JsonValue.fromJsonNode(node) - } - override fun getNullValue(context: DeserializationContext): JsonField<*> { - return JsonNull.of() - } + override fun getNullValue(context: DeserializationContext): JsonField<*> = JsonNull.of() } } @@ -240,13 +271,9 @@ sealed class JsonValue : JsonField() { } class Deserializer : BaseDeserializer(JsonValue::class) { - override fun ObjectCodec.deserialize(node: JsonNode): JsonValue { - return fromJsonNode(node) - } + override fun ObjectCodec.deserialize(node: JsonNode): JsonValue = fromJsonNode(node) - override fun getNullValue(context: DeserializationContext?): JsonValue { - return JsonNull.of() - } + override fun getNullValue(context: DeserializationContext?): JsonValue = JsonNull.of() } } @@ -287,7 +314,7 @@ class JsonMissing : JsonValue() { override fun serialize( value: JsonMissing, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { throw RuntimeException("JsonMissing cannot be serialized") } @@ -422,10 +449,7 @@ private constructor( } @JacksonAnnotationsInside -@JsonInclude( - JsonInclude.Include.CUSTOM, - valueFilter = JsonField.IsMissing::class, -) +@JsonInclude(JsonInclude.Include.CUSTOM, valueFilter = JsonField.IsMissing::class) annotation class ExcludeMissing @JacksonAnnotationsInside @@ -434,7 +458,7 @@ annotation class ExcludeMissing isGetterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, creatorVisibility = Visibility.NONE, - fieldVisibility = Visibility.NONE + fieldVisibility = Visibility.NONE, ) annotation class NoAutoDetect @@ -443,44 +467,23 @@ internal constructor( val name: String, val value: T, val contentType: ContentType, - val filename: String? = null + val filename: String? = null, ) { - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - name, - contentType, - filename, - when (value) { - is ByteArray -> value.contentHashCode() - is String -> value - is Boolean -> value - is Long -> value - is Double -> value - else -> value?.hashCode() - } - ) - } - return hashCode - } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other == null || this.javaClass != other.javaClass) return false - - other as MultipartFormValue<*> + private val hashCode: Int by lazy { contentHash(name, value, contentType, filename) } - if (name != other.name || contentType != other.contentType || filename != other.filename) - return false + override fun hashCode(): Int = hashCode - return when { - value is ByteArray && other.value is ByteArray -> value contentEquals other.value - else -> value?.equals(other.value) ?: (other.value == null) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } + + return other is MultipartFormValue<*> && + name == other.name && + value contentEquals other.value && + contentType == other.contentType && + filename == other.filename } override fun toString(): String = @@ -496,7 +499,7 @@ internal constructor( internal fun fromString( name: String, value: String, - contentType: ContentType + contentType: ContentType, ): MultipartFormValue = MultipartFormValue(name, value, contentType) internal fun fromBoolean( @@ -520,14 +523,14 @@ internal constructor( internal fun fromEnum( name: String, value: T, - contentType: ContentType + contentType: ContentType, ): MultipartFormValue = MultipartFormValue(name, value, contentType) internal fun fromByteArray( name: String, value: ByteArray, contentType: ContentType, - filename: String? = null + filename: String? = null, ): MultipartFormValue = MultipartFormValue(name, value, contentType, filename) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/Headers.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/Headers.kt index f0f29ecd..b4230b87 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/Headers.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/Headers.kt @@ -6,7 +6,7 @@ import java.util.TreeMap class Headers private constructor( private val map: Map>, - @get:JvmName("size") val size: Int + @get:JvmName("size") val size: Int, ) { fun isEmpty(): Boolean = map.isEmpty() @@ -74,7 +74,7 @@ private constructor( values.toImmutable() } .toImmutable(), - size + size, ) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpClient.kt index bed23ad7..e896be75 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpClient.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpClient.kt @@ -19,4 +19,7 @@ interface HttpClient : AutoCloseable { request: HttpRequest, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** Overridden from [AutoCloseable] to not have a checked exception in its signature. */ + override fun close() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBody.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBody.kt index 32b5f81f..51670e75 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBody.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBody.kt @@ -1,12 +1,11 @@ package com.openlayer.api.core.http -import java.io.IOException import java.io.OutputStream import java.lang.AutoCloseable interface HttpRequestBody : AutoCloseable { - @Throws(IOException::class) fun writeTo(outputStream: OutputStream) + fun writeTo(outputStream: OutputStream) fun contentType(): String? @@ -21,5 +20,6 @@ interface HttpRequestBody : AutoCloseable { */ fun repeatable(): Boolean + /** Overridden from [AutoCloseable] to not have a checked exception in its signature. */ override fun close() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponse.kt index 098bc985..27af0233 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponse.kt @@ -11,6 +11,9 @@ interface HttpResponse : AutoCloseable { fun body(): InputStream + /** Overridden from [AutoCloseable] to not have a checked exception in its signature. */ + override fun close() + interface Handler { fun handle(response: HttpResponse): T diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/PhantomReachableClosingHttpClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/PhantomReachableClosingHttpClient.kt index ab4266ee..75813146 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/PhantomReachableClosingHttpClient.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/PhantomReachableClosingHttpClient.kt @@ -4,6 +4,11 @@ import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.closeWhenPhantomReachable import java.util.concurrent.CompletableFuture +/** + * A delegating wrapper around an `HttpClient` that closes it once it's only phantom reachable. + * + * This class ensures the `HttpClient` is closed even if the user forgets to close it. + */ internal class PhantomReachableClosingHttpClient(private val httpClient: HttpClient) : HttpClient { init { closeWhenPhantomReachable(this, httpClient) @@ -14,7 +19,7 @@ internal class PhantomReachableClosingHttpClient(private val httpClient: HttpCli override fun executeAsync( request: HttpRequest, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture = httpClient.executeAsync(request, requestOptions) override fun close() = httpClient.close() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/QueryParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/QueryParams.kt index 8f4648a3..fdc35912 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/QueryParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/QueryParams.kt @@ -5,7 +5,7 @@ import com.openlayer.api.core.toImmutable class QueryParams private constructor( private val map: Map>, - @get:JvmName("size") val size: Int + @get:JvmName("size") val size: Int, ) { fun isEmpty(): Boolean = map.isEmpty() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt index 959d9f3c..63da1cea 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt @@ -28,10 +28,7 @@ private constructor( private val idempotencyHeader: String?, ) : HttpClient { - override fun execute( - request: HttpRequest, - requestOptions: RequestOptions, - ): HttpResponse { + override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse { if (!isRetryable(request) || maxRetries <= 0) { return httpClient.execute(request, requestOptions) } @@ -57,15 +54,17 @@ private constructor( } response - } catch (t: Throwable) { - if (++retries > maxRetries || !shouldRetry(t)) { - throw t + } catch (throwable: Throwable) { + if (++retries > maxRetries || !shouldRetry(throwable)) { + throw throwable } null } val backoffMillis = getRetryBackoffMillis(retries, response) + // All responses must be closed, so close the failed one before retrying. + response?.close() Thread.sleep(backoffMillis.toMillis()) } } @@ -98,7 +97,7 @@ private constructor( .handleAsync( fun( response: HttpResponse?, - throwable: Throwable? + throwable: Throwable?, ): CompletableFuture { if (response != null) { if (++retries > maxRetries || !shouldRetry(response)) { @@ -113,10 +112,12 @@ private constructor( } val backoffMillis = getRetryBackoffMillis(retries, response) + // All responses must be closed, so close the failed one before retrying. + response?.close() return sleepAsync(backoffMillis.toMillis()).thenCompose { executeWithRetries(requestWithRetryCount, requestOptions) } - }, + } ) { // Run in the same thread. it.run() @@ -196,8 +197,8 @@ private constructor( OffsetDateTime.now(clock), OffsetDateTime.parse( retryAfter, - DateTimeFormatter.RFC_1123_DATE_TIME - ) + DateTimeFormatter.RFC_1123_DATE_TIME, + ), ) } catch (e: DateTimeParseException) { null @@ -223,23 +224,23 @@ private constructor( return Duration.ofNanos((TimeUnit.SECONDS.toNanos(1) * backoffSeconds * jitter).toLong()) } - private fun sleepAsync(millis: Long): CompletableFuture { - val future = CompletableFuture() - TIMER.schedule( - object : TimerTask() { - override fun run() { - future.complete(null) - } - }, - millis - ) - return future - } - companion object { private val TIMER = Timer("RetryingHttpClient", true) + private fun sleepAsync(millis: Long): CompletableFuture { + val future = CompletableFuture() + TIMER.schedule( + object : TimerTask() { + override fun run() { + future.complete(null) + } + }, + millis, + ) + return future + } + @JvmStatic fun builder() = Builder() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt index cddebd08..fdd01aa2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt @@ -2,8 +2,5 @@ package com.openlayer.api.errors import com.openlayer.api.core.http.Headers -class BadRequestException( - headers: Headers, - body: String, - error: OpenlayerError, -) : OpenlayerServiceException(400, headers, body, error) +class BadRequestException(headers: Headers, body: String, error: OpenlayerError) : + OpenlayerServiceException(400, headers, body, error) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt index 0786e638..d47b79cc 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt @@ -2,8 +2,5 @@ package com.openlayer.api.errors import com.openlayer.api.core.http.Headers -class NotFoundException( - headers: Headers, - body: String, - error: OpenlayerError, -) : OpenlayerServiceException(404, headers, body, error) +class NotFoundException(headers: Headers, body: String, error: OpenlayerError) : + OpenlayerServiceException(404, headers, body, error) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt index 7fcb45a5..c6bf606e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt @@ -20,7 +20,7 @@ private constructor( @ExcludeMissing @JsonAnySetter @get:JvmName("additionalProperties") - val additionalProperties: Map = immutableEmptyMap(), + val additionalProperties: Map = immutableEmptyMap() ) { fun toBuilder() = Builder().from(this) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerServiceException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerServiceException.kt index 586f9be6..f170186e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerServiceException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerServiceException.kt @@ -10,7 +10,7 @@ constructor( private val body: String, private val error: OpenlayerError, message: String = "$statusCode: $error", - cause: Throwable? = null + cause: Throwable? = null, ) : OpenlayerException(message, cause) { fun statusCode(): Int = statusCode diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt index 89f54d4e..72a01e62 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt @@ -2,8 +2,5 @@ package com.openlayer.api.errors import com.openlayer.api.core.http.Headers -class PermissionDeniedException( - headers: Headers, - body: String, - error: OpenlayerError, -) : OpenlayerServiceException(403, headers, body, error) +class PermissionDeniedException(headers: Headers, body: String, error: OpenlayerError) : + OpenlayerServiceException(403, headers, body, error) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt index 27bfad40..067918e5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt @@ -2,8 +2,5 @@ package com.openlayer.api.errors import com.openlayer.api.core.http.Headers -class RateLimitException( - headers: Headers, - body: String, - error: OpenlayerError, -) : OpenlayerServiceException(429, headers, body, error) +class RateLimitException(headers: Headers, body: String, error: OpenlayerError) : + OpenlayerServiceException(429, headers, body, error) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt index ba6f77e7..893dbf8f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt @@ -2,8 +2,5 @@ package com.openlayer.api.errors import com.openlayer.api.core.http.Headers -class UnauthorizedException( - headers: Headers, - body: String, - error: OpenlayerError, -) : OpenlayerServiceException(401, headers, body, error) +class UnauthorizedException(headers: Headers, body: String, error: OpenlayerError) : + OpenlayerServiceException(401, headers, body, error) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt index e7d2ecd8..940a85d8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt @@ -2,8 +2,5 @@ package com.openlayer.api.errors import com.openlayer.api.core.http.Headers -class UnprocessableEntityException( - headers: Headers, - body: String, - error: OpenlayerError, -) : OpenlayerServiceException(422, headers, body, error) +class UnprocessableEntityException(headers: Headers, body: String, error: OpenlayerError) : + OpenlayerServiceException(422, headers, body, error) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt index 3c61bb8f..41381416 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonCreator import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams @@ -24,7 +25,7 @@ private constructor( private val type: Type?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, -) { +) : Params { fun projectVersionId(): String = projectVersionId @@ -53,10 +54,9 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders + override fun _headers(): Headers = additionalHeaders - @JvmSynthetic - internal fun getQueryParams(): QueryParams { + override fun _queryParams(): QueryParams { val queryParams = QueryParams.builder() this.includeArchived?.let { queryParams.put("includeArchived", listOf(it.toString())) } this.page?.let { queryParams.put("page", listOf(it.toString())) } @@ -282,11 +282,7 @@ private constructor( * Filter list of test results by status. Available statuses are `running`, `passing`, * `failing`, `skipped`, and `error`. */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -377,7 +373,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -396,11 +404,7 @@ private constructor( * Filter objects by test type. Available types are `integrity`, `consistency`, `performance`, * `fairness`, and `robustness`. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -491,7 +495,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt index 0862ab8f..a70de3ce 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt @@ -119,7 +119,7 @@ private constructor( fun build(): CommitTestResultListResponse = CommitTestResultListResponse( checkRequired("items", items).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -450,11 +450,7 @@ private constructor( } /** The status of the test. */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -547,7 +543,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1520,7 +1528,7 @@ private constructor( override fun serialize( value: Value, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.number != null -> generator.writeObject(value.number) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt index c9d9632d..bdfcbde8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt @@ -20,6 +20,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.getOrThrow import com.openlayer.api.core.http.Headers @@ -34,10 +35,10 @@ import java.util.Optional class InferencePipelineDataStreamParams private constructor( private val inferencePipelineId: String, - private val body: InferencePipelineDataStreamBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, -) { +) : Params { fun inferencePipelineId(): String = inferencePipelineId @@ -59,11 +60,11 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun getBody(): InferencePipelineDataStreamBody = body + @JvmSynthetic internal fun _body(): Body = body - @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders + override fun _headers(): Headers = additionalHeaders - @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams + override fun _queryParams(): QueryParams = additionalQueryParams fun getPathParam(index: Int): String { return when (index) { @@ -73,9 +74,9 @@ private constructor( } @NoAutoDetect - class InferencePipelineDataStreamBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("config") @ExcludeMissing private val config: JsonField = JsonMissing.of(), @@ -104,7 +105,7 @@ private constructor( private var validated: Boolean = false - fun validate(): InferencePipelineDataStreamBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -121,7 +122,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InferencePipelineDataStreamBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var config: JsonField? = null @@ -129,13 +130,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineDataStreamBody: InferencePipelineDataStreamBody) = - apply { - config = inferencePipelineDataStreamBody.config - rows = inferencePipelineDataStreamBody.rows.map { it.toMutableList() } - additionalProperties = - inferencePipelineDataStreamBody.additionalProperties.toMutableMap() - } + internal fun from(body: Body) = apply { + config = body.config + rows = body.rows.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } /** * Configuration for the data stream. Depends on your **Openlayer project task type**. @@ -211,8 +210,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InferencePipelineDataStreamBody = - InferencePipelineDataStreamBody( + fun build(): Body = + Body( checkRequired("config", config), checkRequired("rows", rows).map { it.toImmutable() }, additionalProperties.toImmutable(), @@ -224,7 +223,7 @@ private constructor( return true } - return /* spotless:off */ other is InferencePipelineDataStreamBody && config == other.config && rows == other.rows && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && config == other.config && rows == other.rows && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -234,7 +233,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "InferencePipelineDataStreamBody{config=$config, rows=$rows, additionalProperties=$additionalProperties}" + "Body{config=$config, rows=$rows, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -249,8 +248,7 @@ private constructor( class Builder internal constructor() { private var inferencePipelineId: String? = null - private var body: InferencePipelineDataStreamBody.Builder = - InferencePipelineDataStreamBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -618,7 +616,7 @@ private constructor( override fun serialize( value: Config, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.llmData != null -> generator.writeObject(value.llmData) @@ -1169,12 +1167,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Prompt = - Prompt( - content, - role, - additionalProperties.toImmutable(), - ) + fun build(): Prompt = Prompt(content, role, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -2387,7 +2380,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt index 5e1ffd1b..f5a04063 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt @@ -95,15 +95,11 @@ private constructor( fun build(): InferencePipelineDataStreamResponse = InferencePipelineDataStreamResponse( checkRequired("success", success), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } - class Success - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Success @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -124,7 +120,7 @@ private constructor( /** An enum containing [Success]'s known values. */ enum class Known { - TRUE, + TRUE } /** @@ -170,7 +166,16 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Success: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asBoolean(): Boolean = + _value().asBoolean().orElseThrow { + OpenlayerInvalidDataException("Value is not a Boolean") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt index ce45f4d2..4cb15c35 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt @@ -4,6 +4,7 @@ package com.openlayer.api.models import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams @@ -18,7 +19,7 @@ private constructor( private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, -) { +) : Params { fun inferencePipelineId(): String = inferencePipelineId @@ -29,12 +30,12 @@ private constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties @JvmSynthetic - internal fun getBody(): Optional> = + internal fun _body(): Optional> = Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders + override fun _headers(): Headers = additionalHeaders - @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams + override fun _queryParams(): QueryParams = additionalQueryParams fun getPathParam(index: Int): String { return when (index) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt index d634968d..ecfc7bb4 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonCreator import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams @@ -21,7 +22,7 @@ private constructor( private val expand: List?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, -) { +) : Params { fun inferencePipelineId(): String = inferencePipelineId @@ -32,10 +33,9 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders + override fun _headers(): Headers = additionalHeaders - @JvmSynthetic - internal fun getQueryParams(): QueryParams { + override fun _queryParams(): QueryParams { val queryParams = QueryParams.builder() this.expand?.let { queryParams.put("expand", listOf(it.joinToString(separator = ","))) } queryParams.putAll(additionalQueryParams) @@ -197,11 +197,7 @@ private constructor( ) } - class Expand - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Expand @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -274,7 +270,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Expand: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt index 709d9e38..56b384ef 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt @@ -573,11 +573,7 @@ private constructor( } /** The status of test evaluation for the inference pipeline. */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -674,7 +670,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1201,11 +1209,7 @@ private constructor( } /** The source of the project. */ - class Source - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Source @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1286,7 +1290,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Source: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1302,11 +1318,8 @@ private constructor( } /** The task type of the project. */ - class TaskType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class TaskType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1393,7 +1406,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -2147,11 +2172,7 @@ private constructor( ) } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2262,7 +2283,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt index cd91be41..ccdfc55f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt @@ -11,6 +11,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams @@ -24,10 +25,10 @@ class InferencePipelineRowUpdateParams private constructor( private val inferencePipelineId: String, private val inferenceId: String, - private val body: InferencePipelineRowUpdateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, -) { +) : Params { fun inferencePipelineId(): String = inferencePipelineId @@ -46,12 +47,11 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun getBody(): InferencePipelineRowUpdateBody = body + @JvmSynthetic internal fun _body(): Body = body - @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders + override fun _headers(): Headers = additionalHeaders - @JvmSynthetic - internal fun getQueryParams(): QueryParams { + override fun _queryParams(): QueryParams { val queryParams = QueryParams.builder() this.inferenceId.let { queryParams.put("inferenceId", listOf(it.toString())) } queryParams.putAll(additionalQueryParams) @@ -66,9 +66,9 @@ private constructor( } @NoAutoDetect - class InferencePipelineRowUpdateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("row") @ExcludeMissing private val row: JsonValue = JsonMissing.of(), @JsonProperty("config") @ExcludeMissing @@ -89,7 +89,7 @@ private constructor( private var validated: Boolean = false - fun validate(): InferencePipelineRowUpdateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -105,7 +105,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InferencePipelineRowUpdateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var row: JsonValue? = null @@ -113,13 +113,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineRowUpdateBody: InferencePipelineRowUpdateBody) = - apply { - row = inferencePipelineRowUpdateBody.row - config = inferencePipelineRowUpdateBody.config - additionalProperties = - inferencePipelineRowUpdateBody.additionalProperties.toMutableMap() - } + internal fun from(body: Body) = apply { + row = body.row + config = body.config + additionalProperties = body.additionalProperties.toMutableMap() + } fun row(row: JsonValue) = apply { this.row = row } @@ -148,12 +146,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InferencePipelineRowUpdateBody = - InferencePipelineRowUpdateBody( - checkRequired("row", row), - config, - additionalProperties.toImmutable(), - ) + fun build(): Body = + Body(checkRequired("row", row), config, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -161,7 +155,7 @@ private constructor( return true } - return /* spotless:off */ other is InferencePipelineRowUpdateBody && row == other.row && config == other.config && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && row == other.row && config == other.config && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -171,7 +165,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "InferencePipelineRowUpdateBody{row=$row, config=$config, additionalProperties=$additionalProperties}" + "Body{row=$row, config=$config, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -187,8 +181,7 @@ private constructor( private var inferencePipelineId: String? = null private var inferenceId: String? = null - private var body: InferencePipelineRowUpdateBody.Builder = - InferencePipelineRowUpdateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt index 91c785f5..54d7c27d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt @@ -94,15 +94,11 @@ private constructor( fun build(): InferencePipelineRowUpdateResponse = InferencePipelineRowUpdateResponse( checkRequired("success", success), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } - class Success - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Success @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -123,7 +119,7 @@ private constructor( /** An enum containing [Success]'s known values. */ enum class Known { - TRUE, + TRUE } /** @@ -169,7 +165,16 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Success: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asBoolean(): Boolean = + _value().asBoolean().orElseThrow { + OpenlayerInvalidDataException("Value is not a Boolean") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt index 410a7272..f45bbaae 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonCreator import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams @@ -23,7 +24,7 @@ private constructor( private val type: Type?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, -) { +) : Params { fun inferencePipelineId(): String = inferencePipelineId @@ -49,10 +50,9 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders + override fun _headers(): Headers = additionalHeaders - @JvmSynthetic - internal fun getQueryParams(): QueryParams { + override fun _queryParams(): QueryParams { val queryParams = QueryParams.builder() this.page?.let { queryParams.put("page", listOf(it.toString())) } this.perPage?.let { queryParams.put("perPage", listOf(it.toString())) } @@ -264,11 +264,7 @@ private constructor( * Filter list of test results by status. Available statuses are `running`, `passing`, * `failing`, `skipped`, and `error`. */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -359,7 +355,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -378,11 +386,7 @@ private constructor( * Filter objects by test type. Available types are `integrity`, `consistency`, `performance`, * `fairness`, and `robustness`. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -473,7 +477,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt index 0a4e0b10..66529984 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt @@ -122,7 +122,7 @@ private constructor( fun build(): InferencePipelineTestResultListResponse = InferencePipelineTestResultListResponse( checkRequired("items", items).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -453,11 +453,7 @@ private constructor( } /** The status of the test. */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -550,7 +546,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1523,7 +1531,7 @@ private constructor( override fun serialize( value: Value, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.number != null -> generator.writeObject(value.number) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt index f8c651b8..69beb028 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt @@ -11,6 +11,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams @@ -23,10 +24,10 @@ import java.util.Optional class InferencePipelineUpdateParams private constructor( private val inferencePipelineId: String, - private val body: InferencePipelineUpdateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, -) { +) : Params { fun inferencePipelineId(): String = inferencePipelineId @@ -60,11 +61,11 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun getBody(): InferencePipelineUpdateBody = body + @JvmSynthetic internal fun _body(): Body = body - @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders + override fun _headers(): Headers = additionalHeaders - @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams + override fun _queryParams(): QueryParams = additionalQueryParams fun getPathParam(index: Int): String { return when (index) { @@ -74,9 +75,9 @@ private constructor( } @NoAutoDetect - class InferencePipelineUpdateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), @@ -126,7 +127,7 @@ private constructor( private var validated: Boolean = false - fun validate(): InferencePipelineUpdateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -144,7 +145,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InferencePipelineUpdateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var description: JsonField = JsonMissing.of() @@ -153,12 +154,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineUpdateBody: InferencePipelineUpdateBody) = apply { - description = inferencePipelineUpdateBody.description - name = inferencePipelineUpdateBody.name - referenceDatasetUri = inferencePipelineUpdateBody.referenceDatasetUri - additionalProperties = - inferencePipelineUpdateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + description = body.description + name = body.name + referenceDatasetUri = body.referenceDatasetUri + additionalProperties = body.additionalProperties.toMutableMap() } /** The inference pipeline description. */ @@ -219,13 +219,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InferencePipelineUpdateBody = - InferencePipelineUpdateBody( - description, - name, - referenceDatasetUri, - additionalProperties.toImmutable(), - ) + fun build(): Body = + Body(description, name, referenceDatasetUri, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -233,7 +228,7 @@ private constructor( return true } - return /* spotless:off */ other is InferencePipelineUpdateBody && description == other.description && name == other.name && referenceDatasetUri == other.referenceDatasetUri && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && description == other.description && name == other.name && referenceDatasetUri == other.referenceDatasetUri && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -243,7 +238,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "InferencePipelineUpdateBody{description=$description, name=$name, referenceDatasetUri=$referenceDatasetUri, additionalProperties=$additionalProperties}" + "Body{description=$description, name=$name, referenceDatasetUri=$referenceDatasetUri, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -258,8 +253,7 @@ private constructor( class Builder internal constructor() { private var inferencePipelineId: String? = null - private var body: InferencePipelineUpdateBody.Builder = - InferencePipelineUpdateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt index a3dcda39..bad46f2c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt @@ -573,11 +573,7 @@ private constructor( } /** The status of test evaluation for the inference pipeline. */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -674,7 +670,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1201,11 +1209,7 @@ private constructor( } /** The source of the project. */ - class Source - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Source @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1286,7 +1290,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Source: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1302,11 +1318,8 @@ private constructor( } /** The task type of the project. */ - class TaskType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class TaskType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1393,7 +1406,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -2147,11 +2172,7 @@ private constructor( ) } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2262,7 +2283,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt index abb2dbc7..7a5cd196 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt @@ -12,6 +12,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams @@ -26,48 +27,130 @@ import java.util.Optional class ProjectCommitCreateParams private constructor( private val projectId: String, - private val body: ProjectCommitCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, -) { +) : Params { fun projectId(): String = projectId + /** The project version (commit) id. */ + fun id(): String = body.id() + /** The details of a commit (project version). */ fun commit(): Commit = body.commit() + /** The commit archive date. */ + fun dateArchived(): Optional = body.dateArchived() + + /** The project version (commit) creation date. */ + fun dateCreated(): OffsetDateTime = body.dateCreated() + + /** The number of tests that are failing for the commit. */ + fun failingGoalCount(): Long = body.failingGoalCount() + + /** The model id. */ + fun mlModelId(): Optional = body.mlModelId() + + /** The number of tests that are passing for the commit. */ + fun passingGoalCount(): Long = body.passingGoalCount() + + /** The project id. */ + fun projectId(): String = body.projectId() + + /** + * The commit status. Initially, the commit is `queued`, then, it switches to `running`. + * Finally, it can be `paused`, `failed`, or `completed`. + */ + fun status(): Status = body.status() + + /** The commit status message. */ + fun statusMessage(): Optional = body.statusMessage() + /** The storage URI where the commit bundle is stored. */ fun storageUri(): String = body.storageUri() + /** The total number of tests for the commit. */ + fun totalGoalCount(): Long = body.totalGoalCount() + + /** The training dataset id. */ + fun trainingDatasetId(): Optional = body.trainingDatasetId() + + /** The validation dataset id. */ + fun validationDatasetId(): Optional = body.validationDatasetId() + /** Whether the commit is archived. */ fun archived(): Optional = body.archived() /** The deployment status associated with the commit's model. */ fun deploymentStatus(): Optional = body.deploymentStatus() + fun links(): Optional = body.links() + + /** The project version (commit) id. */ + fun _id(): JsonField = body._id() + /** The details of a commit (project version). */ fun _commit(): JsonField = body._commit() + /** The commit archive date. */ + fun _dateArchived(): JsonField = body._dateArchived() + + /** The project version (commit) creation date. */ + fun _dateCreated(): JsonField = body._dateCreated() + + /** The number of tests that are failing for the commit. */ + fun _failingGoalCount(): JsonField = body._failingGoalCount() + + /** The model id. */ + fun _mlModelId(): JsonField = body._mlModelId() + + /** The number of tests that are passing for the commit. */ + fun _passingGoalCount(): JsonField = body._passingGoalCount() + + /** The project id. */ + fun _projectId(): JsonField = body._projectId() + + /** + * The commit status. Initially, the commit is `queued`, then, it switches to `running`. + * Finally, it can be `paused`, `failed`, or `completed`. + */ + fun _status(): JsonField = body._status() + + /** The commit status message. */ + fun _statusMessage(): JsonField = body._statusMessage() + /** The storage URI where the commit bundle is stored. */ fun _storageUri(): JsonField = body._storageUri() + /** The total number of tests for the commit. */ + fun _totalGoalCount(): JsonField = body._totalGoalCount() + + /** The training dataset id. */ + fun _trainingDatasetId(): JsonField = body._trainingDatasetId() + + /** The validation dataset id. */ + fun _validationDatasetId(): JsonField = body._validationDatasetId() + /** Whether the commit is archived. */ fun _archived(): JsonField = body._archived() /** The deployment status associated with the commit's model. */ fun _deploymentStatus(): JsonField = body._deploymentStatus() + fun _links(): JsonField = body._links() + fun _additionalBodyProperties(): Map = body._additionalProperties() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun getBody(): ProjectCommitCreateBody = body + @JvmSynthetic internal fun _body(): Body = body - @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders + override fun _headers(): Headers = additionalHeaders - @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams + override fun _queryParams(): QueryParams = additionalQueryParams fun getPathParam(index: Int): String { return when (index) { @@ -77,31 +160,111 @@ private constructor( } @NoAutoDetect - class ProjectCommitCreateBody + class Body @JsonCreator - internal constructor( + private constructor( + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), @JsonProperty("commit") @ExcludeMissing private val commit: JsonField = JsonMissing.of(), + @JsonProperty("dateArchived") + @ExcludeMissing + private val dateArchived: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("failingGoalCount") + @ExcludeMissing + private val failingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("mlModelId") + @ExcludeMissing + private val mlModelId: JsonField = JsonMissing.of(), + @JsonProperty("passingGoalCount") + @ExcludeMissing + private val passingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + private val projectId: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + private val statusMessage: JsonField = JsonMissing.of(), @JsonProperty("storageUri") @ExcludeMissing private val storageUri: JsonField = JsonMissing.of(), + @JsonProperty("totalGoalCount") + @ExcludeMissing + private val totalGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("trainingDatasetId") + @ExcludeMissing + private val trainingDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("validationDatasetId") + @ExcludeMissing + private val validationDatasetId: JsonField = JsonMissing.of(), @JsonProperty("archived") @ExcludeMissing private val archived: JsonField = JsonMissing.of(), @JsonProperty("deploymentStatus") @ExcludeMissing private val deploymentStatus: JsonField = JsonMissing.of(), + @JsonProperty("links") + @ExcludeMissing + private val links: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** The project version (commit) id. */ + fun id(): String = id.getRequired("id") + /** The details of a commit (project version). */ fun commit(): Commit = commit.getRequired("commit") + /** The commit archive date. */ + fun dateArchived(): Optional = + Optional.ofNullable(dateArchived.getNullable("dateArchived")) + + /** The project version (commit) creation date. */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** The number of tests that are failing for the commit. */ + fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") + + /** The model id. */ + fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + + /** The number of tests that are passing for the commit. */ + fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") + + /** The project id. */ + fun projectId(): String = projectId.getRequired("projectId") + + /** + * The commit status. Initially, the commit is `queued`, then, it switches to `running`. + * Finally, it can be `paused`, `failed`, or `completed`. + */ + fun status(): Status = status.getRequired("status") + + /** The commit status message. */ + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) + /** The storage URI where the commit bundle is stored. */ fun storageUri(): String = storageUri.getRequired("storageUri") + /** The total number of tests for the commit. */ + fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") + + /** The training dataset id. */ + fun trainingDatasetId(): Optional = + Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + + /** The validation dataset id. */ + fun validationDatasetId(): Optional = + Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + /** Whether the commit is archived. */ fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) @@ -109,14 +272,71 @@ private constructor( fun deploymentStatus(): Optional = Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + fun links(): Optional = Optional.ofNullable(links.getNullable("links")) + + /** The project version (commit) id. */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** The details of a commit (project version). */ @JsonProperty("commit") @ExcludeMissing fun _commit(): JsonField = commit + /** The commit archive date. */ + @JsonProperty("dateArchived") + @ExcludeMissing + fun _dateArchived(): JsonField = dateArchived + + /** The project version (commit) creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** The number of tests that are failing for the commit. */ + @JsonProperty("failingGoalCount") + @ExcludeMissing + fun _failingGoalCount(): JsonField = failingGoalCount + + /** The model id. */ + @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId(): JsonField = mlModelId + + /** The number of tests that are passing for the commit. */ + @JsonProperty("passingGoalCount") + @ExcludeMissing + fun _passingGoalCount(): JsonField = passingGoalCount + + /** The project id. */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + + /** + * The commit status. Initially, the commit is `queued`, then, it switches to `running`. + * Finally, it can be `paused`, `failed`, or `completed`. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** The commit status message. */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + /** The storage URI where the commit bundle is stored. */ @JsonProperty("storageUri") @ExcludeMissing fun _storageUri(): JsonField = storageUri + /** The total number of tests for the commit. */ + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun _totalGoalCount(): JsonField = totalGoalCount + + /** The training dataset id. */ + @JsonProperty("trainingDatasetId") + @ExcludeMissing + fun _trainingDatasetId(): JsonField = trainingDatasetId + + /** The validation dataset id. */ + @JsonProperty("validationDatasetId") + @ExcludeMissing + fun _validationDatasetId(): JsonField = validationDatasetId + /** Whether the commit is archived. */ @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived @@ -125,21 +345,36 @@ private constructor( @ExcludeMissing fun _deploymentStatus(): JsonField = deploymentStatus + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): ProjectCommitCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } + id() commit().validate() + dateArchived() + dateCreated() + failingGoalCount() + mlModelId() + passingGoalCount() + projectId() + status() + statusMessage() storageUri() + totalGoalCount() + trainingDatasetId() + validationDatasetId() archived() deploymentStatus() + links().ifPresent { it.validate() } validated = true } @@ -150,36 +385,181 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ProjectCommitCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { + private var id: JsonField? = null private var commit: JsonField? = null + private var dateArchived: JsonField? = null + private var dateCreated: JsonField? = null + private var failingGoalCount: JsonField? = null + private var mlModelId: JsonField? = null + private var passingGoalCount: JsonField? = null + private var projectId: JsonField? = null + private var status: JsonField? = null + private var statusMessage: JsonField? = null private var storageUri: JsonField? = null + private var totalGoalCount: JsonField? = null + private var trainingDatasetId: JsonField? = null + private var validationDatasetId: JsonField? = null private var archived: JsonField = JsonMissing.of() private var deploymentStatus: JsonField = JsonMissing.of() + private var links: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(projectCommitCreateBody: ProjectCommitCreateBody) = apply { - commit = projectCommitCreateBody.commit - storageUri = projectCommitCreateBody.storageUri - archived = projectCommitCreateBody.archived - deploymentStatus = projectCommitCreateBody.deploymentStatus - additionalProperties = projectCommitCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + id = body.id + commit = body.commit + dateArchived = body.dateArchived + dateCreated = body.dateCreated + failingGoalCount = body.failingGoalCount + mlModelId = body.mlModelId + passingGoalCount = body.passingGoalCount + projectId = body.projectId + status = body.status + statusMessage = body.statusMessage + storageUri = body.storageUri + totalGoalCount = body.totalGoalCount + trainingDatasetId = body.trainingDatasetId + validationDatasetId = body.validationDatasetId + archived = body.archived + deploymentStatus = body.deploymentStatus + links = body.links + additionalProperties = body.additionalProperties.toMutableMap() } + /** The project version (commit) id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** The project version (commit) id. */ + fun id(id: JsonField) = apply { this.id = id } + /** The details of a commit (project version). */ fun commit(commit: Commit) = commit(JsonField.of(commit)) /** The details of a commit (project version). */ fun commit(commit: JsonField) = apply { this.commit = commit } + /** The commit archive date. */ + fun dateArchived(dateArchived: OffsetDateTime?) = + dateArchived(JsonField.ofNullable(dateArchived)) + + /** The commit archive date. */ + fun dateArchived(dateArchived: Optional) = + dateArchived(dateArchived.orElse(null)) + + /** The commit archive date. */ + fun dateArchived(dateArchived: JsonField) = apply { + this.dateArchived = dateArchived + } + + /** The project version (commit) creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** The project version (commit) creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The number of tests that are failing for the commit. */ + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) + + /** The number of tests that are failing for the commit. */ + fun failingGoalCount(failingGoalCount: JsonField) = apply { + this.failingGoalCount = failingGoalCount + } + + /** The model id. */ + fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) + + /** The model id. */ + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.orElse(null)) + + /** The model id. */ + fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } + + /** The number of tests that are passing for the commit. */ + fun passingGoalCount(passingGoalCount: Long) = + passingGoalCount(JsonField.of(passingGoalCount)) + + /** The number of tests that are passing for the commit. */ + fun passingGoalCount(passingGoalCount: JsonField) = apply { + this.passingGoalCount = passingGoalCount + } + + /** The project id. */ + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + + /** The project id. */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + + /** + * The commit status. Initially, the commit is `queued`, then, it switches to `running`. + * Finally, it can be `paused`, `failed`, or `completed`. + */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * The commit status. Initially, the commit is `queued`, then, it switches to `running`. + * Finally, it can be `paused`, `failed`, or `completed`. + */ + fun status(status: JsonField) = apply { this.status = status } + + /** The commit status message. */ + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** The commit status message. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.orElse(null)) + + /** The commit status message. */ + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + /** The storage URI where the commit bundle is stored. */ fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) /** The storage URI where the commit bundle is stored. */ fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } + /** The total number of tests for the commit. */ + fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) + + /** The total number of tests for the commit. */ + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount + } + + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: String?) = + trainingDatasetId(JsonField.ofNullable(trainingDatasetId)) + + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: Optional) = + trainingDatasetId(trainingDatasetId.orElse(null)) + + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: JsonField) = apply { + this.trainingDatasetId = trainingDatasetId + } + + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: String?) = + validationDatasetId(JsonField.ofNullable(validationDatasetId)) + + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: Optional) = + validationDatasetId(validationDatasetId.orElse(null)) + + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: JsonField) = apply { + this.validationDatasetId = validationDatasetId + } + /** Whether the commit is archived. */ fun archived(archived: Boolean?) = archived(JsonField.ofNullable(archived)) @@ -202,6 +582,10 @@ private constructor( this.deploymentStatus = deploymentStatus } + fun links(links: Links) = links(JsonField.of(links)) + + fun links(links: JsonField) = apply { this.links = links } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -221,12 +605,25 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): ProjectCommitCreateBody = - ProjectCommitCreateBody( + fun build(): Body = + Body( + checkRequired("id", id), checkRequired("commit", commit), + checkRequired("dateArchived", dateArchived), + checkRequired("dateCreated", dateCreated), + checkRequired("failingGoalCount", failingGoalCount), + checkRequired("mlModelId", mlModelId), + checkRequired("passingGoalCount", passingGoalCount), + checkRequired("projectId", projectId), + checkRequired("status", status), + checkRequired("statusMessage", statusMessage), checkRequired("storageUri", storageUri), + checkRequired("totalGoalCount", totalGoalCount), + checkRequired("trainingDatasetId", trainingDatasetId), + checkRequired("validationDatasetId", validationDatasetId), archived, deploymentStatus, + links, additionalProperties.toImmutable(), ) } @@ -236,17 +633,17 @@ private constructor( return true } - return /* spotless:off */ other is ProjectCommitCreateBody && commit == other.commit && storageUri == other.storageUri && archived == other.archived && deploymentStatus == other.deploymentStatus && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && id == other.id && commit == other.commit && dateArchived == other.dateArchived && dateCreated == other.dateCreated && failingGoalCount == other.failingGoalCount && mlModelId == other.mlModelId && passingGoalCount == other.passingGoalCount && projectId == other.projectId && status == other.status && statusMessage == other.statusMessage && storageUri == other.storageUri && totalGoalCount == other.totalGoalCount && trainingDatasetId == other.trainingDatasetId && validationDatasetId == other.validationDatasetId && archived == other.archived && deploymentStatus == other.deploymentStatus && links == other.links && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(commit, storageUri, archived, deploymentStatus, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, commit, dateArchived, dateCreated, failingGoalCount, mlModelId, passingGoalCount, projectId, status, statusMessage, storageUri, totalGoalCount, trainingDatasetId, validationDatasetId, archived, deploymentStatus, links, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ProjectCommitCreateBody{commit=$commit, storageUri=$storageUri, archived=$archived, deploymentStatus=$deploymentStatus, additionalProperties=$additionalProperties}" + "Body{id=$id, commit=$commit, dateArchived=$dateArchived, dateCreated=$dateCreated, failingGoalCount=$failingGoalCount, mlModelId=$mlModelId, passingGoalCount=$passingGoalCount, projectId=$projectId, status=$status, statusMessage=$statusMessage, storageUri=$storageUri, totalGoalCount=$totalGoalCount, trainingDatasetId=$trainingDatasetId, validationDatasetId=$validationDatasetId, archived=$archived, deploymentStatus=$deploymentStatus, links=$links, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -261,7 +658,7 @@ private constructor( class Builder internal constructor() { private var projectId: String? = null - private var body: ProjectCommitCreateBody.Builder = ProjectCommitCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -275,18 +672,139 @@ private constructor( fun projectId(projectId: String) = apply { this.projectId = projectId } + /** The project version (commit) id. */ + fun id(id: String) = apply { body.id(id) } + + /** The project version (commit) id. */ + fun id(id: JsonField) = apply { body.id(id) } + /** The details of a commit (project version). */ fun commit(commit: Commit) = apply { body.commit(commit) } /** The details of a commit (project version). */ fun commit(commit: JsonField) = apply { body.commit(commit) } + /** The commit archive date. */ + fun dateArchived(dateArchived: OffsetDateTime?) = apply { body.dateArchived(dateArchived) } + + /** The commit archive date. */ + fun dateArchived(dateArchived: Optional) = + dateArchived(dateArchived.orElse(null)) + + /** The commit archive date. */ + fun dateArchived(dateArchived: JsonField) = apply { + body.dateArchived(dateArchived) + } + + /** The project version (commit) creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = apply { body.dateCreated(dateCreated) } + + /** The project version (commit) creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + body.dateCreated(dateCreated) + } + + /** The number of tests that are failing for the commit. */ + fun failingGoalCount(failingGoalCount: Long) = apply { + body.failingGoalCount(failingGoalCount) + } + + /** The number of tests that are failing for the commit. */ + fun failingGoalCount(failingGoalCount: JsonField) = apply { + body.failingGoalCount(failingGoalCount) + } + + /** The model id. */ + fun mlModelId(mlModelId: String?) = apply { body.mlModelId(mlModelId) } + + /** The model id. */ + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.orElse(null)) + + /** The model id. */ + fun mlModelId(mlModelId: JsonField) = apply { body.mlModelId(mlModelId) } + + /** The number of tests that are passing for the commit. */ + fun passingGoalCount(passingGoalCount: Long) = apply { + body.passingGoalCount(passingGoalCount) + } + + /** The number of tests that are passing for the commit. */ + fun passingGoalCount(passingGoalCount: JsonField) = apply { + body.passingGoalCount(passingGoalCount) + } + + /** The project id. */ + fun projectId(projectId: String) = apply { body.projectId(projectId) } + + /** The project id. */ + fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } + + /** + * The commit status. Initially, the commit is `queued`, then, it switches to `running`. + * Finally, it can be `paused`, `failed`, or `completed`. + */ + fun status(status: Status) = apply { body.status(status) } + + /** + * The commit status. Initially, the commit is `queued`, then, it switches to `running`. + * Finally, it can be `paused`, `failed`, or `completed`. + */ + fun status(status: JsonField) = apply { body.status(status) } + + /** The commit status message. */ + fun statusMessage(statusMessage: String?) = apply { body.statusMessage(statusMessage) } + + /** The commit status message. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.orElse(null)) + + /** The commit status message. */ + fun statusMessage(statusMessage: JsonField) = apply { + body.statusMessage(statusMessage) + } + /** The storage URI where the commit bundle is stored. */ fun storageUri(storageUri: String) = apply { body.storageUri(storageUri) } /** The storage URI where the commit bundle is stored. */ fun storageUri(storageUri: JsonField) = apply { body.storageUri(storageUri) } + /** The total number of tests for the commit. */ + fun totalGoalCount(totalGoalCount: Long) = apply { body.totalGoalCount(totalGoalCount) } + + /** The total number of tests for the commit. */ + fun totalGoalCount(totalGoalCount: JsonField) = apply { + body.totalGoalCount(totalGoalCount) + } + + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: String?) = apply { + body.trainingDatasetId(trainingDatasetId) + } + + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: Optional) = + trainingDatasetId(trainingDatasetId.orElse(null)) + + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: JsonField) = apply { + body.trainingDatasetId(trainingDatasetId) + } + + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: String?) = apply { + body.validationDatasetId(validationDatasetId) + } + + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: Optional) = + validationDatasetId(validationDatasetId.orElse(null)) + + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: JsonField) = apply { + body.validationDatasetId(validationDatasetId) + } + /** Whether the commit is archived. */ fun archived(archived: Boolean?) = apply { body.archived(archived) } @@ -310,6 +828,10 @@ private constructor( body.deploymentStatus(deploymentStatus) } + fun links(links: Links) = apply { body.links(links) } + + fun links(links: JsonField) = apply { body.links(links) } + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { body.additionalProperties(additionalBodyProperties) } @@ -801,11 +1323,7 @@ private constructor( * The commit status. Initially, the commit is `queued`, then, it switches to `running`. * Finally, it can be `paused`, `failed`, or `completed`. */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -902,7 +1420,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt index e85d9861..f8f0bbdc 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt @@ -849,11 +849,7 @@ private constructor( * The commit status. Initially, the commit is `queued`, then, it switches to `running`. * Finally, it can be `paused`, `failed`, or `completed`. */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -950,7 +946,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt index b13613d0..961a26af 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt @@ -3,6 +3,7 @@ package com.openlayer.api.models import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams @@ -17,7 +18,7 @@ private constructor( private val perPage: Long?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, -) { +) : Params { fun projectId(): String = projectId @@ -31,10 +32,9 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders + override fun _headers(): Headers = additionalHeaders - @JvmSynthetic - internal fun getQueryParams(): QueryParams { + override fun _queryParams(): QueryParams { val queryParams = QueryParams.builder() this.page?.let { queryParams.put("page", listOf(it.toString())) } this.perPage?.let { queryParams.put("perPage", listOf(it.toString())) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt index f364f8f5..5978c564 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt @@ -109,7 +109,7 @@ private constructor( fun build(): ProjectCommitListResponse = ProjectCommitListResponse( checkRequired("items", items).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -958,11 +958,7 @@ private constructor( * The commit status. Initially, the commit is `queued`, then, it switches to `running`. * Finally, it can be `paused`, `failed`, or `completed`. */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1061,7 +1057,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt index ddbb0165..0ee50423 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt @@ -12,6 +12,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams @@ -25,93 +26,311 @@ import java.util.Optional /** Create a project in your workspace. */ class ProjectCreateParams private constructor( - private val body: ProjectCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, -) { +) : Params { + + /** The project id. */ + fun id(): String = body.id() + + /** The project creator id. */ + fun creatorId(): Optional = body.creatorId() + + /** The project creation date. */ + fun dateCreated(): OffsetDateTime = body.dateCreated() + + /** The project last updated date. */ + fun dateUpdated(): OffsetDateTime = body.dateUpdated() + + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(): Long = body.developmentGoalCount() + + /** The total number of tests in the project. */ + fun goalCount(): Long = body.goalCount() + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(): Long = body.inferencePipelineCount() + + /** Links to the project. */ + fun links(): Links = body.links() + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(): Long = body.monitoringGoalCount() /** The project name. */ fun name(): String = body.name() + /** The source of the project. */ + fun source(): Optional = body.source() + /** The task type of the project. */ fun taskType(): TaskType = body.taskType() + /** The number of versions (commits) in the project. */ + fun versionCount(): Long = body.versionCount() + + /** The workspace id. */ + fun workspaceId(): Optional = body.workspaceId() + /** The project description. */ fun description(): Optional = body.description() + fun gitRepo(): Optional = body.gitRepo() + + /** The project id. */ + fun _id(): JsonField = body._id() + + /** The project creator id. */ + fun _creatorId(): JsonField = body._creatorId() + + /** The project creation date. */ + fun _dateCreated(): JsonField = body._dateCreated() + + /** The project last updated date. */ + fun _dateUpdated(): JsonField = body._dateUpdated() + + /** The number of tests in the development mode of the project. */ + fun _developmentGoalCount(): JsonField = body._developmentGoalCount() + + /** The total number of tests in the project. */ + fun _goalCount(): JsonField = body._goalCount() + + /** The number of inference pipelines in the project. */ + fun _inferencePipelineCount(): JsonField = body._inferencePipelineCount() + + /** Links to the project. */ + fun _links(): JsonField = body._links() + + /** The number of tests in the monitoring mode of the project. */ + fun _monitoringGoalCount(): JsonField = body._monitoringGoalCount() + /** The project name. */ fun _name(): JsonField = body._name() + /** The source of the project. */ + fun _source(): JsonField = body._source() + /** The task type of the project. */ fun _taskType(): JsonField = body._taskType() + /** The number of versions (commits) in the project. */ + fun _versionCount(): JsonField = body._versionCount() + + /** The workspace id. */ + fun _workspaceId(): JsonField = body._workspaceId() + /** The project description. */ fun _description(): JsonField = body._description() + fun _gitRepo(): JsonField = body._gitRepo() + fun _additionalBodyProperties(): Map = body._additionalProperties() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun getBody(): ProjectCreateBody = body + @JvmSynthetic internal fun _body(): Body = body - @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders + override fun _headers(): Headers = additionalHeaders - @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams + override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class ProjectCreateBody + class Body @JsonCreator - internal constructor( + private constructor( + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + private val creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("developmentGoalCount") + @ExcludeMissing + private val developmentGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("goalCount") + @ExcludeMissing + private val goalCount: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + private val inferencePipelineCount: JsonField = JsonMissing.of(), + @JsonProperty("links") + @ExcludeMissing + private val links: JsonField = JsonMissing.of(), + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + private val monitoringGoalCount: JsonField = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), + @JsonProperty("source") + @ExcludeMissing + private val source: JsonField = JsonMissing.of(), @JsonProperty("taskType") @ExcludeMissing private val taskType: JsonField = JsonMissing.of(), + @JsonProperty("versionCount") + @ExcludeMissing + private val versionCount: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + private val workspaceId: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), + @JsonProperty("gitRepo") + @ExcludeMissing + private val gitRepo: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** The project id. */ + fun id(): String = id.getRequired("id") + + /** The project creator id. */ + fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + + /** The project creation date. */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** The project last updated date. */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") + + /** The total number of tests in the project. */ + fun goalCount(): Long = goalCount.getRequired("goalCount") + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(): Long = + inferencePipelineCount.getRequired("inferencePipelineCount") + + /** Links to the project. */ + fun links(): Links = links.getRequired("links") + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") + /** The project name. */ fun name(): String = name.getRequired("name") + /** The source of the project. */ + fun source(): Optional = Optional.ofNullable(source.getNullable("source")) + /** The task type of the project. */ fun taskType(): TaskType = taskType.getRequired("taskType") + /** The number of versions (commits) in the project. */ + fun versionCount(): Long = versionCount.getRequired("versionCount") + + /** The workspace id. */ + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) + /** The project description. */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) + + /** The project id. */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** The project creator id. */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId + + /** The project creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** The project last updated date. */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** The number of tests in the development mode of the project. */ + @JsonProperty("developmentGoalCount") + @ExcludeMissing + fun _developmentGoalCount(): JsonField = developmentGoalCount + + /** The total number of tests in the project. */ + @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount + + /** The number of inference pipelines in the project. */ + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + fun _inferencePipelineCount(): JsonField = inferencePipelineCount + + /** Links to the project. */ + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links + + /** The number of tests in the monitoring mode of the project. */ + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + fun _monitoringGoalCount(): JsonField = monitoringGoalCount + /** The project name. */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** The source of the project. */ + @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source + /** The task type of the project. */ @JsonProperty("taskType") @ExcludeMissing fun _taskType(): JsonField = taskType + /** The number of versions (commits) in the project. */ + @JsonProperty("versionCount") + @ExcludeMissing + fun _versionCount(): JsonField = versionCount + + /** The workspace id. */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + /** The project description. */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): ProjectCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } + id() + creatorId() + dateCreated() + dateUpdated() + developmentGoalCount() + goalCount() + inferencePipelineCount() + links().validate() + monitoringGoalCount() name() + source() taskType() + versionCount() + workspaceId() description() + gitRepo().ifPresent { it.validate() } validated = true } @@ -122,20 +341,116 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ProjectCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var developmentGoalCount: JsonField? = null + private var goalCount: JsonField? = null + private var inferencePipelineCount: JsonField? = null + private var links: JsonField? = null + private var monitoringGoalCount: JsonField? = null private var name: JsonField? = null + private var source: JsonField? = null private var taskType: JsonField? = null + private var versionCount: JsonField? = null + private var workspaceId: JsonField? = null private var description: JsonField = JsonMissing.of() + private var gitRepo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(projectCreateBody: ProjectCreateBody) = apply { - name = projectCreateBody.name - taskType = projectCreateBody.taskType - description = projectCreateBody.description - additionalProperties = projectCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + id = body.id + creatorId = body.creatorId + dateCreated = body.dateCreated + dateUpdated = body.dateUpdated + developmentGoalCount = body.developmentGoalCount + goalCount = body.goalCount + inferencePipelineCount = body.inferencePipelineCount + links = body.links + monitoringGoalCount = body.monitoringGoalCount + name = body.name + source = body.source + taskType = body.taskType + versionCount = body.versionCount + workspaceId = body.workspaceId + description = body.description + gitRepo = body.gitRepo + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The project id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** The project id. */ + fun id(id: JsonField) = apply { this.id = id } + + /** The project creator id. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** The project creator id. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + + /** The project creator id. */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The project creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** The project creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The project last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** The project last updated date. */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: Long) = + developmentGoalCount(JsonField.of(developmentGoalCount)) + + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: JsonField) = apply { + this.developmentGoalCount = developmentGoalCount + } + + /** The total number of tests in the project. */ + fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) + + /** The total number of tests in the project. */ + fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(inferencePipelineCount: Long) = + inferencePipelineCount(JsonField.of(inferencePipelineCount)) + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { + this.inferencePipelineCount = inferencePipelineCount + } + + /** Links to the project. */ + fun links(links: Links) = links(JsonField.of(links)) + + /** Links to the project. */ + fun links(links: JsonField) = apply { this.links = links } + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(monitoringGoalCount: Long) = + monitoringGoalCount(JsonField.of(monitoringGoalCount)) + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { + this.monitoringGoalCount = monitoringGoalCount } /** The project name. */ @@ -144,12 +459,40 @@ private constructor( /** The project name. */ fun name(name: JsonField) = apply { this.name = name } + /** The source of the project. */ + fun source(source: Source?) = source(JsonField.ofNullable(source)) + + /** The source of the project. */ + fun source(source: Optional) = source(source.orElse(null)) + + /** The source of the project. */ + fun source(source: JsonField) = apply { this.source = source } + /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) /** The task type of the project. */ fun taskType(taskType: JsonField) = apply { this.taskType = taskType } + /** The number of versions (commits) in the project. */ + fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) + + /** The number of versions (commits) in the project. */ + fun versionCount(versionCount: JsonField) = apply { + this.versionCount = versionCount + } + + /** The workspace id. */ + fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) + + /** The workspace id. */ + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.orElse(null)) + + /** The workspace id. */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + /** The project description. */ fun description(description: String?) = description(JsonField.ofNullable(description)) @@ -161,6 +504,12 @@ private constructor( this.description = description } + fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) + + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.orElse(null)) + + fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -180,11 +529,24 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): ProjectCreateBody = - ProjectCreateBody( + fun build(): Body = + Body( + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("developmentGoalCount", developmentGoalCount), + checkRequired("goalCount", goalCount), + checkRequired("inferencePipelineCount", inferencePipelineCount), + checkRequired("links", links), + checkRequired("monitoringGoalCount", monitoringGoalCount), checkRequired("name", name), + checkRequired("source", source), checkRequired("taskType", taskType), + checkRequired("versionCount", versionCount), + checkRequired("workspaceId", workspaceId), description, + gitRepo, additionalProperties.toImmutable(), ) } @@ -194,17 +556,17 @@ private constructor( return true } - return /* spotless:off */ other is ProjectCreateBody && name == other.name && taskType == other.taskType && description == other.description && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && id == other.id && creatorId == other.creatorId && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && developmentGoalCount == other.developmentGoalCount && goalCount == other.goalCount && inferencePipelineCount == other.inferencePipelineCount && links == other.links && monitoringGoalCount == other.monitoringGoalCount && name == other.name && source == other.source && taskType == other.taskType && versionCount == other.versionCount && workspaceId == other.workspaceId && description == other.description && gitRepo == other.gitRepo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(name, taskType, description, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, creatorId, dateCreated, dateUpdated, developmentGoalCount, goalCount, inferencePipelineCount, links, monitoringGoalCount, name, source, taskType, versionCount, workspaceId, description, gitRepo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ProjectCreateBody{name=$name, taskType=$taskType, description=$description, additionalProperties=$additionalProperties}" + "Body{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, developmentGoalCount=$developmentGoalCount, goalCount=$goalCount, inferencePipelineCount=$inferencePipelineCount, links=$links, monitoringGoalCount=$monitoringGoalCount, name=$name, source=$source, taskType=$taskType, versionCount=$versionCount, workspaceId=$workspaceId, description=$description, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -218,7 +580,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: ProjectCreateBody.Builder = ProjectCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -229,18 +591,115 @@ private constructor( additionalQueryParams = projectCreateParams.additionalQueryParams.toBuilder() } + /** The project id. */ + fun id(id: String) = apply { body.id(id) } + + /** The project id. */ + fun id(id: JsonField) = apply { body.id(id) } + + /** The project creator id. */ + fun creatorId(creatorId: String?) = apply { body.creatorId(creatorId) } + + /** The project creator id. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + + /** The project creator id. */ + fun creatorId(creatorId: JsonField) = apply { body.creatorId(creatorId) } + + /** The project creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = apply { body.dateCreated(dateCreated) } + + /** The project creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + body.dateCreated(dateCreated) + } + + /** The project last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = apply { body.dateUpdated(dateUpdated) } + + /** The project last updated date. */ + fun dateUpdated(dateUpdated: JsonField) = apply { + body.dateUpdated(dateUpdated) + } + + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: Long) = apply { + body.developmentGoalCount(developmentGoalCount) + } + + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: JsonField) = apply { + body.developmentGoalCount(developmentGoalCount) + } + + /** The total number of tests in the project. */ + fun goalCount(goalCount: Long) = apply { body.goalCount(goalCount) } + + /** The total number of tests in the project. */ + fun goalCount(goalCount: JsonField) = apply { body.goalCount(goalCount) } + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(inferencePipelineCount: Long) = apply { + body.inferencePipelineCount(inferencePipelineCount) + } + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { + body.inferencePipelineCount(inferencePipelineCount) + } + + /** Links to the project. */ + fun links(links: Links) = apply { body.links(links) } + + /** Links to the project. */ + fun links(links: JsonField) = apply { body.links(links) } + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(monitoringGoalCount: Long) = apply { + body.monitoringGoalCount(monitoringGoalCount) + } + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { + body.monitoringGoalCount(monitoringGoalCount) + } + /** The project name. */ fun name(name: String) = apply { body.name(name) } /** The project name. */ fun name(name: JsonField) = apply { body.name(name) } + /** The source of the project. */ + fun source(source: Source?) = apply { body.source(source) } + + /** The source of the project. */ + fun source(source: Optional) = source(source.orElse(null)) + + /** The source of the project. */ + fun source(source: JsonField) = apply { body.source(source) } + /** The task type of the project. */ fun taskType(taskType: TaskType) = apply { body.taskType(taskType) } /** The task type of the project. */ fun taskType(taskType: JsonField) = apply { body.taskType(taskType) } + /** The number of versions (commits) in the project. */ + fun versionCount(versionCount: Long) = apply { body.versionCount(versionCount) } + + /** The number of versions (commits) in the project. */ + fun versionCount(versionCount: JsonField) = apply { body.versionCount(versionCount) } + + /** The workspace id. */ + fun workspaceId(workspaceId: String?) = apply { body.workspaceId(workspaceId) } + + /** The workspace id. */ + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.orElse(null)) + + /** The workspace id. */ + fun workspaceId(workspaceId: JsonField) = apply { body.workspaceId(workspaceId) } + /** The project description. */ fun description(description: String?) = apply { body.description(description) } @@ -250,6 +709,12 @@ private constructor( /** The project description. */ fun description(description: JsonField) = apply { body.description(description) } + fun gitRepo(gitRepo: GitRepo?) = apply { body.gitRepo(gitRepo) } + + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.orElse(null)) + + fun gitRepo(gitRepo: JsonField) = apply { body.gitRepo(gitRepo) } + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { body.additionalProperties(additionalBodyProperties) } @@ -468,11 +933,7 @@ private constructor( } /** The source of the project. */ - class Source - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Source @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -551,7 +1012,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Source: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -567,11 +1040,7 @@ private constructor( } /** The task type of the project. */ - class TaskType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class TaskType @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -656,7 +1125,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt index f9ac7b4c..eaab4433 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt @@ -512,11 +512,7 @@ private constructor( } /** The source of the project. */ - class Source - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Source @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -595,7 +591,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Source: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -611,11 +619,7 @@ private constructor( } /** The task type of the project. */ - class TaskType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class TaskType @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -700,7 +704,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt index 1951a5a9..85ba855a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt @@ -12,6 +12,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams @@ -27,44 +28,126 @@ import java.util.Optional class ProjectInferencePipelineCreateParams private constructor( private val projectId: String, - private val body: ProjectInferencePipelineCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, -) { +) : Params { fun projectId(): String = projectId + /** The inference pipeline id. */ + fun id(): String = body.id() + + /** The creation date. */ + fun dateCreated(): OffsetDateTime = body.dateCreated() + + /** The last test evaluation date. */ + fun dateLastEvaluated(): Optional = body.dateLastEvaluated() + + /** The last data sample received date. */ + fun dateLastSampleReceived(): Optional = body.dateLastSampleReceived() + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(): Optional = body.dateOfNextEvaluation() + + /** The last updated date. */ + fun dateUpdated(): OffsetDateTime = body.dateUpdated() + /** The inference pipeline description. */ fun description(): Optional = body.description() + /** The number of tests failing. */ + fun failingGoalCount(): Long = body.failingGoalCount() + + fun links(): Links = body.links() + /** The inference pipeline name. */ fun name(): String = body.name() + /** The number of tests passing. */ + fun passingGoalCount(): Long = body.passingGoalCount() + + /** The project id. */ + fun projectId(): String = body.projectId() + + /** The status of test evaluation for the inference pipeline. */ + fun status(): Status = body.status() + + /** The status message of test evaluation for the inference pipeline. */ + fun statusMessage(): Optional = body.statusMessage() + + /** The total number of tests. */ + fun totalGoalCount(): Long = body.totalGoalCount() + fun project(): Optional = body.project() fun workspace(): Optional = body.workspace() + /** The workspace id. */ + fun workspaceId(): Optional = body.workspaceId() + + /** The inference pipeline id. */ + fun _id(): JsonField = body._id() + + /** The creation date. */ + fun _dateCreated(): JsonField = body._dateCreated() + + /** The last test evaluation date. */ + fun _dateLastEvaluated(): JsonField = body._dateLastEvaluated() + + /** The last data sample received date. */ + fun _dateLastSampleReceived(): JsonField = body._dateLastSampleReceived() + + /** The next test evaluation date. */ + fun _dateOfNextEvaluation(): JsonField = body._dateOfNextEvaluation() + + /** The last updated date. */ + fun _dateUpdated(): JsonField = body._dateUpdated() + /** The inference pipeline description. */ fun _description(): JsonField = body._description() + /** The number of tests failing. */ + fun _failingGoalCount(): JsonField = body._failingGoalCount() + + fun _links(): JsonField = body._links() + /** The inference pipeline name. */ fun _name(): JsonField = body._name() + /** The number of tests passing. */ + fun _passingGoalCount(): JsonField = body._passingGoalCount() + + /** The project id. */ + fun _projectId(): JsonField = body._projectId() + + /** The status of test evaluation for the inference pipeline. */ + fun _status(): JsonField = body._status() + + /** The status message of test evaluation for the inference pipeline. */ + fun _statusMessage(): JsonField = body._statusMessage() + + /** The total number of tests. */ + fun _totalGoalCount(): JsonField = body._totalGoalCount() + fun _project(): JsonField = body._project() fun _workspace(): JsonField = body._workspace() + /** The workspace id. */ + fun _workspaceId(): JsonField = body._workspaceId() + fun _additionalBodyProperties(): Map = body._additionalProperties() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun getBody(): ProjectInferencePipelineCreateBody = body + @JvmSynthetic internal fun _body(): Body = body - @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders + override fun _headers(): Headers = additionalHeaders - @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams + override fun _queryParams(): QueryParams = additionalQueryParams fun getPathParam(index: Int): String { return when (index) { @@ -74,66 +157,227 @@ private constructor( } @NoAutoDetect - class ProjectInferencePipelineCreateBody + class Body @JsonCreator - internal constructor( + private constructor( + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + private val dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastSampleReceived") + @ExcludeMissing + private val dateLastSampleReceived: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + private val dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + private val dateUpdated: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), + @JsonProperty("failingGoalCount") + @ExcludeMissing + private val failingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("links") + @ExcludeMissing + private val links: JsonField = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), + @JsonProperty("passingGoalCount") + @ExcludeMissing + private val passingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + private val projectId: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + private val statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("totalGoalCount") + @ExcludeMissing + private val totalGoalCount: JsonField = JsonMissing.of(), @JsonProperty("project") @ExcludeMissing private val project: JsonField = JsonMissing.of(), @JsonProperty("workspace") @ExcludeMissing private val workspace: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + private val workspaceId: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** The inference pipeline id. */ + fun id(): String = id.getRequired("id") + + /** The creation date. */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** The last test evaluation date. */ + fun dateLastEvaluated(): Optional = + Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + + /** The last data sample received date. */ + fun dateLastSampleReceived(): Optional = + Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(): Optional = + Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + + /** The last updated date. */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** The inference pipeline description. */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + /** The number of tests failing. */ + fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") + + fun links(): Links = links.getRequired("links") + /** The inference pipeline name. */ fun name(): String = name.getRequired("name") + /** The number of tests passing. */ + fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") + + /** The project id. */ + fun projectId(): String = projectId.getRequired("projectId") + + /** The status of test evaluation for the inference pipeline. */ + fun status(): Status = status.getRequired("status") + + /** The status message of test evaluation for the inference pipeline. */ + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) + + /** The total number of tests. */ + fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") + fun project(): Optional = Optional.ofNullable(project.getNullable("project")) fun workspace(): Optional = Optional.ofNullable(workspace.getNullable("workspace")) + /** The workspace id. */ + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) + + /** The inference pipeline id. */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** The creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** The last test evaluation date. */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun _dateLastEvaluated(): JsonField = dateLastEvaluated + + /** The last data sample received date. */ + @JsonProperty("dateLastSampleReceived") + @ExcludeMissing + fun _dateLastSampleReceived(): JsonField = dateLastSampleReceived + + /** The next test evaluation date. */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation + + /** The last updated date. */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + /** The inference pipeline description. */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + /** The number of tests failing. */ + @JsonProperty("failingGoalCount") + @ExcludeMissing + fun _failingGoalCount(): JsonField = failingGoalCount + + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links + /** The inference pipeline name. */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** The number of tests passing. */ + @JsonProperty("passingGoalCount") + @ExcludeMissing + fun _passingGoalCount(): JsonField = passingGoalCount + + /** The project id. */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + + /** The status of test evaluation for the inference pipeline. */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** The status message of test evaluation for the inference pipeline. */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + + /** The total number of tests. */ + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun _totalGoalCount(): JsonField = totalGoalCount + @JsonProperty("project") @ExcludeMissing fun _project(): JsonField = project @JsonProperty("workspace") @ExcludeMissing fun _workspace(): JsonField = workspace + /** The workspace id. */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): ProjectInferencePipelineCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } + id() + dateCreated() + dateLastEvaluated() + dateLastSampleReceived() + dateOfNextEvaluation() + dateUpdated() description() + failingGoalCount() + links().validate() name() + passingGoalCount() + projectId() + status() + statusMessage() + totalGoalCount() project().ifPresent { it.validate() } workspace().ifPresent { it.validate() } + workspaceId() validated = true } @@ -144,25 +388,111 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ProjectInferencePipelineCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateLastEvaluated: JsonField? = null + private var dateLastSampleReceived: JsonField? = null + private var dateOfNextEvaluation: JsonField? = null + private var dateUpdated: JsonField? = null private var description: JsonField? = null + private var failingGoalCount: JsonField? = null + private var links: JsonField? = null private var name: JsonField? = null + private var passingGoalCount: JsonField? = null + private var projectId: JsonField? = null + private var status: JsonField? = null + private var statusMessage: JsonField? = null + private var totalGoalCount: JsonField? = null private var project: JsonField = JsonMissing.of() private var workspace: JsonField = JsonMissing.of() + private var workspaceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - projectInferencePipelineCreateBody: ProjectInferencePipelineCreateBody - ) = apply { - description = projectInferencePipelineCreateBody.description - name = projectInferencePipelineCreateBody.name - project = projectInferencePipelineCreateBody.project - workspace = projectInferencePipelineCreateBody.workspace - additionalProperties = - projectInferencePipelineCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + id = body.id + dateCreated = body.dateCreated + dateLastEvaluated = body.dateLastEvaluated + dateLastSampleReceived = body.dateLastSampleReceived + dateOfNextEvaluation = body.dateOfNextEvaluation + dateUpdated = body.dateUpdated + description = body.description + failingGoalCount = body.failingGoalCount + links = body.links + name = body.name + passingGoalCount = body.passingGoalCount + projectId = body.projectId + status = body.status + statusMessage = body.statusMessage + totalGoalCount = body.totalGoalCount + project = body.project + workspace = body.workspace + workspaceId = body.workspaceId + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The inference pipeline id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** The inference pipeline id. */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** The creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = + dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) + + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: Optional) = + dateLastEvaluated(dateLastEvaluated.orElse(null)) + + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime?) = + dateLastSampleReceived(JsonField.ofNullable(dateLastSampleReceived)) + + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: Optional) = + dateLastSampleReceived(dateLastSampleReceived.orElse(null)) + + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { + this.dateLastSampleReceived = dateLastSampleReceived + } + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = + dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = + dateOfNextEvaluation(dateOfNextEvaluation.orElse(null)) + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** The last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** The last updated date. */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated } /** The inference pipeline description. */ @@ -176,12 +506,67 @@ private constructor( this.description = description } + /** The number of tests failing. */ + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) + + /** The number of tests failing. */ + fun failingGoalCount(failingGoalCount: JsonField) = apply { + this.failingGoalCount = failingGoalCount + } + + fun links(links: Links) = links(JsonField.of(links)) + + fun links(links: JsonField) = apply { this.links = links } + /** The inference pipeline name. */ fun name(name: String) = name(JsonField.of(name)) /** The inference pipeline name. */ fun name(name: JsonField) = apply { this.name = name } + /** The number of tests passing. */ + fun passingGoalCount(passingGoalCount: Long) = + passingGoalCount(JsonField.of(passingGoalCount)) + + /** The number of tests passing. */ + fun passingGoalCount(passingGoalCount: JsonField) = apply { + this.passingGoalCount = passingGoalCount + } + + /** The project id. */ + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + + /** The project id. */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + + /** The status of test evaluation for the inference pipeline. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** The status of test evaluation for the inference pipeline. */ + fun status(status: JsonField) = apply { this.status = status } + + /** The status message of test evaluation for the inference pipeline. */ + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** The status message of test evaluation for the inference pipeline. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.orElse(null)) + + /** The status message of test evaluation for the inference pipeline. */ + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + /** The total number of tests. */ + fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) + + /** The total number of tests. */ + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount + } + fun project(project: Project?) = project(JsonField.ofNullable(project)) fun project(project: Optional) = project(project.orElse(null)) @@ -194,6 +579,14 @@ private constructor( fun workspace(workspace: JsonField) = apply { this.workspace = workspace } + /** The workspace id. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** The workspace id. */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -213,12 +606,26 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): ProjectInferencePipelineCreateBody = - ProjectInferencePipelineCreateBody( + fun build(): Body = + Body( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateLastEvaluated", dateLastEvaluated), + checkRequired("dateLastSampleReceived", dateLastSampleReceived), + checkRequired("dateOfNextEvaluation", dateOfNextEvaluation), + checkRequired("dateUpdated", dateUpdated), checkRequired("description", description), + checkRequired("failingGoalCount", failingGoalCount), + checkRequired("links", links), checkRequired("name", name), + checkRequired("passingGoalCount", passingGoalCount), + checkRequired("projectId", projectId), + checkRequired("status", status), + checkRequired("statusMessage", statusMessage), + checkRequired("totalGoalCount", totalGoalCount), project, workspace, + workspaceId, additionalProperties.toImmutable(), ) } @@ -228,17 +635,17 @@ private constructor( return true } - return /* spotless:off */ other is ProjectInferencePipelineCreateBody && description == other.description && name == other.name && project == other.project && workspace == other.workspace && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && id == other.id && dateCreated == other.dateCreated && dateLastEvaluated == other.dateLastEvaluated && dateLastSampleReceived == other.dateLastSampleReceived && dateOfNextEvaluation == other.dateOfNextEvaluation && dateUpdated == other.dateUpdated && description == other.description && failingGoalCount == other.failingGoalCount && links == other.links && name == other.name && passingGoalCount == other.passingGoalCount && projectId == other.projectId && status == other.status && statusMessage == other.statusMessage && totalGoalCount == other.totalGoalCount && project == other.project && workspace == other.workspace && workspaceId == other.workspaceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(description, name, project, workspace, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dateCreated, dateLastEvaluated, dateLastSampleReceived, dateOfNextEvaluation, dateUpdated, description, failingGoalCount, links, name, passingGoalCount, projectId, status, statusMessage, totalGoalCount, project, workspace, workspaceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ProjectInferencePipelineCreateBody{description=$description, name=$name, project=$project, workspace=$workspace, additionalProperties=$additionalProperties}" + "Body{id=$id, dateCreated=$dateCreated, dateLastEvaluated=$dateLastEvaluated, dateLastSampleReceived=$dateLastSampleReceived, dateOfNextEvaluation=$dateOfNextEvaluation, dateUpdated=$dateUpdated, description=$description, failingGoalCount=$failingGoalCount, links=$links, name=$name, passingGoalCount=$passingGoalCount, projectId=$projectId, status=$status, statusMessage=$statusMessage, totalGoalCount=$totalGoalCount, project=$project, workspace=$workspace, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -253,8 +660,7 @@ private constructor( class Builder internal constructor() { private var projectId: String? = null - private var body: ProjectInferencePipelineCreateBody.Builder = - ProjectInferencePipelineCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -271,6 +677,70 @@ private constructor( fun projectId(projectId: String) = apply { this.projectId = projectId } + /** The inference pipeline id. */ + fun id(id: String) = apply { body.id(id) } + + /** The inference pipeline id. */ + fun id(id: JsonField) = apply { body.id(id) } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = apply { body.dateCreated(dateCreated) } + + /** The creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + body.dateCreated(dateCreated) + } + + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = apply { + body.dateLastEvaluated(dateLastEvaluated) + } + + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: Optional) = + dateLastEvaluated(dateLastEvaluated.orElse(null)) + + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + body.dateLastEvaluated(dateLastEvaluated) + } + + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime?) = apply { + body.dateLastSampleReceived(dateLastSampleReceived) + } + + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: Optional) = + dateLastSampleReceived(dateLastSampleReceived.orElse(null)) + + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { + body.dateLastSampleReceived(dateLastSampleReceived) + } + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = apply { + body.dateOfNextEvaluation(dateOfNextEvaluation) + } + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = + dateOfNextEvaluation(dateOfNextEvaluation.orElse(null)) + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + body.dateOfNextEvaluation(dateOfNextEvaluation) + } + + /** The last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = apply { body.dateUpdated(dateUpdated) } + + /** The last updated date. */ + fun dateUpdated(dateUpdated: JsonField) = apply { + body.dateUpdated(dateUpdated) + } + /** The inference pipeline description. */ fun description(description: String?) = apply { body.description(description) } @@ -280,12 +750,68 @@ private constructor( /** The inference pipeline description. */ fun description(description: JsonField) = apply { body.description(description) } + /** The number of tests failing. */ + fun failingGoalCount(failingGoalCount: Long) = apply { + body.failingGoalCount(failingGoalCount) + } + + /** The number of tests failing. */ + fun failingGoalCount(failingGoalCount: JsonField) = apply { + body.failingGoalCount(failingGoalCount) + } + + fun links(links: Links) = apply { body.links(links) } + + fun links(links: JsonField) = apply { body.links(links) } + /** The inference pipeline name. */ fun name(name: String) = apply { body.name(name) } /** The inference pipeline name. */ fun name(name: JsonField) = apply { body.name(name) } + /** The number of tests passing. */ + fun passingGoalCount(passingGoalCount: Long) = apply { + body.passingGoalCount(passingGoalCount) + } + + /** The number of tests passing. */ + fun passingGoalCount(passingGoalCount: JsonField) = apply { + body.passingGoalCount(passingGoalCount) + } + + /** The project id. */ + fun projectId(projectId: String) = apply { body.projectId(projectId) } + + /** The project id. */ + fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } + + /** The status of test evaluation for the inference pipeline. */ + fun status(status: Status) = apply { body.status(status) } + + /** The status of test evaluation for the inference pipeline. */ + fun status(status: JsonField) = apply { body.status(status) } + + /** The status message of test evaluation for the inference pipeline. */ + fun statusMessage(statusMessage: String?) = apply { body.statusMessage(statusMessage) } + + /** The status message of test evaluation for the inference pipeline. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.orElse(null)) + + /** The status message of test evaluation for the inference pipeline. */ + fun statusMessage(statusMessage: JsonField) = apply { + body.statusMessage(statusMessage) + } + + /** The total number of tests. */ + fun totalGoalCount(totalGoalCount: Long) = apply { body.totalGoalCount(totalGoalCount) } + + /** The total number of tests. */ + fun totalGoalCount(totalGoalCount: JsonField) = apply { + body.totalGoalCount(totalGoalCount) + } + fun project(project: Project?) = apply { body.project(project) } fun project(project: Optional) = project(project.orElse(null)) @@ -298,6 +824,12 @@ private constructor( fun workspace(workspace: JsonField) = apply { body.workspace(workspace) } + /** The workspace id. */ + fun workspaceId(workspaceId: String) = apply { body.workspaceId(workspaceId) } + + /** The workspace id. */ + fun workspaceId(workspaceId: JsonField) = apply { body.workspaceId(workspaceId) } + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { body.additionalProperties(additionalBodyProperties) } @@ -516,11 +1048,7 @@ private constructor( } /** The status of test evaluation for the inference pipeline. */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -617,7 +1145,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1144,11 +1684,7 @@ private constructor( } /** The source of the project. */ - class Source - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Source @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1229,7 +1765,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Source: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1245,11 +1793,8 @@ private constructor( } /** The task type of the project. */ - class TaskType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class TaskType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1336,7 +1881,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -2090,11 +2647,7 @@ private constructor( ) } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2205,7 +2758,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt index b0f56fd0..e20176c6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt @@ -574,11 +574,7 @@ private constructor( } /** The status of test evaluation for the inference pipeline. */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -675,7 +671,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1202,11 +1210,7 @@ private constructor( } /** The source of the project. */ - class Source - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Source @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1287,7 +1291,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Source: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1303,11 +1319,8 @@ private constructor( } /** The task type of the project. */ - class TaskType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class TaskType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1394,7 +1407,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -2148,11 +2173,7 @@ private constructor( ) } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2263,7 +2284,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt index a7fba728..60f7d394 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt @@ -3,6 +3,7 @@ package com.openlayer.api.models import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams @@ -18,7 +19,7 @@ private constructor( private val perPage: Long?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, -) { +) : Params { fun projectId(): String = projectId @@ -35,10 +36,9 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders + override fun _headers(): Headers = additionalHeaders - @JvmSynthetic - internal fun getQueryParams(): QueryParams { + override fun _queryParams(): QueryParams { val queryParams = QueryParams.builder() this.name?.let { queryParams.put("name", listOf(it.toString())) } this.page?.let { queryParams.put("page", listOf(it.toString())) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt index 3d105201..2e730349 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt @@ -113,7 +113,7 @@ private constructor( fun build(): ProjectInferencePipelineListResponse = ProjectInferencePipelineListResponse( checkRequired("items", items).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -688,11 +688,7 @@ private constructor( } /** The status of test evaluation for the inference pipeline. */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -791,7 +787,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1336,11 +1344,8 @@ private constructor( } /** The source of the project. */ - class Source - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Source @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1422,7 +1427,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Source: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1438,11 +1455,8 @@ private constructor( } /** The task type of the project. */ - class TaskType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class TaskType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1530,7 +1544,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -2306,11 +2332,8 @@ private constructor( ) } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2422,7 +2445,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt index 2efc37a4..6b02639d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonCreator import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Params import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams import com.openlayer.api.errors.OpenlayerInvalidDataException @@ -21,7 +22,7 @@ private constructor( private val taskType: TaskType?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, -) { +) : Params { /** Filter list of items by project name. */ fun name(): Optional = Optional.ofNullable(name) @@ -39,10 +40,9 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders + override fun _headers(): Headers = additionalHeaders - @JvmSynthetic - internal fun getQueryParams(): QueryParams { + override fun _queryParams(): QueryParams { val queryParams = QueryParams.builder() this.name?.let { queryParams.put("name", listOf(it.toString())) } this.page?.let { queryParams.put("page", listOf(it.toString())) } @@ -56,6 +56,8 @@ private constructor( companion object { + @JvmStatic fun none(): ProjectListParams = builder().build() + @JvmStatic fun builder() = Builder() } @@ -222,11 +224,7 @@ private constructor( } /** Filter list of items by task type. */ - class TaskType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class TaskType @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -311,7 +309,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt index 9b858e55..e3c4d5f7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt @@ -109,7 +109,7 @@ private constructor( fun build(): ProjectListResponse = ProjectListResponse( checkRequired("items", items).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -625,11 +625,7 @@ private constructor( } /** The source of the project. */ - class Source - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Source @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -710,7 +706,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown Source: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -726,11 +734,8 @@ private constructor( } /** The task type of the project. */ - class TaskType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class TaskType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -817,7 +822,19 @@ private constructor( else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt index 56d6be1e..865a266e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt @@ -4,6 +4,7 @@ package com.openlayer.api.models import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams @@ -18,7 +19,7 @@ private constructor( private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, -) { +) : Params { /** The name of the object. */ fun objectName(): String = objectName @@ -30,13 +31,12 @@ private constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties @JvmSynthetic - internal fun getBody(): Optional> = + internal fun _body(): Optional> = Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders + override fun _headers(): Headers = additionalHeaders - @JvmSynthetic - internal fun getQueryParams(): QueryParams { + override fun _queryParams(): QueryParams { val queryParams = QueryParams.builder() this.objectName.let { queryParams.put("objectName", listOf(it.toString())) } queryParams.putAll(additionalQueryParams) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt index 3d3f2df6..e2da7f51 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt @@ -6,10 +6,8 @@ import com.openlayer.api.core.ClientOptions import com.openlayer.api.services.async.commits.TestResultServiceAsync import com.openlayer.api.services.async.commits.TestResultServiceAsyncImpl -class CommitServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : CommitServiceAsync { +class CommitServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + CommitServiceAsync { private val testResults: TestResultServiceAsync by lazy { TestResultServiceAsyncImpl(clientOptions) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt index 84e6d9ab..bac0f357 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt @@ -27,20 +27,20 @@ interface InferencePipelineServiceAsync { @JvmOverloads fun retrieve( params: InferencePipelineRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Update inference pipeline. */ @JvmOverloads fun update( params: InferencePipelineUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Delete inference pipeline. */ @JvmOverloads fun delete( params: InferencePipelineDeleteParams, - requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt index 5aa1e5c0..4a862369 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt @@ -12,6 +12,7 @@ import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.json +import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineDeleteParams import com.openlayer.api.models.InferencePipelineRetrieveParams @@ -27,9 +28,7 @@ import com.openlayer.api.services.async.inferencePipelines.TestResultServiceAsyn import java.util.concurrent.CompletableFuture class InferencePipelineServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : InferencePipelineServiceAsync { +internal constructor(private val clientOptions: ClientOptions) : InferencePipelineServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -54,27 +53,25 @@ internal constructor( /** Retrieve inference pipeline. */ override fun retrieve( params: InferencePipelineRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("inference-pipelines", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { retrieveHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() + .prepareAsync(clientOptions, params) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() + } } - } - } + } } private val updateHandler: Handler = @@ -84,28 +81,26 @@ internal constructor( /** Update inference pipeline. */ override fun update( params: InferencePipelineUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("inference-pipelines", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) + .body(json(clientOptions.jsonMapper, params._body())) .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { updateHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() + .prepareAsync(clientOptions, params) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() + } } - } - } + } } private val deleteHandler: Handler = emptyHandler().withErrorHandler(errorHandler) @@ -113,21 +108,17 @@ internal constructor( /** Delete inference pipeline. */ override fun delete( params: InferencePipelineDeleteParams, - requestOptions: RequestOptions - ): CompletableFuture { + requestOptions: RequestOptions, + ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.DELETE) .addPathSegments("inference-pipelines", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) - .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response.use { deleteHandler.handle(it) } - } + .prepareAsync(clientOptions, params) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> response.use { deleteHandler.handle(it) } } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt index bc149ca9..b18378dd 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt @@ -23,13 +23,17 @@ interface ProjectServiceAsync { @JvmOverloads fun create( params: ProjectCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** List your workspace's projects. */ @JvmOverloads fun list( - params: ProjectListParams, - requestOptions: RequestOptions = RequestOptions.none() + params: ProjectListParams = ProjectListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** List your workspace's projects. */ + fun list(requestOptions: RequestOptions): CompletableFuture = + list(ProjectListParams.none(), requestOptions) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt index e9f58966..4add3977 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt @@ -11,6 +11,7 @@ import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.json +import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.ProjectCreateParams import com.openlayer.api.models.ProjectCreateResponse @@ -22,10 +23,8 @@ import com.openlayer.api.services.async.projects.InferencePipelineServiceAsync import com.openlayer.api.services.async.projects.InferencePipelineServiceAsyncImpl import java.util.concurrent.CompletableFuture -class ProjectServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ProjectServiceAsync { +class ProjectServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + ProjectServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -45,28 +44,26 @@ internal constructor( /** Create a project in your workspace. */ override fun create( params: ProjectCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("projects") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) + .body(json(clientOptions.jsonMapper, params._body())) .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { createHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() + .prepareAsync(clientOptions, params) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() + } } - } - } + } } private val listHandler: Handler = @@ -75,26 +72,24 @@ internal constructor( /** List your workspace's projects. */ override fun list( params: ProjectListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("projects") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() + .prepareAsync(clientOptions, params) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() + } } - } - } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsyncImpl.kt index adb388e2..67c2446c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsyncImpl.kt @@ -6,10 +6,8 @@ import com.openlayer.api.core.ClientOptions import com.openlayer.api.services.async.storage.PresignedUrlServiceAsync import com.openlayer.api.services.async.storage.PresignedUrlServiceAsyncImpl -class StorageServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : StorageServiceAsync { +class StorageServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + StorageServiceAsync { private val presignedUrl: PresignedUrlServiceAsync by lazy { PresignedUrlServiceAsyncImpl(clientOptions) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt index dde3ea27..d41ac954 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt @@ -15,6 +15,6 @@ interface TestResultServiceAsync { @JvmOverloads fun list( params: CommitTestResultListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt index 51fd2d0a..6b0074b3 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt @@ -10,15 +10,14 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.CommitTestResultListParams import com.openlayer.api.models.CommitTestResultListResponse import java.util.concurrent.CompletableFuture -class TestResultServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : TestResultServiceAsync { +class TestResultServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + TestResultServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -29,26 +28,24 @@ internal constructor( /** List the test results for a project commit (project version). */ override fun list( params: CommitTestResultListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("versions", params.getPathParam(0), "results") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() + .prepareAsync(clientOptions, params) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() + } } - } - } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsync.kt index 4f079ecb..b5bc400b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsync.kt @@ -15,6 +15,6 @@ interface DataServiceAsync { @JvmOverloads fun stream( params: InferencePipelineDataStreamParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt index f27bf91a..4ba145b6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt @@ -11,15 +11,14 @@ import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.json +import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineDataStreamParams import com.openlayer.api.models.InferencePipelineDataStreamResponse import java.util.concurrent.CompletableFuture -class DataServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : DataServiceAsync { +class DataServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + DataServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -30,27 +29,25 @@ internal constructor( /** Publish an inference data point to an inference pipeline. */ override fun stream( params: InferencePipelineDataStreamParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("inference-pipelines", params.getPathParam(0), "data-stream") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) + .body(json(clientOptions.jsonMapper, params._body())) .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { streamHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() + .prepareAsync(clientOptions, params) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response + .use { streamHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() + } } - } - } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsync.kt index 4522c37c..01ebf016 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsync.kt @@ -15,6 +15,6 @@ interface RowServiceAsync { @JvmOverloads fun update( params: InferencePipelineRowUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt index 43dae3d1..6bf281bc 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt @@ -11,15 +11,14 @@ import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.json +import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineRowUpdateParams import com.openlayer.api.models.InferencePipelineRowUpdateResponse import java.util.concurrent.CompletableFuture -class RowServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : RowServiceAsync { +class RowServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + RowServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -30,27 +29,25 @@ internal constructor( /** Update an inference data point in an inference pipeline. */ override fun update( params: InferencePipelineRowUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("inference-pipelines", params.getPathParam(0), "rows") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) + .body(json(clientOptions.jsonMapper, params._body())) .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { updateHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() + .prepareAsync(clientOptions, params) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() + } } - } - } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsync.kt index 5d526af0..88d0f082 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsync.kt @@ -15,6 +15,6 @@ interface TestResultServiceAsync { @JvmOverloads fun list( params: InferencePipelineTestResultListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt index 7123589b..0b4fd944 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt @@ -10,15 +10,14 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineTestResultListParams import com.openlayer.api.models.InferencePipelineTestResultListResponse import java.util.concurrent.CompletableFuture -class TestResultServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : TestResultServiceAsync { +class TestResultServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + TestResultServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -29,26 +28,24 @@ internal constructor( /** List the latest test results for an inference pipeline. */ override fun list( params: InferencePipelineTestResultListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("inference-pipelines", params.getPathParam(0), "results") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() + .prepareAsync(clientOptions, params) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() + } } - } - } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt index e10cd5c0..3005ad57 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt @@ -17,13 +17,13 @@ interface CommitServiceAsync { @JvmOverloads fun create( params: ProjectCommitCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** List the commits (project versions) in a project. */ @JvmOverloads fun list( params: ProjectCommitListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt index bdcb6f3a..7a037b45 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt @@ -11,6 +11,7 @@ import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.json +import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.ProjectCommitCreateParams import com.openlayer.api.models.ProjectCommitCreateResponse @@ -18,10 +19,8 @@ import com.openlayer.api.models.ProjectCommitListParams import com.openlayer.api.models.ProjectCommitListResponse import java.util.concurrent.CompletableFuture -class CommitServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : CommitServiceAsync { +class CommitServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + CommitServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -32,28 +31,26 @@ internal constructor( /** Create a new commit (project version) in a project. */ override fun create( params: ProjectCommitCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("projects", params.getPathParam(0), "versions") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) + .body(json(clientOptions.jsonMapper, params._body())) .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { createHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() + .prepareAsync(clientOptions, params) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() + } } - } - } + } } private val listHandler: Handler = @@ -63,26 +60,24 @@ internal constructor( /** List the commits (project versions) in a project. */ override fun list( params: ProjectCommitListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("projects", params.getPathParam(0), "versions") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() + .prepareAsync(clientOptions, params) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() + } } - } - } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsync.kt index a0a6c636..bb60866b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsync.kt @@ -17,13 +17,13 @@ interface InferencePipelineServiceAsync { @JvmOverloads fun create( params: ProjectInferencePipelineCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** List the inference pipelines in a project. */ @JvmOverloads fun list( params: ProjectInferencePipelineListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt index 3256a2a2..969cdfd4 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt @@ -11,6 +11,7 @@ import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.json +import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.ProjectInferencePipelineCreateParams import com.openlayer.api.models.ProjectInferencePipelineCreateResponse @@ -19,9 +20,7 @@ import com.openlayer.api.models.ProjectInferencePipelineListResponse import java.util.concurrent.CompletableFuture class InferencePipelineServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : InferencePipelineServiceAsync { +internal constructor(private val clientOptions: ClientOptions) : InferencePipelineServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -32,28 +31,26 @@ internal constructor( /** Create an inference pipeline in a project. */ override fun create( params: ProjectInferencePipelineCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) + .body(json(clientOptions.jsonMapper, params._body())) .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { createHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() + .prepareAsync(clientOptions, params) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() + } } - } - } + } } private val listHandler: Handler = @@ -63,26 +60,24 @@ internal constructor( /** List the inference pipelines in a project. */ override fun list( params: ProjectInferencePipelineListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() + .prepareAsync(clientOptions, params) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() + } } - } - } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt index 933abd81..ddccb4c5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt @@ -15,6 +15,6 @@ interface PresignedUrlServiceAsync { @JvmOverloads fun create( params: StoragePresignedUrlCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt index 23679f37..ff4e02fa 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt @@ -11,15 +11,14 @@ import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.json +import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.StoragePresignedUrlCreateParams import com.openlayer.api.models.StoragePresignedUrlCreateResponse import java.util.concurrent.CompletableFuture -class PresignedUrlServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : PresignedUrlServiceAsync { +class PresignedUrlServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + PresignedUrlServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -30,27 +29,25 @@ internal constructor( /** Retrieve a presigned url to post storage artifacts. */ override fun create( params: StoragePresignedUrlCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("storage", "presigned-url") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) - .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response - -> - response - .use { createHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() + .prepareAsync(clientOptions, params) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() + } } - } - } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt index 20fdeafc..4c9d1b3b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt @@ -6,10 +6,8 @@ import com.openlayer.api.core.ClientOptions import com.openlayer.api.services.blocking.commits.TestResultService import com.openlayer.api.services.blocking.commits.TestResultServiceImpl -class CommitServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : CommitService { +class CommitServiceImpl internal constructor(private val clientOptions: ClientOptions) : + CommitService { private val testResults: TestResultService by lazy { TestResultServiceImpl(clientOptions) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt index 8b22b537..26c2ade2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt @@ -26,20 +26,20 @@ interface InferencePipelineService { @JvmOverloads fun retrieve( params: InferencePipelineRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): InferencePipelineRetrieveResponse /** Update inference pipeline. */ @JvmOverloads fun update( params: InferencePipelineUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): InferencePipelineUpdateResponse /** Delete inference pipeline. */ @JvmOverloads fun delete( params: InferencePipelineDeleteParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt index 23e2221a..6200c0a1 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt @@ -12,6 +12,7 @@ import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.json +import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineDeleteParams import com.openlayer.api.models.InferencePipelineRetrieveParams @@ -25,10 +26,8 @@ import com.openlayer.api.services.blocking.inferencePipelines.RowServiceImpl import com.openlayer.api.services.blocking.inferencePipelines.TestResultService import com.openlayer.api.services.blocking.inferencePipelines.TestResultServiceImpl -class InferencePipelineServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : InferencePipelineService { +class InferencePipelineServiceImpl internal constructor(private val clientOptions: ClientOptions) : + InferencePipelineService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -51,26 +50,22 @@ internal constructor( /** Retrieve inference pipeline. */ override fun retrieve( params: InferencePipelineRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): InferencePipelineRetrieveResponse { val request = HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("inference-pipelines", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { retrieveHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } + .prepare(clientOptions, params) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() } - } + } } private val updateHandler: Handler = @@ -80,27 +75,23 @@ internal constructor( /** Update inference pipeline. */ override fun update( params: InferencePipelineUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): InferencePipelineUpdateResponse { val request = HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("inference-pipelines", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) + .body(json(clientOptions.jsonMapper, params._body())) .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { updateHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } + .prepare(clientOptions, params) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() } - } + } } private val deleteHandler: Handler = emptyHandler().withErrorHandler(errorHandler) @@ -111,14 +102,10 @@ internal constructor( HttpRequest.builder() .method(HttpMethod.DELETE) .addPathSegments("inference-pipelines", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) - .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() - clientOptions.httpClient.execute(request, requestOptions).let { response -> - response.use { deleteHandler.handle(it) } - } + .prepare(clientOptions, params) + val response = clientOptions.httpClient.execute(request, requestOptions) + response.use { deleteHandler.handle(it) } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt index a9e58d1d..459032be 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt @@ -22,13 +22,17 @@ interface ProjectService { @JvmOverloads fun create( params: ProjectCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): ProjectCreateResponse /** List your workspace's projects. */ @JvmOverloads fun list( - params: ProjectListParams, - requestOptions: RequestOptions = RequestOptions.none() + params: ProjectListParams = ProjectListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), ): ProjectListResponse + + /** List your workspace's projects. */ + fun list(requestOptions: RequestOptions): ProjectListResponse = + list(ProjectListParams.none(), requestOptions) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt index f5e35697..8b0d5a68 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt @@ -11,6 +11,7 @@ import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.json +import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.ProjectCreateParams import com.openlayer.api.models.ProjectCreateResponse @@ -21,10 +22,8 @@ import com.openlayer.api.services.blocking.projects.CommitServiceImpl import com.openlayer.api.services.blocking.projects.InferencePipelineService import com.openlayer.api.services.blocking.projects.InferencePipelineServiceImpl -class ProjectServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ProjectService { +class ProjectServiceImpl internal constructor(private val clientOptions: ClientOptions) : + ProjectService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -44,27 +43,23 @@ internal constructor( /** Create a project in your workspace. */ override fun create( params: ProjectCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): ProjectCreateResponse { val request = HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("projects") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) + .body(json(clientOptions.jsonMapper, params._body())) .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { createHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } + .prepare(clientOptions, params) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() } - } + } } private val listHandler: Handler = @@ -73,25 +68,21 @@ internal constructor( /** List your workspace's projects. */ override fun list( params: ProjectListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): ProjectListResponse { val request = HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("projects") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } + .prepare(clientOptions, params) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() } - } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageServiceImpl.kt index c233c0df..39351c7a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageServiceImpl.kt @@ -6,10 +6,8 @@ import com.openlayer.api.core.ClientOptions import com.openlayer.api.services.blocking.storage.PresignedUrlService import com.openlayer.api.services.blocking.storage.PresignedUrlServiceImpl -class StorageServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : StorageService { +class StorageServiceImpl internal constructor(private val clientOptions: ClientOptions) : + StorageService { private val presignedUrl: PresignedUrlService by lazy { PresignedUrlServiceImpl(clientOptions) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt index 5ad32eff..035f8805 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt @@ -14,6 +14,6 @@ interface TestResultService { @JvmOverloads fun list( params: CommitTestResultListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CommitTestResultListResponse } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt index bdeb4697..e1b27853 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt @@ -10,14 +10,13 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.CommitTestResultListParams import com.openlayer.api.models.CommitTestResultListResponse -class TestResultServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : TestResultService { +class TestResultServiceImpl internal constructor(private val clientOptions: ClientOptions) : + TestResultService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -28,25 +27,21 @@ internal constructor( /** List the test results for a project commit (project version). */ override fun list( params: CommitTestResultListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CommitTestResultListResponse { val request = HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("versions", params.getPathParam(0), "results") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } + .prepare(clientOptions, params) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() } - } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataService.kt index bbfd2cf2..71e6109f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataService.kt @@ -14,6 +14,6 @@ interface DataService { @JvmOverloads fun stream( params: InferencePipelineDataStreamParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): InferencePipelineDataStreamResponse } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt index 4cf77dec..8f7fc24f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt @@ -11,14 +11,12 @@ import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.json +import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineDataStreamParams import com.openlayer.api.models.InferencePipelineDataStreamResponse -class DataServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : DataService { +class DataServiceImpl internal constructor(private val clientOptions: ClientOptions) : DataService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -29,26 +27,22 @@ internal constructor( /** Publish an inference data point to an inference pipeline. */ override fun stream( params: InferencePipelineDataStreamParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): InferencePipelineDataStreamResponse { val request = HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("inference-pipelines", params.getPathParam(0), "data-stream") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) + .body(json(clientOptions.jsonMapper, params._body())) .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { streamHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } + .prepare(clientOptions, params) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response + .use { streamHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() } - } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowService.kt index 3548f85b..c1e0cd4d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowService.kt @@ -14,6 +14,6 @@ interface RowService { @JvmOverloads fun update( params: InferencePipelineRowUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): InferencePipelineRowUpdateResponse } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt index 5c3afde1..4d2eb2f3 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt @@ -11,14 +11,12 @@ import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.json +import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineRowUpdateParams import com.openlayer.api.models.InferencePipelineRowUpdateResponse -class RowServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : RowService { +class RowServiceImpl internal constructor(private val clientOptions: ClientOptions) : RowService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -29,26 +27,22 @@ internal constructor( /** Update an inference data point in an inference pipeline. */ override fun update( params: InferencePipelineRowUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): InferencePipelineRowUpdateResponse { val request = HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("inference-pipelines", params.getPathParam(0), "rows") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) + .body(json(clientOptions.jsonMapper, params._body())) .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { updateHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } + .prepare(clientOptions, params) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() } - } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultService.kt index 24e0ca56..90669188 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultService.kt @@ -14,6 +14,6 @@ interface TestResultService { @JvmOverloads fun list( params: InferencePipelineTestResultListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): InferencePipelineTestResultListResponse } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt index d1a6ab94..c5e2874c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt @@ -10,14 +10,13 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineTestResultListParams import com.openlayer.api.models.InferencePipelineTestResultListResponse -class TestResultServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : TestResultService { +class TestResultServiceImpl internal constructor(private val clientOptions: ClientOptions) : + TestResultService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -28,25 +27,21 @@ internal constructor( /** List the latest test results for an inference pipeline. */ override fun list( params: InferencePipelineTestResultListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): InferencePipelineTestResultListResponse { val request = HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("inference-pipelines", params.getPathParam(0), "results") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } + .prepare(clientOptions, params) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() } - } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt index 9874a6ee..88de23ef 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt @@ -16,13 +16,13 @@ interface CommitService { @JvmOverloads fun create( params: ProjectCommitCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): ProjectCommitCreateResponse /** List the commits (project versions) in a project. */ @JvmOverloads fun list( params: ProjectCommitListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): ProjectCommitListResponse } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt index ab0fa156..54624f0b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt @@ -11,16 +11,15 @@ import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.json +import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.ProjectCommitCreateParams import com.openlayer.api.models.ProjectCommitCreateResponse import com.openlayer.api.models.ProjectCommitListParams import com.openlayer.api.models.ProjectCommitListResponse -class CommitServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : CommitService { +class CommitServiceImpl internal constructor(private val clientOptions: ClientOptions) : + CommitService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -31,27 +30,23 @@ internal constructor( /** Create a new commit (project version) in a project. */ override fun create( params: ProjectCommitCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): ProjectCommitCreateResponse { val request = HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("projects", params.getPathParam(0), "versions") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) + .body(json(clientOptions.jsonMapper, params._body())) .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { createHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } + .prepare(clientOptions, params) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() } - } + } } private val listHandler: Handler = @@ -61,25 +56,21 @@ internal constructor( /** List the commits (project versions) in a project. */ override fun list( params: ProjectCommitListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): ProjectCommitListResponse { val request = HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("projects", params.getPathParam(0), "versions") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } + .prepare(clientOptions, params) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() } - } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineService.kt index 93989fbb..572dad82 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineService.kt @@ -16,13 +16,13 @@ interface InferencePipelineService { @JvmOverloads fun create( params: ProjectInferencePipelineCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): ProjectInferencePipelineCreateResponse /** List the inference pipelines in a project. */ @JvmOverloads fun list( params: ProjectInferencePipelineListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): ProjectInferencePipelineListResponse } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt index 86169dd7..552a3afe 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt @@ -11,16 +11,15 @@ import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.json +import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.ProjectInferencePipelineCreateParams import com.openlayer.api.models.ProjectInferencePipelineCreateResponse import com.openlayer.api.models.ProjectInferencePipelineListParams import com.openlayer.api.models.ProjectInferencePipelineListResponse -class InferencePipelineServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : InferencePipelineService { +class InferencePipelineServiceImpl internal constructor(private val clientOptions: ClientOptions) : + InferencePipelineService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -31,27 +30,23 @@ internal constructor( /** Create an inference pipeline in a project. */ override fun create( params: ProjectInferencePipelineCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): ProjectInferencePipelineCreateResponse { val request = HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) + .body(json(clientOptions.jsonMapper, params._body())) .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { createHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } + .prepare(clientOptions, params) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() } - } + } } private val listHandler: Handler = @@ -61,25 +56,21 @@ internal constructor( /** List the inference pipelines in a project. */ override fun list( params: ProjectInferencePipelineListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): ProjectInferencePipelineListResponse { val request = HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } + .prepare(clientOptions, params) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() } - } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt index 6cc179e5..04882081 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt @@ -14,6 +14,6 @@ interface PresignedUrlService { @JvmOverloads fun create( params: StoragePresignedUrlCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): StoragePresignedUrlCreateResponse } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt index 627c4cb5..d49d38ce 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt @@ -11,14 +11,13 @@ import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.json +import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.StoragePresignedUrlCreateParams import com.openlayer.api.models.StoragePresignedUrlCreateResponse -class PresignedUrlServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : PresignedUrlService { +class PresignedUrlServiceImpl internal constructor(private val clientOptions: ClientOptions) : + PresignedUrlService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -29,26 +28,22 @@ internal constructor( /** Retrieve a presigned url to post storage artifacts. */ override fun create( params: StoragePresignedUrlCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): StoragePresignedUrlCreateResponse { val request = HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("storage", "presigned-url") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .replaceAllHeaders(params.getHeaders()) - .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { createHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } + .prepare(clientOptions, params) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() } - } + } } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/TestServerExtension.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/TestServerExtension.kt index 0d72bda9..b415aff6 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/TestServerExtension.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/TestServerExtension.kt @@ -36,7 +36,7 @@ class TestServerExtension : BeforeAllCallback, ExecutionCondition { $ prism mock path/to/your.openapi.yml """ .trimIndent(), - e + e, ) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/PhantomReachableTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/PhantomReachableTest.kt index b991a43c..e57f8a41 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/PhantomReachableTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/PhantomReachableTest.kt @@ -14,7 +14,7 @@ internal class PhantomReachableTest { // Pass an inline object for the object to observe so that it becomes immediately // unreachable. Any(), - closeable + closeable, ) assertThat(closed).isFalse() diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/UtilsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/UtilsTest.kt new file mode 100644 index 00000000..18feeb5e --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/UtilsTest.kt @@ -0,0 +1,33 @@ +package com.openlayer.api.core + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class UtilsTest { + @Test + fun contentDeepEquals() { + assertThat(42 contentEquals 42).isTrue() + assertThat(42 contentEquals "Hello World!").isFalse() + assertThat(byteArrayOf(1, 2, 3) contentEquals byteArrayOf(1, 2, 3)).isTrue() + assertThat(byteArrayOf(1, 2, 3) contentEquals byteArrayOf(1, 2, 4)).isFalse() + assertThat( + arrayOf(byteArrayOf(1, 2), byteArrayOf(3)) contentEquals + arrayOf(byteArrayOf(1, 2), byteArrayOf(3)) + ) + .isTrue() + assertThat( + arrayOf(byteArrayOf(1, 2), byteArrayOf(3)) contentEquals + arrayOf(byteArrayOf(1), byteArrayOf(2, 3)) + ) + .isFalse() + } + + @Test + fun contentToString() { + assertThat((42).contentToString()).isEqualTo("42") + assertThat("Hello World!".contentToString()).isEqualTo("Hello World!") + assertThat(byteArrayOf(1, 2, 3).contentToString()).isEqualTo("[1, 2, 3]") + assertThat(arrayOf(byteArrayOf(1, 2), byteArrayOf(3)).contentToString()) + .isEqualTo("[[1, 2], [3]]") + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/ValuesTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/ValuesTest.kt new file mode 100644 index 00000000..3b63f05b --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/ValuesTest.kt @@ -0,0 +1,144 @@ +package com.openlayer.api.core + +import java.util.Optional +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.EnumSource + +internal class ValuesTest { + companion object { + private val NON_JSON = Any() + } + + enum class TestCase( + val value: JsonField<*>, + val expectedIsMissing: Boolean = false, + val expectedIsNull: Boolean = false, + val expectedAsKnown: Optional<*> = Optional.empty(), + val expectedAsBoolean: Optional = Optional.empty(), + val expectedAsNumber: Optional = Optional.empty(), + val expectedAsString: Optional = Optional.empty(), + val expectedAsArray: Optional> = Optional.empty(), + val expectedAsObject: Optional> = Optional.empty(), + ) { + MISSING(JsonMissing.of(), expectedIsMissing = true), + NULL(JsonNull.of(), expectedIsNull = true), + KNOWN(KnownValue.of(NON_JSON), expectedAsKnown = Optional.of(NON_JSON)), + KNOWN_BOOLEAN( + KnownValue.of(true), + expectedAsKnown = Optional.of(true), + expectedAsBoolean = Optional.of(true), + ), + BOOLEAN(JsonBoolean.of(true), expectedAsBoolean = Optional.of(true)), + KNOWN_NUMBER( + KnownValue.of(42), + expectedAsKnown = Optional.of(42), + expectedAsNumber = Optional.of(42), + ), + NUMBER(JsonNumber.of(42), expectedAsNumber = Optional.of(42)), + KNOWN_STRING( + KnownValue.of("hello"), + expectedAsKnown = Optional.of("hello"), + expectedAsString = Optional.of("hello"), + ), + STRING(JsonString.of("hello"), expectedAsString = Optional.of("hello")), + KNOWN_ARRAY_NOT_ALL_JSON( + KnownValue.of(listOf("a", "b", NON_JSON)), + expectedAsKnown = Optional.of(listOf("a", "b", NON_JSON)), + ), + KNOWN_ARRAY( + KnownValue.of(listOf("a", "b", "c")), + expectedAsKnown = Optional.of(listOf("a", "b", "c")), + expectedAsArray = + Optional.of(listOf(JsonString.of("a"), JsonString.of("b"), JsonString.of("c"))), + ), + ARRAY( + JsonArray.of(listOf(JsonString.of("a"), JsonString.of("b"), JsonString.of("c"))), + expectedAsArray = + Optional.of(listOf(JsonString.of("a"), JsonString.of("b"), JsonString.of("c"))), + ), + KNOWN_OBJECT_NOT_ALL_STRING_KEYS( + KnownValue.of(mapOf("a" to "b", 42 to "c")), + expectedAsKnown = Optional.of(mapOf("a" to "b", 42 to "c")), + ), + KNOWN_OBJECT_NOT_ALL_JSON( + KnownValue.of(mapOf("a" to "b", "b" to NON_JSON)), + expectedAsKnown = Optional.of(mapOf("a" to "b", "b" to NON_JSON)), + ), + KNOWN_OBJECT( + KnownValue.of(mapOf("a" to "b", "b" to "c")), + expectedAsKnown = Optional.of(mapOf("a" to "b", "b" to "c")), + expectedAsObject = + Optional.of(mapOf("a" to JsonString.of("b"), "b" to JsonString.of("c"))), + ), + OBJECT( + JsonObject.of(mapOf("a" to JsonString.of("b"), "b" to JsonString.of("c"))), + expectedAsObject = + Optional.of(mapOf("a" to JsonString.of("b"), "b" to JsonString.of("c"))), + ), + } + + @ParameterizedTest + @EnumSource + fun isMissing(testCase: TestCase) { + val isMissing = testCase.value.isMissing() + + assertThat(isMissing).isEqualTo(testCase.expectedIsMissing) + } + + @ParameterizedTest + @EnumSource + fun isNull(testCase: TestCase) { + val isNull = testCase.value.isNull() + + assertThat(isNull).isEqualTo(testCase.expectedIsNull) + } + + @ParameterizedTest + @EnumSource + fun asKnown(testCase: TestCase) { + val known = testCase.value.asKnown() + + assertThat(known).isEqualTo(testCase.expectedAsKnown) + } + + @ParameterizedTest + @EnumSource + fun asBoolean(testCase: TestCase) { + val boolean = testCase.value.asBoolean() + + assertThat(boolean).isEqualTo(testCase.expectedAsBoolean) + } + + @ParameterizedTest + @EnumSource + fun asNumber(testCase: TestCase) { + val number = testCase.value.asNumber() + + assertThat(number).isEqualTo(testCase.expectedAsNumber) + } + + @ParameterizedTest + @EnumSource + fun asString(testCase: TestCase) { + val string = testCase.value.asString() + + assertThat(string).isEqualTo(testCase.expectedAsString) + } + + @ParameterizedTest + @EnumSource + fun asArray(testCase: TestCase) { + val array = testCase.value.asArray() + + assertThat(array).isEqualTo(testCase.expectedAsArray) + } + + @ParameterizedTest + @EnumSource + fun asObject(testCase: TestCase) { + val obj = testCase.value.asObject() + + assertThat(obj).isEqualTo(testCase.expectedAsObject) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HeadersTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HeadersTest.kt index 0780679e..c0127205 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HeadersTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HeadersTest.kt @@ -11,28 +11,28 @@ internal class HeadersTest { enum class TestCase( val headers: Headers, val expectedMap: Map>, - val expectedSize: Int + val expectedSize: Int, ) { EMPTY(Headers.builder().build(), expectedMap = mapOf(), expectedSize = 0), PUT_ONE( Headers.builder().put("name", "value").build(), expectedMap = mapOf("name" to listOf("value")), - expectedSize = 1 + expectedSize = 1, ), PUT_MULTIPLE( Headers.builder().put("name", listOf("value1", "value2")).build(), expectedMap = mapOf("name" to listOf("value1", "value2")), - expectedSize = 2 + expectedSize = 2, ), MULTIPLE_PUT( Headers.builder().put("name1", "value").put("name2", "value").build(), expectedMap = mapOf("name1" to listOf("value"), "name2" to listOf("value")), - expectedSize = 2 + expectedSize = 2, ), MULTIPLE_PUT_SAME_NAME( Headers.builder().put("name", "value1").put("name", "value2").build(), expectedMap = mapOf("name" to listOf("value1", "value2")), - expectedSize = 2 + expectedSize = 2, ), MULTIPLE_PUT_MULTIPLE( Headers.builder() @@ -40,7 +40,7 @@ internal class HeadersTest { .put("name", listOf("value1", "value2")) .build(), expectedMap = mapOf("name" to listOf("value1", "value2", "value1", "value2")), - expectedSize = 4 + expectedSize = 4, ), PUT_CASE_INSENSITIVE( Headers.builder() @@ -49,25 +49,25 @@ internal class HeadersTest { .put("nAmE", "value3") .build(), expectedMap = mapOf("name" to listOf("value1", "value2", "value3")), - expectedSize = 3 + expectedSize = 3, ), PUT_ALL_MAP( Headers.builder() .putAll( mapOf( "name1" to listOf("value1", "value2"), - "name2" to listOf("value1", "value2") + "name2" to listOf("value1", "value2"), ) ) .build(), expectedMap = mapOf("name1" to listOf("value1", "value2"), "name2" to listOf("value1", "value2")), - expectedSize = 4 + expectedSize = 4, ), PUT_ALL_HEADERS( Headers.builder().putAll(Headers.builder().put("name", "value").build()).build(), expectedMap = mapOf("name" to listOf("value")), - expectedSize = 1 + expectedSize = 1, ), PUT_ALL_CASE_INSENSITIVE( Headers.builder() @@ -75,32 +75,32 @@ internal class HeadersTest { mapOf( "name" to listOf("value1"), "NAME" to listOf("value2"), - "nAmE" to listOf("value3") + "nAmE" to listOf("value3"), ) ) .build(), expectedMap = mapOf("name" to listOf("value1", "value2", "value3")), - expectedSize = 3 + expectedSize = 3, ), REMOVE_ABSENT( Headers.builder().remove("name").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_PRESENT_ONE( Headers.builder().put("name", "value").remove("name").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_PRESENT_MULTIPLE( Headers.builder().put("name", listOf("value1", "value2")).remove("name").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_CASE_INSENSITIVE( Headers.builder().put("name", listOf("value1", "value2")).remove("NAME").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_ALL( Headers.builder() @@ -109,7 +109,7 @@ internal class HeadersTest { .removeAll(setOf("name1", "name2", "name3")) .build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_ALL_CASE_INSENSITIVE( Headers.builder() @@ -118,22 +118,22 @@ internal class HeadersTest { .removeAll(setOf("NAME1", "nAmE3")) .build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), CLEAR( Headers.builder().put("name1", "value").put("name2", "value").clear().build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REPLACE_ONE_ABSENT( Headers.builder().replace("name", "value").build(), expectedMap = mapOf("name" to listOf("value")), - expectedSize = 1 + expectedSize = 1, ), REPLACE_ONE_PRESENT_ONE( Headers.builder().put("name", "value1").replace("name", "value2").build(), expectedMap = mapOf("name" to listOf("value2")), - expectedSize = 1 + expectedSize = 1, ), REPLACE_ONE_PRESENT_MULTIPLE( Headers.builder() @@ -141,12 +141,12 @@ internal class HeadersTest { .replace("name", "value3") .build(), expectedMap = mapOf("name" to listOf("value3")), - expectedSize = 1 + expectedSize = 1, ), REPLACE_MULTIPLE_ABSENT( Headers.builder().replace("name", listOf("value1", "value2")).build(), expectedMap = mapOf("name" to listOf("value1", "value2")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_MULTIPLE_PRESENT_ONE( Headers.builder() @@ -154,7 +154,7 @@ internal class HeadersTest { .replace("name", listOf("value2", "value3")) .build(), expectedMap = mapOf("name" to listOf("value2", "value3")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_MULTIPLE_PRESENT_MULTIPLE( Headers.builder() @@ -162,7 +162,7 @@ internal class HeadersTest { .replace("name", listOf("value3", "value4")) .build(), expectedMap = mapOf("name" to listOf("value3", "value4")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_CASE_INSENSITIVE( Headers.builder() @@ -170,7 +170,7 @@ internal class HeadersTest { .replace("NAME", listOf("value2", "value3")) .build(), expectedMap = mapOf("NAME" to listOf("value2", "value3")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_ALL_MAP( Headers.builder() @@ -183,9 +183,9 @@ internal class HeadersTest { mapOf( "name1" to listOf("value2"), "name2" to listOf("value1"), - "name3" to listOf("value2") + "name3" to listOf("value2"), ), - expectedSize = 3 + expectedSize = 3, ), REPLACE_ALL_HEADERS( Headers.builder() @@ -198,9 +198,9 @@ internal class HeadersTest { mapOf( "name1" to listOf("value2"), "name2" to listOf("value1"), - "name3" to listOf("value2") + "name3" to listOf("value2"), ), - expectedSize = 3 + expectedSize = 3, ), REPLACE_ALL_CASE_INSENSITIVE( Headers.builder() @@ -209,8 +209,8 @@ internal class HeadersTest { .replaceAll(mapOf("NAME1" to listOf("value2"), "nAmE2" to listOf("value2"))) .build(), expectedMap = mapOf("NAME1" to listOf("value2"), "nAmE2" to listOf("value2")), - expectedSize = 2 - ) + expectedSize = 2, + ), } @ParameterizedTest diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/QueryParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/QueryParamsTest.kt index 7db575e3..51000b8c 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/QueryParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/QueryParamsTest.kt @@ -11,28 +11,28 @@ internal class QueryParamsTest { enum class TestCase( val queryParams: QueryParams, val expectedMap: Map>, - val expectedSize: Int + val expectedSize: Int, ) { EMPTY(QueryParams.builder().build(), expectedMap = mapOf(), expectedSize = 0), PUT_ONE( QueryParams.builder().put("key", "value").build(), expectedMap = mapOf("key" to listOf("value")), - expectedSize = 1 + expectedSize = 1, ), PUT_MULTIPLE( QueryParams.builder().put("key", listOf("value1", "value2")).build(), expectedMap = mapOf("key" to listOf("value1", "value2")), - expectedSize = 2 + expectedSize = 2, ), MULTIPLE_PUT( QueryParams.builder().put("key1", "value").put("key2", "value").build(), expectedMap = mapOf("key1" to listOf("value"), "key2" to listOf("value")), - expectedSize = 2 + expectedSize = 2, ), MULTIPLE_PUT_SAME_NAME( QueryParams.builder().put("key", "value1").put("key", "value2").build(), expectedMap = mapOf("key" to listOf("value1", "value2")), - expectedSize = 2 + expectedSize = 2, ), MULTIPLE_PUT_MULTIPLE( QueryParams.builder() @@ -40,40 +40,40 @@ internal class QueryParamsTest { .put("key", listOf("value1", "value2")) .build(), expectedMap = mapOf("key" to listOf("value1", "value2", "value1", "value2")), - expectedSize = 4 + expectedSize = 4, ), PUT_ALL_MAP( QueryParams.builder() .putAll( mapOf( "key1" to listOf("value1", "value2"), - "key2" to listOf("value1", "value2") + "key2" to listOf("value1", "value2"), ) ) .build(), expectedMap = mapOf("key1" to listOf("value1", "value2"), "key2" to listOf("value1", "value2")), - expectedSize = 4 + expectedSize = 4, ), PUT_ALL_HEADERS( QueryParams.builder().putAll(QueryParams.builder().put("key", "value").build()).build(), expectedMap = mapOf("key" to listOf("value")), - expectedSize = 1 + expectedSize = 1, ), REMOVE_ABSENT( QueryParams.builder().remove("key").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_PRESENT_ONE( QueryParams.builder().put("key", "value").remove("key").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_PRESENT_MULTIPLE( QueryParams.builder().put("key", listOf("value1", "value2")).remove("key").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_ALL( QueryParams.builder() @@ -82,22 +82,22 @@ internal class QueryParamsTest { .removeAll(setOf("key1", "key2", "key3")) .build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), CLEAR( QueryParams.builder().put("key1", "value").put("key2", "value").clear().build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REPLACE_ONE_ABSENT( QueryParams.builder().replace("key", "value").build(), expectedMap = mapOf("key" to listOf("value")), - expectedSize = 1 + expectedSize = 1, ), REPLACE_ONE_PRESENT_ONE( QueryParams.builder().put("key", "value1").replace("key", "value2").build(), expectedMap = mapOf("key" to listOf("value2")), - expectedSize = 1 + expectedSize = 1, ), REPLACE_ONE_PRESENT_MULTIPLE( QueryParams.builder() @@ -105,12 +105,12 @@ internal class QueryParamsTest { .replace("key", "value3") .build(), expectedMap = mapOf("key" to listOf("value3")), - expectedSize = 1 + expectedSize = 1, ), REPLACE_MULTIPLE_ABSENT( QueryParams.builder().replace("key", listOf("value1", "value2")).build(), expectedMap = mapOf("key" to listOf("value1", "value2")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_MULTIPLE_PRESENT_ONE( QueryParams.builder() @@ -118,7 +118,7 @@ internal class QueryParamsTest { .replace("key", listOf("value2", "value3")) .build(), expectedMap = mapOf("key" to listOf("value2", "value3")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_MULTIPLE_PRESENT_MULTIPLE( QueryParams.builder() @@ -126,7 +126,7 @@ internal class QueryParamsTest { .replace("key", listOf("value3", "value4")) .build(), expectedMap = mapOf("key" to listOf("value3", "value4")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_ALL_MAP( QueryParams.builder() @@ -139,9 +139,9 @@ internal class QueryParamsTest { mapOf( "key1" to listOf("value2"), "key2" to listOf("value1"), - "key3" to listOf("value2") + "key3" to listOf("value2"), ), - expectedSize = 3 + expectedSize = 3, ), REPLACE_ALL_HEADERS( QueryParams.builder() @@ -156,10 +156,10 @@ internal class QueryParamsTest { mapOf( "key1" to listOf("value2"), "key2" to listOf("value1"), - "key3" to listOf("value2") + "key3" to listOf("value2"), ), - expectedSize = 3 - ) + expectedSize = 3, + ), } @ParameterizedTest diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt index 517c669f..8e89c85e 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt @@ -5,38 +5,83 @@ import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo import com.github.tomakehurst.wiremock.junit5.WireMockTest import com.github.tomakehurst.wiremock.stubbing.Scenario import com.openlayer.api.client.okhttp.OkHttpClient +import com.openlayer.api.core.RequestOptions +import java.io.InputStream +import java.util.concurrent.CompletableFuture import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.ValueSource @WireMockTest internal class RetryingHttpClientTest { + private var openResponseCount = 0 private lateinit var httpClient: HttpClient @BeforeEach fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { - httpClient = OkHttpClient.builder().baseUrl(wmRuntimeInfo.httpBaseUrl).build() + val okHttpClient = OkHttpClient.builder().baseUrl(wmRuntimeInfo.httpBaseUrl).build() + httpClient = + object : HttpClient { + override fun execute( + request: HttpRequest, + requestOptions: RequestOptions, + ): HttpResponse = trackClose(okHttpClient.execute(request, requestOptions)) + + override fun executeAsync( + request: HttpRequest, + requestOptions: RequestOptions, + ): CompletableFuture = + okHttpClient.executeAsync(request, requestOptions).thenApply { trackClose(it) } + + override fun close() = okHttpClient.close() + + private fun trackClose(response: HttpResponse): HttpResponse { + openResponseCount++ + return object : HttpResponse { + private var isClosed = false + + override fun statusCode(): Int = response.statusCode() + + override fun headers(): Headers = response.headers() + + override fun body(): InputStream = response.body() + + override fun close() { + response.close() + if (isClosed) { + return + } + openResponseCount-- + isClosed = true + } + } + } + } resetAllScenarios() } - @Test - fun byDefaultShouldNotAddIdempotencyHeaderToRequest() { - val request = - HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build() + @ParameterizedTest + @ValueSource(booleans = [false, true]) + fun execute(async: Boolean) { stubFor(post(urlPathEqualTo("/something")).willReturn(ok())) val retryingClient = RetryingHttpClient.builder().httpClient(httpClient).build() - val response = retryingClient.execute(request) + + val response = + retryingClient.execute( + HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build(), + async, + ) + assertThat(response.statusCode()).isEqualTo(200) verify(1, postRequestedFor(urlPathEqualTo("/something"))) + assertNoResponseLeaks() } - @Test - fun whenProvidedShouldAddIdempotencyHeaderToRequest() { - val request = - HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build() + @ParameterizedTest + @ValueSource(booleans = [false, true]) + fun execute_withIdempotencyHeader(async: Boolean) { stubFor( post(urlPathEqualTo("/something")) .withHeader("X-Some-Header", matching("stainless-java-retry-.+")) @@ -48,19 +93,25 @@ internal class RetryingHttpClientTest { .maxRetries(2) .idempotencyHeader("X-Some-Header") .build() - val response = retryingClient.execute(request) + + val response = + retryingClient.execute( + HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build(), + async, + ) + assertThat(response.statusCode()).isEqualTo(200) verify(1, postRequestedFor(urlPathEqualTo("/something"))) + assertNoResponseLeaks() } @ParameterizedTest @ValueSource(booleans = [false, true]) - fun retryAfterHeader(async: Boolean) { - val request = - HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build() + fun execute_withRetryAfterHeader(async: Boolean) { stubFor( post(urlPathEqualTo("/something")) - .inScenario("foo") // first we fail with a retry after header given as a date + // First we fail with a retry after header given as a date + .inScenario("foo") .whenScenarioStateIs(Scenario.STARTED) .willReturn( serviceUnavailable().withHeader("Retry-After", "Wed, 21 Oct 2015 07:28:00 GMT") @@ -69,14 +120,16 @@ internal class RetryingHttpClientTest { ) stubFor( post(urlPathEqualTo("/something")) - .inScenario("foo") // then we fail with a retry after header given as a delay + // Then we fail with a retry after header given as a delay + .inScenario("foo") .whenScenarioStateIs("RETRY_AFTER_DATE") .willReturn(serviceUnavailable().withHeader("Retry-After", "1.234")) .willSetStateTo("RETRY_AFTER_DELAY") ) stubFor( post(urlPathEqualTo("/something")) - .inScenario("foo") // then we return a success + // Then we return a success + .inScenario("foo") .whenScenarioStateIs("RETRY_AFTER_DELAY") .willReturn(ok()) .willSetStateTo("COMPLETED") @@ -85,36 +138,33 @@ internal class RetryingHttpClientTest { RetryingHttpClient.builder().httpClient(httpClient).maxRetries(2).build() val response = - if (async) retryingClient.executeAsync(request).get() - else retryingClient.execute(request) + retryingClient.execute( + HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build(), + async, + ) assertThat(response.statusCode()).isEqualTo(200) verify( 1, postRequestedFor(urlPathEqualTo("/something")) - .withHeader("x-stainless-retry-count", equalTo("0")) + .withHeader("x-stainless-retry-count", equalTo("0")), ) verify( 1, postRequestedFor(urlPathEqualTo("/something")) - .withHeader("x-stainless-retry-count", equalTo("1")) + .withHeader("x-stainless-retry-count", equalTo("1")), ) verify( 1, postRequestedFor(urlPathEqualTo("/something")) - .withHeader("x-stainless-retry-count", equalTo("2")) + .withHeader("x-stainless-retry-count", equalTo("2")), ) + assertNoResponseLeaks() } @ParameterizedTest @ValueSource(booleans = [false, true]) - fun overwriteRetryCountHeader(async: Boolean) { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegment("something") - .putHeader("x-stainless-retry-count", "42") - .build() + fun execute_withOverwrittenRetryCountHeader(async: Boolean) { stubFor( post(urlPathEqualTo("/something")) .inScenario("foo") // first we fail with a retry after header given as a date @@ -135,21 +185,27 @@ internal class RetryingHttpClientTest { RetryingHttpClient.builder().httpClient(httpClient).maxRetries(2).build() val response = - if (async) retryingClient.executeAsync(request).get() - else retryingClient.execute(request) + retryingClient.execute( + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegment("something") + .putHeader("x-stainless-retry-count", "42") + .build(), + async, + ) assertThat(response.statusCode()).isEqualTo(200) verify( 2, postRequestedFor(urlPathEqualTo("/something")) - .withHeader("x-stainless-retry-count", equalTo("42")) + .withHeader("x-stainless-retry-count", equalTo("42")), ) + assertNoResponseLeaks() } - @Test - fun retryAfterMsHeader() { - val request = - HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build() + @ParameterizedTest + @ValueSource(booleans = [false, true]) + fun execute_withRetryAfterMsHeader(async: Boolean) { stubFor( post(urlPathEqualTo("/something")) .inScenario("foo") @@ -166,8 +222,22 @@ internal class RetryingHttpClientTest { ) val retryingClient = RetryingHttpClient.builder().httpClient(httpClient).maxRetries(1).build() - val response = retryingClient.execute(request) + + val response = + retryingClient.execute( + HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build(), + async, + ) + assertThat(response.statusCode()).isEqualTo(200) verify(2, postRequestedFor(urlPathEqualTo("/something"))) + assertNoResponseLeaks() } + + private fun HttpClient.execute(request: HttpRequest, async: Boolean): HttpResponse = + if (async) executeAsync(request).get() else execute(request) + + // When retrying, all failed responses should be closed. Only the final returned response should + // be open. + private fun assertNoResponseLeaks() = assertThat(openResponseCount).isEqualTo(1) } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt index e79b185f..1e6f107d 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt @@ -48,11 +48,7 @@ internal class SerializerTest { override fun hashCode(): Int { if (hashCode == 0) { - hashCode = - Objects.hash( - isActive, - additionalProperties, - ) + hashCode = Objects.hash(isActive, additionalProperties) } return hashCode } @@ -91,10 +87,7 @@ internal class SerializerTest { } fun build(): ClassWithBooleanFieldPrefixedWithIs = - ClassWithBooleanFieldPrefixedWithIs( - isActive, - additionalProperties.toImmutable(), - ) + ClassWithBooleanFieldPrefixedWithIs(isActive, additionalProperties.toImmutable()) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListParamsTest.kt index 2982dc94..962fcaea 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListParamsTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test class CommitTestResultListParamsTest { @Test - fun createCommitTestResultListParams() { + fun create() { CommitTestResultListParams.builder() .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .includeArchived(true) @@ -21,7 +21,7 @@ class CommitTestResultListParamsTest { } @Test - fun getQueryParams() { + fun queryParams() { val params = CommitTestResultListParams.builder() .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -37,17 +37,17 @@ class CommitTestResultListParamsTest { expected.put("perPage", "1") expected.put("status", CommitTestResultListParams.Status.RUNNING.toString()) expected.put("type", CommitTestResultListParams.Type.INTEGRITY.toString()) - assertThat(params.getQueryParams()).isEqualTo(expected.build()) + assertThat(params._queryParams()).isEqualTo(expected.build()) } @Test - fun getQueryParamsWithoutOptionalFields() { + fun queryParamsWithoutOptionalFields() { val params = CommitTestResultListParams.builder() .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() val expected = QueryParams.builder() - assertThat(params.getQueryParams()).isEqualTo(expected.build()) + assertThat(params._queryParams()).isEqualTo(expected.build()) } @Test diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt index 5015e97d..379eb898 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt @@ -3,13 +3,14 @@ package com.openlayer.api.models import com.openlayer.api.core.JsonValue +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test class InferencePipelineDataStreamParamsTest { @Test - fun createInferencePipelineDataStreamParams() { + fun create() { InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( @@ -46,7 +47,7 @@ class InferencePipelineDataStreamParamsTest { } @Test - fun getBody() { + fun body() { val params = InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -81,8 +82,10 @@ class InferencePipelineDataStreamParamsTest { .build() ) .build() - val body = params.getBody() - assertThat(body).isNotNull + + val body = params._body() + + assertNotNull(body) assertThat(body.config()) .isEqualTo( InferencePipelineDataStreamParams.Config.ofLlmData( @@ -122,7 +125,7 @@ class InferencePipelineDataStreamParamsTest { } @Test - fun getBodyWithoutOptionalFields() { + fun bodyWithoutOptionalFields() { val params = InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -141,8 +144,10 @@ class InferencePipelineDataStreamParamsTest { .build() ) .build() - val body = params.getBody() - assertThat(body).isNotNull + + val body = params._body() + + assertNotNull(body) assertThat(body.config()) .isEqualTo( InferencePipelineDataStreamParams.Config.ofLlmData( diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDeleteParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDeleteParamsTest.kt index 7e24f8ed..44bfdcf1 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDeleteParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDeleteParamsTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test class InferencePipelineDeleteParamsTest { @Test - fun createInferencePipelineDeleteParams() { + fun create() { InferencePipelineDeleteParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParamsTest.kt index b4ee0dd9..da569fe6 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParamsTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test class InferencePipelineRetrieveParamsTest { @Test - fun createInferencePipelineRetrieveParams() { + fun create() { InferencePipelineRetrieveParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addExpand(InferencePipelineRetrieveParams.Expand.PROJECT) @@ -17,7 +17,7 @@ class InferencePipelineRetrieveParamsTest { } @Test - fun getQueryParams() { + fun queryParams() { val params = InferencePipelineRetrieveParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -25,17 +25,17 @@ class InferencePipelineRetrieveParamsTest { .build() val expected = QueryParams.builder() expected.put("expand", InferencePipelineRetrieveParams.Expand.PROJECT.toString()) - assertThat(params.getQueryParams()).isEqualTo(expected.build()) + assertThat(params._queryParams()).isEqualTo(expected.build()) } @Test - fun getQueryParamsWithoutOptionalFields() { + fun queryParamsWithoutOptionalFields() { val params = InferencePipelineRetrieveParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() val expected = QueryParams.builder() - assertThat(params.getQueryParams()).isEqualTo(expected.build()) + assertThat(params._queryParams()).isEqualTo(expected.build()) } @Test diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt index 2206704a..c165a679 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt @@ -4,13 +4,14 @@ package com.openlayer.api.models import com.openlayer.api.core.JsonValue import com.openlayer.api.core.http.QueryParams +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test class InferencePipelineRowUpdateParamsTest { @Test - fun createInferencePipelineRowUpdateParams() { + fun create() { InferencePipelineRowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .inferenceId("inferenceId") @@ -19,7 +20,6 @@ class InferencePipelineRowUpdateParamsTest { InferencePipelineRowUpdateParams.Config.builder() .groundTruthColumnName("ground_truth") .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") .latencyColumnName("latency") .timestampColumnName("timestamp") .build() @@ -28,7 +28,7 @@ class InferencePipelineRowUpdateParamsTest { } @Test - fun getQueryParams() { + fun queryParams() { val params = InferencePipelineRowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -38,7 +38,6 @@ class InferencePipelineRowUpdateParamsTest { InferencePipelineRowUpdateParams.Config.builder() .groundTruthColumnName("ground_truth") .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") .latencyColumnName("latency") .timestampColumnName("timestamp") .build() @@ -46,11 +45,11 @@ class InferencePipelineRowUpdateParamsTest { .build() val expected = QueryParams.builder() expected.put("inferenceId", "inferenceId") - assertThat(params.getQueryParams()).isEqualTo(expected.build()) + assertThat(params._queryParams()).isEqualTo(expected.build()) } @Test - fun getQueryParamsWithoutOptionalFields() { + fun queryParamsWithoutOptionalFields() { val params = InferencePipelineRowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -59,11 +58,11 @@ class InferencePipelineRowUpdateParamsTest { .build() val expected = QueryParams.builder() expected.put("inferenceId", "inferenceId") - assertThat(params.getQueryParams()).isEqualTo(expected.build()) + assertThat(params._queryParams()).isEqualTo(expected.build()) } @Test - fun getBody() { + fun body() { val params = InferencePipelineRowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -73,21 +72,21 @@ class InferencePipelineRowUpdateParamsTest { InferencePipelineRowUpdateParams.Config.builder() .groundTruthColumnName("ground_truth") .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") .latencyColumnName("latency") .timestampColumnName("timestamp") .build() ) .build() - val body = params.getBody() - assertThat(body).isNotNull + + val body = params._body() + + assertNotNull(body) assertThat(body._row()).isEqualTo(JsonValue.from(mapOf())) assertThat(body.config()) .contains( InferencePipelineRowUpdateParams.Config.builder() .groundTruthColumnName("ground_truth") .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") .latencyColumnName("latency") .timestampColumnName("timestamp") .build() @@ -95,15 +94,17 @@ class InferencePipelineRowUpdateParamsTest { } @Test - fun getBodyWithoutOptionalFields() { + fun bodyWithoutOptionalFields() { val params = InferencePipelineRowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .inferenceId("inferenceId") .row(JsonValue.from(mapOf())) .build() - val body = params.getBody() - assertThat(body).isNotNull + + val body = params._body() + + assertNotNull(body) assertThat(body._row()).isEqualTo(JsonValue.from(mapOf())) } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt index b15691d9..ed330120 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test class InferencePipelineTestResultListParamsTest { @Test - fun createInferencePipelineTestResultListParams() { + fun create() { InferencePipelineTestResultListParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .page(1L) @@ -20,7 +20,7 @@ class InferencePipelineTestResultListParamsTest { } @Test - fun getQueryParams() { + fun queryParams() { val params = InferencePipelineTestResultListParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -34,17 +34,17 @@ class InferencePipelineTestResultListParamsTest { expected.put("perPage", "1") expected.put("status", InferencePipelineTestResultListParams.Status.RUNNING.toString()) expected.put("type", InferencePipelineTestResultListParams.Type.INTEGRITY.toString()) - assertThat(params.getQueryParams()).isEqualTo(expected.build()) + assertThat(params._queryParams()).isEqualTo(expected.build()) } @Test - fun getQueryParamsWithoutOptionalFields() { + fun queryParamsWithoutOptionalFields() { val params = InferencePipelineTestResultListParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() val expected = QueryParams.builder() - assertThat(params.getQueryParams()).isEqualTo(expected.build()) + assertThat(params._queryParams()).isEqualTo(expected.build()) } @Test diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateParamsTest.kt index 4a4febec..bf3959eb 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateParamsTest.kt @@ -2,13 +2,14 @@ package com.openlayer.api.models +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test class InferencePipelineUpdateParamsTest { @Test - fun createInferencePipelineUpdateParams() { + fun create() { InferencePipelineUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .description("This pipeline is used for production.") @@ -18,7 +19,7 @@ class InferencePipelineUpdateParamsTest { } @Test - fun getBody() { + fun body() { val params = InferencePipelineUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -26,21 +27,25 @@ class InferencePipelineUpdateParamsTest { .name("production") .referenceDatasetUri("referenceDatasetUri") .build() - val body = params.getBody() - assertThat(body).isNotNull + + val body = params._body() + + assertNotNull(body) assertThat(body.description()).contains("This pipeline is used for production.") assertThat(body.name()).contains("production") assertThat(body.referenceDatasetUri()).contains("referenceDatasetUri") } @Test - fun getBodyWithoutOptionalFields() { + fun bodyWithoutOptionalFields() { val params = InferencePipelineUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() - val body = params.getBody() - assertThat(body).isNotNull + + val body = params._body() + + assertNotNull(body) } @Test diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitCreateParamsTest.kt index 5655594d..fcfd261a 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitCreateParamsTest.kt @@ -2,68 +2,209 @@ package com.openlayer.api.models +import java.time.OffsetDateTime +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test class ProjectCommitCreateParamsTest { @Test - fun createProjectCommitCreateParams() { + fun create() { ProjectCommitCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( - ProjectCommitCreateParams.Commit.builder().message("Updated the prompt.").build() + ProjectCommitCreateParams.Commit.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .fileSize(1024L) + .message("Updated the prompt.") + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .storageUri("s3://...") + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .gitCommitRef("main") + .gitCommitSha(0L) + .gitCommitUrl("gitCommitUrl") + .build() ) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(1L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectCommitCreateParams.Status.QUEUED) + .statusMessage("Commit successfully processed.") .storageUri("s3://...") + .totalGoalCount(6L) + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .archived(false) .deploymentStatus("Deployed") + .links( + ProjectCommitCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) .build() } @Test - fun getBody() { + fun body() { val params = ProjectCommitCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( ProjectCommitCreateParams.Commit.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .fileSize(1024L) .message("Updated the prompt.") + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .storageUri("s3://...") + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .gitCommitRef("main") + .gitCommitSha(0L) + .gitCommitUrl("gitCommitUrl") .build() ) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(1L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectCommitCreateParams.Status.QUEUED) + .statusMessage("Commit successfully processed.") .storageUri("s3://...") + .totalGoalCount(6L) + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .archived(false) .deploymentStatus("Deployed") + .links( + ProjectCommitCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) .build() - val body = params.getBody() - assertThat(body).isNotNull + + val body = params._body() + + assertNotNull(body) + assertThat(body.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.commit()) .isEqualTo( - ProjectCommitCreateParams.Commit.builder().message("Updated the prompt.").build() + ProjectCommitCreateParams.Commit.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .fileSize(1024L) + .message("Updated the prompt.") + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .storageUri("s3://...") + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .gitCommitRef("main") + .gitCommitSha(0L) + .gitCommitUrl("gitCommitUrl") + .build() ) + assertThat(body.dateArchived()).contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.dateCreated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.failingGoalCount()).isEqualTo(1L) + assertThat(body.mlModelId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.passingGoalCount()).isEqualTo(5L) + assertThat(body.projectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.status()).isEqualTo(ProjectCommitCreateParams.Status.QUEUED) + assertThat(body.statusMessage()).contains("Commit successfully processed.") assertThat(body.storageUri()).isEqualTo("s3://...") + assertThat(body.totalGoalCount()).isEqualTo(6L) + assertThat(body.trainingDatasetId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.validationDatasetId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.archived()).contains(false) assertThat(body.deploymentStatus()).contains("Deployed") + assertThat(body.links()) + .contains( + ProjectCommitCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) } @Test - fun getBodyWithoutOptionalFields() { + fun bodyWithoutOptionalFields() { val params = ProjectCommitCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( ProjectCommitCreateParams.Commit.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .fileSize(1024L) .message("Updated the prompt.") + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .storageUri("s3://...") + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .build() ) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(1L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectCommitCreateParams.Status.QUEUED) + .statusMessage("Commit successfully processed.") .storageUri("s3://...") + .totalGoalCount(6L) + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .build() - val body = params.getBody() - assertThat(body).isNotNull + + val body = params._body() + + assertNotNull(body) + assertThat(body.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.commit()) .isEqualTo( - ProjectCommitCreateParams.Commit.builder().message("Updated the prompt.").build() + ProjectCommitCreateParams.Commit.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .fileSize(1024L) + .message("Updated the prompt.") + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .storageUri("s3://...") + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() ) + assertThat(body.dateArchived()).contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.dateCreated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.failingGoalCount()).isEqualTo(1L) + assertThat(body.mlModelId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.passingGoalCount()).isEqualTo(5L) + assertThat(body.projectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.status()).isEqualTo(ProjectCommitCreateParams.Status.QUEUED) + assertThat(body.statusMessage()).contains("Commit successfully processed.") assertThat(body.storageUri()).isEqualTo("s3://...") + assertThat(body.totalGoalCount()).isEqualTo(6L) + assertThat(body.trainingDatasetId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.validationDatasetId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") } @Test @@ -71,12 +212,31 @@ class ProjectCommitCreateParamsTest { val params = ProjectCommitCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( ProjectCommitCreateParams.Commit.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .fileSize(1024L) .message("Updated the prompt.") + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .storageUri("s3://...") + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .build() ) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(1L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectCommitCreateParams.Status.QUEUED) + .statusMessage("Commit successfully processed.") .storageUri("s3://...") + .totalGoalCount(6L) + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .build() assertThat(params).isNotNull // path param "projectId" diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListParamsTest.kt index 563b800b..2f03497e 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListParamsTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test class ProjectCommitListParamsTest { @Test - fun createProjectCommitListParams() { + fun create() { ProjectCommitListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .page(1L) @@ -18,7 +18,7 @@ class ProjectCommitListParamsTest { } @Test - fun getQueryParams() { + fun queryParams() { val params = ProjectCommitListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -28,17 +28,17 @@ class ProjectCommitListParamsTest { val expected = QueryParams.builder() expected.put("page", "1") expected.put("perPage", "1") - assertThat(params.getQueryParams()).isEqualTo(expected.build()) + assertThat(params._queryParams()).isEqualTo(expected.build()) } @Test - fun getQueryParamsWithoutOptionalFields() { + fun queryParamsWithoutOptionalFields() { val params = ProjectCommitListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() val expected = QueryParams.builder() - assertThat(params.getQueryParams()).isEqualTo(expected.build()) + assertThat(params._queryParams()).isEqualTo(expected.build()) } @Test diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateParamsTest.kt index 38296e4b..95ea41fa 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateParamsTest.kt @@ -2,45 +2,192 @@ package com.openlayer.api.models +import java.time.OffsetDateTime +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test class ProjectCreateParamsTest { @Test - fun createProjectCreateParams() { + fun create() { ProjectCreateParams.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + ProjectCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) .name("My Project") + .source(ProjectCreateParams.Source.WEB) .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") + .gitRepo( + ProjectCreateParams.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) .build() } @Test - fun getBody() { + fun body() { val params = ProjectCreateParams.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + ProjectCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) .name("My Project") + .source(ProjectCreateParams.Source.WEB) .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") + .gitRepo( + ProjectCreateParams.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) .build() - val body = params.getBody() - assertThat(body).isNotNull + + val body = params._body() + + assertNotNull(body) + assertThat(body.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.creatorId()).contains("589ece63-49a2-41b4-98e1-10547761d4b0") + assertThat(body.dateCreated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.dateUpdated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.developmentGoalCount()).isEqualTo(5L) + assertThat(body.goalCount()).isEqualTo(10L) + assertThat(body.inferencePipelineCount()).isEqualTo(1L) + assertThat(body.links()) + .isEqualTo( + ProjectCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + assertThat(body.monitoringGoalCount()).isEqualTo(5L) assertThat(body.name()).isEqualTo("My Project") + assertThat(body.source()).contains(ProjectCreateParams.Source.WEB) assertThat(body.taskType()).isEqualTo(ProjectCreateParams.TaskType.LLM_BASE) + assertThat(body.versionCount()).isEqualTo(2L) + assertThat(body.workspaceId()).contains("055fddb1-261f-4654-8598-f6347ee46a09") assertThat(body.description()).contains("My project description.") + assertThat(body.gitRepo()) + .contains( + ProjectCreateParams.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) } @Test - fun getBodyWithoutOptionalFields() { + fun bodyWithoutOptionalFields() { val params = ProjectCreateParams.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + ProjectCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) .name("My Project") + .source(ProjectCreateParams.Source.WEB) .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .build() - val body = params.getBody() - assertThat(body).isNotNull + + val body = params._body() + + assertNotNull(body) + assertThat(body.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.creatorId()).contains("589ece63-49a2-41b4-98e1-10547761d4b0") + assertThat(body.dateCreated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.dateUpdated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.developmentGoalCount()).isEqualTo(5L) + assertThat(body.goalCount()).isEqualTo(10L) + assertThat(body.inferencePipelineCount()).isEqualTo(1L) + assertThat(body.links()) + .isEqualTo( + ProjectCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + assertThat(body.monitoringGoalCount()).isEqualTo(5L) assertThat(body.name()).isEqualTo("My Project") + assertThat(body.source()).contains(ProjectCreateParams.Source.WEB) assertThat(body.taskType()).isEqualTo(ProjectCreateParams.TaskType.LLM_BASE) + assertThat(body.versionCount()).isEqualTo(2L) + assertThat(body.workspaceId()).contains("055fddb1-261f-4654-8598-f6347ee46a09") } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt index 41e75dca..3821c7a5 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt @@ -2,96 +2,359 @@ package com.openlayer.api.models +import java.time.LocalDate +import java.time.OffsetDateTime +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test class ProjectInferencePipelineCreateParamsTest { @Test - fun createProjectInferencePipelineCreateParams() { + fun create() { ProjectInferencePipelineCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastSampleReceived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .description("This pipeline is used for production.") + .failingGoalCount(1L) + .links( + ProjectInferencePipelineCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) .name("production") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineCreateParams.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(6L) .project( ProjectInferencePipelineCreateParams.Project.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + ProjectInferencePipelineCreateParams.Project.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) .name("My Project") + .source(ProjectInferencePipelineCreateParams.Project.Source.WEB) .taskType(ProjectInferencePipelineCreateParams.Project.TaskType.LLM_BASE) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") + .gitRepo( + ProjectInferencePipelineCreateParams.Project.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) .build() ) .workspace( ProjectInferencePipelineCreateParams.Workspace.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .inviteCount(0L) + .memberCount(0L) .name("Openlayer") + .periodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .projectCount(0L) .slug("openlayer") - .inviteCode("inviteCode") + .status(ProjectInferencePipelineCreateParams.Workspace.Status.ACTIVE) + .addMonthlyUsage( + ProjectInferencePipelineCreateParams.Workspace.MonthlyUsage.builder() + .executionTimeMs(0L) + .monthYear(LocalDate.parse("2019-12-27")) + .predictionCount(0L) + .build() + ) .samlOnlyAccess(true) .addWildcardDomain("string") .build() ) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .build() } @Test - fun getBody() { + fun body() { val params = ProjectInferencePipelineCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastSampleReceived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .description("This pipeline is used for production.") + .failingGoalCount(1L) + .links( + ProjectInferencePipelineCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) .name("production") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineCreateParams.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(6L) .project( ProjectInferencePipelineCreateParams.Project.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + ProjectInferencePipelineCreateParams.Project.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) .name("My Project") + .source(ProjectInferencePipelineCreateParams.Project.Source.WEB) .taskType(ProjectInferencePipelineCreateParams.Project.TaskType.LLM_BASE) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") + .gitRepo( + ProjectInferencePipelineCreateParams.Project.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) .build() ) .workspace( ProjectInferencePipelineCreateParams.Workspace.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .inviteCount(0L) + .memberCount(0L) .name("Openlayer") + .periodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .projectCount(0L) .slug("openlayer") - .inviteCode("inviteCode") + .status(ProjectInferencePipelineCreateParams.Workspace.Status.ACTIVE) + .addMonthlyUsage( + ProjectInferencePipelineCreateParams.Workspace.MonthlyUsage.builder() + .executionTimeMs(0L) + .monthYear(LocalDate.parse("2019-12-27")) + .predictionCount(0L) + .build() + ) .samlOnlyAccess(true) .addWildcardDomain("string") .build() ) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .build() - val body = params.getBody() - assertThat(body).isNotNull + + val body = params._body() + + assertNotNull(body) + assertThat(body.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.dateCreated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.dateLastEvaluated()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.dateLastSampleReceived()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.dateOfNextEvaluation()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.dateUpdated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) assertThat(body.description()).contains("This pipeline is used for production.") + assertThat(body.failingGoalCount()).isEqualTo(1L) + assertThat(body.links()) + .isEqualTo( + ProjectInferencePipelineCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) assertThat(body.name()).isEqualTo("production") + assertThat(body.passingGoalCount()).isEqualTo(5L) + assertThat(body.projectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.status()).isEqualTo(ProjectInferencePipelineCreateParams.Status.QUEUED) + assertThat(body.statusMessage()).contains("Tests successfully evaluated") + assertThat(body.totalGoalCount()).isEqualTo(6L) assertThat(body.project()) .contains( ProjectInferencePipelineCreateParams.Project.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + ProjectInferencePipelineCreateParams.Project.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) .name("My Project") + .source(ProjectInferencePipelineCreateParams.Project.Source.WEB) .taskType(ProjectInferencePipelineCreateParams.Project.TaskType.LLM_BASE) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") + .gitRepo( + ProjectInferencePipelineCreateParams.Project.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) .build() ) assertThat(body.workspace()) .contains( ProjectInferencePipelineCreateParams.Workspace.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .inviteCount(0L) + .memberCount(0L) .name("Openlayer") + .periodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .projectCount(0L) .slug("openlayer") - .inviteCode("inviteCode") + .status(ProjectInferencePipelineCreateParams.Workspace.Status.ACTIVE) + .addMonthlyUsage( + ProjectInferencePipelineCreateParams.Workspace.MonthlyUsage.builder() + .executionTimeMs(0L) + .monthYear(LocalDate.parse("2019-12-27")) + .predictionCount(0L) + .build() + ) .samlOnlyAccess(true) .addWildcardDomain("string") .build() ) + assertThat(body.workspaceId()).contains("055fddb1-261f-4654-8598-f6347ee46a09") } @Test - fun getBodyWithoutOptionalFields() { + fun bodyWithoutOptionalFields() { val params = ProjectInferencePipelineCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastSampleReceived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .description("This pipeline is used for production.") + .failingGoalCount(1L) + .links( + ProjectInferencePipelineCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) .name("production") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineCreateParams.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(6L) .build() - val body = params.getBody() - assertThat(body).isNotNull + + val body = params._body() + + assertNotNull(body) + assertThat(body.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.dateCreated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.dateLastEvaluated()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.dateLastSampleReceived()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.dateOfNextEvaluation()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.dateUpdated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) assertThat(body.description()).contains("This pipeline is used for production.") + assertThat(body.failingGoalCount()).isEqualTo(1L) + assertThat(body.links()) + .isEqualTo( + ProjectInferencePipelineCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) assertThat(body.name()).isEqualTo("production") + assertThat(body.passingGoalCount()).isEqualTo(5L) + assertThat(body.projectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.status()).isEqualTo(ProjectInferencePipelineCreateParams.Status.QUEUED) + assertThat(body.statusMessage()).contains("Tests successfully evaluated") + assertThat(body.totalGoalCount()).isEqualTo(6L) } @Test @@ -99,8 +362,27 @@ class ProjectInferencePipelineCreateParamsTest { val params = ProjectInferencePipelineCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastSampleReceived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .description("This pipeline is used for production.") + .failingGoalCount(1L) + .links( + ProjectInferencePipelineCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) .name("production") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineCreateParams.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(6L) .build() assertThat(params).isNotNull // path param "projectId" diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParamsTest.kt index 951afbc1..8a1b5d23 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParamsTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test class ProjectInferencePipelineListParamsTest { @Test - fun createProjectInferencePipelineListParams() { + fun create() { ProjectInferencePipelineListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .name("name") @@ -19,7 +19,7 @@ class ProjectInferencePipelineListParamsTest { } @Test - fun getQueryParams() { + fun queryParams() { val params = ProjectInferencePipelineListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -31,17 +31,17 @@ class ProjectInferencePipelineListParamsTest { expected.put("name", "name") expected.put("page", "1") expected.put("perPage", "1") - assertThat(params.getQueryParams()).isEqualTo(expected.build()) + assertThat(params._queryParams()).isEqualTo(expected.build()) } @Test - fun getQueryParamsWithoutOptionalFields() { + fun queryParamsWithoutOptionalFields() { val params = ProjectInferencePipelineListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() val expected = QueryParams.builder() - assertThat(params.getQueryParams()).isEqualTo(expected.build()) + assertThat(params._queryParams()).isEqualTo(expected.build()) } @Test diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListParamsTest.kt index f7f63bf8..7b4ae1fd 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListParamsTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test class ProjectListParamsTest { @Test - fun createProjectListParams() { + fun create() { ProjectListParams.builder() .name("name") .page(1L) @@ -19,7 +19,7 @@ class ProjectListParamsTest { } @Test - fun getQueryParams() { + fun queryParams() { val params = ProjectListParams.builder() .name("name") @@ -32,13 +32,13 @@ class ProjectListParamsTest { expected.put("page", "1") expected.put("perPage", "1") expected.put("taskType", ProjectListParams.TaskType.LLM_BASE.toString()) - assertThat(params.getQueryParams()).isEqualTo(expected.build()) + assertThat(params._queryParams()).isEqualTo(expected.build()) } @Test - fun getQueryParamsWithoutOptionalFields() { + fun queryParamsWithoutOptionalFields() { val params = ProjectListParams.builder().build() val expected = QueryParams.builder() - assertThat(params.getQueryParams()).isEqualTo(expected.build()) + assertThat(params._queryParams()).isEqualTo(expected.build()) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParamsTest.kt index d62003ac..8b212850 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParamsTest.kt @@ -9,23 +9,23 @@ import org.junit.jupiter.api.Test class StoragePresignedUrlCreateParamsTest { @Test - fun createStoragePresignedUrlCreateParams() { + fun create() { StoragePresignedUrlCreateParams.builder().objectName("objectName").build() } @Test - fun getQueryParams() { + fun queryParams() { val params = StoragePresignedUrlCreateParams.builder().objectName("objectName").build() val expected = QueryParams.builder() expected.put("objectName", "objectName") - assertThat(params.getQueryParams()).isEqualTo(expected.build()) + assertThat(params._queryParams()).isEqualTo(expected.build()) } @Test - fun getQueryParamsWithoutOptionalFields() { + fun queryParamsWithoutOptionalFields() { val params = StoragePresignedUrlCreateParams.builder().objectName("objectName").build() val expected = QueryParams.builder() expected.put("objectName", "objectName") - assertThat(params.getQueryParams()).isEqualTo(expected.build()) + assertThat(params._queryParams()).isEqualTo(expected.build()) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt index 1508c204..53253412 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt @@ -242,7 +242,7 @@ class ErrorHandlingTest { assertPermissionDenied( e, Headers.builder().put("Foo", "Bar").build(), - OPENLAYER_ERROR + OPENLAYER_ERROR, ) }) } @@ -342,7 +342,7 @@ class ErrorHandlingTest { assertUnprocessableEntity( e, Headers.builder().put("Foo", "Bar").build(), - OPENLAYER_ERROR + OPENLAYER_ERROR, ) }) } @@ -442,7 +442,7 @@ class ErrorHandlingTest { assertInternalServer( e, Headers.builder().put("Foo", "Bar").build(), - OPENLAYER_ERROR + OPENLAYER_ERROR, ) }) } @@ -495,7 +495,7 @@ class ErrorHandlingTest { e, 999, Headers.builder().put("Foo", "Bar").build(), - toJson(OPENLAYER_ERROR) + toJson(OPENLAYER_ERROR), ) }) } @@ -600,7 +600,7 @@ class ErrorHandlingTest { throwable: Throwable, statusCode: Int, headers: Headers, - responseBody: ByteArray + responseBody: ByteArray, ) { assertThat(throwable) .asInstanceOf( @@ -636,7 +636,7 @@ class ErrorHandlingTest { private fun assertPermissionDenied( throwable: Throwable, headers: Headers, - error: OpenlayerError + error: OpenlayerError, ) { assertThat(throwable) .asInstanceOf( @@ -662,7 +662,7 @@ class ErrorHandlingTest { private fun assertUnprocessableEntity( throwable: Throwable, headers: Headers, - error: OpenlayerError + error: OpenlayerError, ) { assertThat(throwable) .asInstanceOf( @@ -688,7 +688,7 @@ class ErrorHandlingTest { private fun assertInternalServer( throwable: Throwable, headers: Headers, - error: OpenlayerError + error: OpenlayerError, ) { assertThat(throwable) .asInstanceOf(InstanceOfAssertFactories.throwable(InternalServerException::class.java)) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt index c947464b..3b817ef5 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt @@ -2,7 +2,6 @@ package com.openlayer.api.services -import com.fasterxml.jackson.databind.json.JsonMapper import com.github.tomakehurst.wiremock.client.WireMock.anyUrl import com.github.tomakehurst.wiremock.client.WireMock.equalTo import com.github.tomakehurst.wiremock.client.WireMock.matchingJsonPath @@ -16,16 +15,12 @@ import com.github.tomakehurst.wiremock.junit5.WireMockTest import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.jsonMapper import com.openlayer.api.models.InferencePipelineDataStreamParams -import com.openlayer.api.models.InferencePipelineDataStreamResponse import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test @WireMockTest -class ServiceParamsTest { - - private val JSON_MAPPER: JsonMapper = jsonMapper() +internal class ServiceParamsTest { private lateinit var client: OpenlayerClient @@ -33,26 +28,17 @@ class ServiceParamsTest { fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { client = OpenlayerOkHttpClient.builder() + .baseUrl(wmRuntimeInfo.httpBaseUrl) .apiKey("My API Key") - .baseUrl(wmRuntimeInfo.getHttpBaseUrl()) .build() } @Test - fun dataStreamWithAdditionalParams() { - val additionalHeaders = mutableMapOf>() - - additionalHeaders.put("x-test-header", listOf("abc1234")) - - val additionalQueryParams = mutableMapOf>() - - additionalQueryParams.put("test_query_param", listOf("def567")) - - val additionalBodyProperties = mutableMapOf() - - additionalBodyProperties.put("testBodyProperty", JsonValue.from("ghi890")) + fun stream() { + val dataService = client.inferencePipelines().data() + stubFor(post(anyUrl()).willReturn(ok("{}"))) - val params = + dataService.stream( InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( @@ -85,26 +71,17 @@ class ServiceParamsTest { .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .additionalHeaders(additionalHeaders) - .additionalBodyProperties(additionalBodyProperties) - .additionalQueryParams(additionalQueryParams) + .putAdditionalHeader("Secret-Header", "42") + .putAdditionalQueryParam("secret_query_param", "42") + .putAdditionalBodyProperty("secretProperty", JsonValue.from("42")) .build() - - val apiResponse = - InferencePipelineDataStreamResponse.builder() - .success(InferencePipelineDataStreamResponse.Success.TRUE) - .build() - - stubFor( - post(anyUrl()) - .withHeader("x-test-header", equalTo("abc1234")) - .withQueryParam("test_query_param", equalTo("def567")) - .withRequestBody(matchingJsonPath("$.testBodyProperty", equalTo("ghi890"))) - .willReturn(ok(JSON_MAPPER.writeValueAsString(apiResponse))) ) - client.inferencePipelines().data().stream(params) - - verify(postRequestedFor(anyUrl())) + verify( + postRequestedFor(anyUrl()) + .withHeader("Secret-Header", equalTo("42")) + .withQueryParam("secret_query_param", equalTo("42")) + .withRequestBody(matchingJsonPath("$.secretProperty", equalTo("42"))) + ) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncTest.kt new file mode 100644 index 00000000..16fa15ac --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncTest.kt @@ -0,0 +1,78 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.models.InferencePipelineDeleteParams +import com.openlayer.api.models.InferencePipelineRetrieveParams +import com.openlayer.api.models.InferencePipelineUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class InferencePipelineServiceAsyncTest { + + @Test + fun retrieve() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val inferencePipelineServiceAsync = client.inferencePipelines() + + val inferencePipelineFuture = + inferencePipelineServiceAsync.retrieve( + InferencePipelineRetrieveParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addExpand(InferencePipelineRetrieveParams.Expand.PROJECT) + .build() + ) + + val inferencePipeline = inferencePipelineFuture.get() + inferencePipeline.validate() + } + + @Test + fun update() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val inferencePipelineServiceAsync = client.inferencePipelines() + + val inferencePipelineFuture = + inferencePipelineServiceAsync.update( + InferencePipelineUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("This pipeline is used for production.") + .name("production") + .referenceDatasetUri("referenceDatasetUri") + .build() + ) + + val inferencePipeline = inferencePipelineFuture.get() + inferencePipeline.validate() + } + + @Test + fun delete() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val inferencePipelineServiceAsync = client.inferencePipelines() + + val future = + inferencePipelineServiceAsync.delete( + InferencePipelineDeleteParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + + val response = future.get() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncTest.kt new file mode 100644 index 00000000..f796c2c0 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncTest.kt @@ -0,0 +1,94 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.models.ProjectCreateParams +import com.openlayer.api.models.ProjectListParams +import java.time.OffsetDateTime +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class ProjectServiceAsyncTest { + + @Test + fun create() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val projectServiceAsync = client.projects() + + val projectFuture = + projectServiceAsync.create( + ProjectCreateParams.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + ProjectCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) + .name("My Project") + .source(ProjectCreateParams.Source.WEB) + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .description("My project description.") + .gitRepo( + ProjectCreateParams.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .build() + ) + + val project = projectFuture.get() + project.validate() + } + + @Test + fun list() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val projectServiceAsync = client.projects() + + val projectFuture = + projectServiceAsync.list( + ProjectListParams.builder() + .name("name") + .page(1L) + .perPage(1L) + .taskType(ProjectListParams.TaskType.LLM_BASE) + .build() + ) + + val project = projectFuture.get() + project.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt new file mode 100644 index 00000000..d40b3c3e --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt @@ -0,0 +1,38 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.commits + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.models.CommitTestResultListParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class TestResultServiceAsyncTest { + + @Test + fun list() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val testResultServiceAsync = client.commits().testResults() + + val testResultFuture = + testResultServiceAsync.list( + CommitTestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeArchived(true) + .page(1L) + .perPage(1L) + .status(CommitTestResultListParams.Status.RUNNING) + .type(CommitTestResultListParams.Type.INTEGRITY) + .build() + ) + + val testResult = testResultFuture.get() + testResult.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncTest.kt new file mode 100644 index 00000000..6c949cfa --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncTest.kt @@ -0,0 +1,64 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.inferencePipelines + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.InferencePipelineDataStreamParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class DataServiceAsyncTest { + + @Test + fun stream() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val dataServiceAsync = client.inferencePipelines().data() + + val responseFuture = + dataServiceAsync.stream( + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() + ) + .build() + ) + + val response = responseFuture.get() + response.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncTest.kt new file mode 100644 index 00000000..4da1d56d --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncTest.kt @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.inferencePipelines + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.InferencePipelineRowUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class RowServiceAsyncTest { + + @Test + fun update() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val rowServiceAsync = client.inferencePipelines().rows() + + val rowFuture = + rowServiceAsync.update( + InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .inferenceId("inferenceId") + .row(JsonValue.from(mapOf())) + .config( + InferencePipelineRowUpdateParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build() + ) + .build() + ) + + val row = rowFuture.get() + row.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncTest.kt new file mode 100644 index 00000000..6cd49817 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncTest.kt @@ -0,0 +1,37 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.inferencePipelines + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.models.InferencePipelineTestResultListParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class TestResultServiceAsyncTest { + + @Test + fun list() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val testResultServiceAsync = client.inferencePipelines().testResults() + + val testResultFuture = + testResultServiceAsync.list( + InferencePipelineTestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .status(InferencePipelineTestResultListParams.Status.RUNNING) + .type(InferencePipelineTestResultListParams.Type.INTEGRITY) + .build() + ) + + val testResult = testResultFuture.get() + testResult.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt new file mode 100644 index 00000000..09172768 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt @@ -0,0 +1,95 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.projects + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.models.ProjectCommitCreateParams +import com.openlayer.api.models.ProjectCommitListParams +import java.time.OffsetDateTime +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class CommitServiceAsyncTest { + + @Test + fun create() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val commitServiceAsync = client.projects().commits() + + val commitFuture = + commitServiceAsync.create( + ProjectCommitCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commit( + ProjectCommitCreateParams.Commit.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .fileSize(1024L) + .message("Updated the prompt.") + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .storageUri("s3://...") + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .gitCommitRef("main") + .gitCommitSha(0L) + .gitCommitUrl("gitCommitUrl") + .build() + ) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(1L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectCommitCreateParams.Status.QUEUED) + .statusMessage("Commit successfully processed.") + .storageUri("s3://...") + .totalGoalCount(6L) + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .archived(false) + .deploymentStatus("Deployed") + .links( + ProjectCommitCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .build() + ) + + val commit = commitFuture.get() + commit.validate() + } + + @Test + fun list() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val commitServiceAsync = client.projects().commits() + + val commitFuture = + commitServiceAsync.list( + ProjectCommitListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + ) + + val commit = commitFuture.get() + commit.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt new file mode 100644 index 00000000..99ca1060 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt @@ -0,0 +1,150 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.projects + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.models.ProjectInferencePipelineCreateParams +import com.openlayer.api.models.ProjectInferencePipelineListParams +import java.time.LocalDate +import java.time.OffsetDateTime +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class InferencePipelineServiceAsyncTest { + + @Test + fun create() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val inferencePipelineServiceAsync = client.projects().inferencePipelines() + + val inferencePipelineFuture = + inferencePipelineServiceAsync.create( + ProjectInferencePipelineCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastSampleReceived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description("This pipeline is used for production.") + .failingGoalCount(1L) + .links( + ProjectInferencePipelineCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .name("production") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineCreateParams.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(6L) + .project( + ProjectInferencePipelineCreateParams.Project.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + ProjectInferencePipelineCreateParams.Project.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) + .name("My Project") + .source(ProjectInferencePipelineCreateParams.Project.Source.WEB) + .taskType( + ProjectInferencePipelineCreateParams.Project.TaskType.LLM_BASE + ) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .description("My project description.") + .gitRepo( + ProjectInferencePipelineCreateParams.Project.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .build() + ) + .workspace( + ProjectInferencePipelineCreateParams.Workspace.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .inviteCount(0L) + .memberCount(0L) + .name("Openlayer") + .periodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .projectCount(0L) + .slug("openlayer") + .status(ProjectInferencePipelineCreateParams.Workspace.Status.ACTIVE) + .addMonthlyUsage( + ProjectInferencePipelineCreateParams.Workspace.MonthlyUsage + .builder() + .executionTimeMs(0L) + .monthYear(LocalDate.parse("2019-12-27")) + .predictionCount(0L) + .build() + ) + .samlOnlyAccess(true) + .addWildcardDomain("string") + .build() + ) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .build() + ) + + val inferencePipeline = inferencePipelineFuture.get() + inferencePipeline.validate() + } + + @Test + fun list() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val inferencePipelineServiceAsync = client.projects().inferencePipelines() + + val inferencePipelineFuture = + inferencePipelineServiceAsync.list( + ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("name") + .page(1L) + .perPage(1L) + .build() + ) + + val inferencePipeline = inferencePipelineFuture.get() + inferencePipeline.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncTest.kt new file mode 100644 index 00000000..e05b3955 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncTest.kt @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.storage + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.models.StoragePresignedUrlCreateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class PresignedUrlServiceAsyncTest { + + @Test + fun create() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val presignedUrlServiceAsync = client.storage().presignedUrl() + + val presignedUrlFuture = + presignedUrlServiceAsync.create( + StoragePresignedUrlCreateParams.builder().objectName("objectName").build() + ) + + val presignedUrl = presignedUrlFuture.get() + presignedUrl.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt index f2436f35..5bc78f55 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt @@ -14,33 +14,35 @@ import org.junit.jupiter.api.extension.ExtendWith class InferencePipelineServiceTest { @Test - fun callRetrieve() { + fun retrieve() { val client = OpenlayerOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val inferencePipelineService = client.inferencePipelines() - val inferencePipelineRetrieveResponse = + + val inferencePipeline = inferencePipelineService.retrieve( InferencePipelineRetrieveParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addExpand(InferencePipelineRetrieveParams.Expand.PROJECT) .build() ) - println(inferencePipelineRetrieveResponse) - inferencePipelineRetrieveResponse.validate() + + inferencePipeline.validate() } @Test - fun callUpdate() { + fun update() { val client = OpenlayerOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val inferencePipelineService = client.inferencePipelines() - val inferencePipelineUpdateResponse = + + val inferencePipeline = inferencePipelineService.update( InferencePipelineUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -49,18 +51,19 @@ class InferencePipelineServiceTest { .referenceDatasetUri("referenceDatasetUri") .build() ) - println(inferencePipelineUpdateResponse) - inferencePipelineUpdateResponse.validate() + + inferencePipeline.validate() } @Test - fun callDelete() { + fun delete() { val client = OpenlayerOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val inferencePipelineService = client.inferencePipelines() + inferencePipelineService.delete( InferencePipelineDeleteParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt index 13aea9ff..26399d17 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt @@ -6,6 +6,7 @@ import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.ProjectCreateParams import com.openlayer.api.models.ProjectListParams +import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -13,34 +14,70 @@ import org.junit.jupiter.api.extension.ExtendWith class ProjectServiceTest { @Test - fun callCreate() { + fun create() { val client = OpenlayerOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val projectService = client.projects() - val projectCreateResponse = + + val project = projectService.create( ProjectCreateParams.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + ProjectCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) .name("My Project") + .source(ProjectCreateParams.Source.WEB) .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") + .gitRepo( + ProjectCreateParams.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) .build() ) - println(projectCreateResponse) - projectCreateResponse.validate() + + project.validate() } @Test - fun callList() { + fun list() { val client = OpenlayerOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val projectService = client.projects() - val projectListResponse = + + val project = projectService.list( ProjectListParams.builder() .name("name") @@ -49,7 +86,7 @@ class ProjectServiceTest { .taskType(ProjectListParams.TaskType.LLM_BASE) .build() ) - println(projectListResponse) - projectListResponse.validate() + + project.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt index 0cdb2624..bcdc37b8 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt @@ -12,14 +12,15 @@ import org.junit.jupiter.api.extension.ExtendWith class TestResultServiceTest { @Test - fun callList() { + fun list() { val client = OpenlayerOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val testResultService = client.commits().testResults() - val commitTestResultListResponse = + + val testResult = testResultService.list( CommitTestResultListParams.builder() .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -30,7 +31,7 @@ class TestResultServiceTest { .type(CommitTestResultListParams.Type.INTEGRITY) .build() ) - println(commitTestResultListResponse) - commitTestResultListResponse.validate() + + testResult.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceTest.kt index 4cfc44ab..e0e48a38 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceTest.kt @@ -13,14 +13,15 @@ import org.junit.jupiter.api.extension.ExtendWith class DataServiceTest { @Test - fun callStream() { + fun stream() { val client = OpenlayerOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val dataService = client.inferencePipelines().data() - val inferencePipelineDataStreamResponse = + + val response = dataService.stream( InferencePipelineDataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -56,7 +57,7 @@ class DataServiceTest { ) .build() ) - println(inferencePipelineDataStreamResponse) - inferencePipelineDataStreamResponse.validate() + + response.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceTest.kt index dacce1df..221221e3 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceTest.kt @@ -13,14 +13,15 @@ import org.junit.jupiter.api.extension.ExtendWith class RowServiceTest { @Test - fun callUpdate() { + fun update() { val client = OpenlayerOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val rowService = client.inferencePipelines().rows() - val inferencePipelineRowUpdateResponse = + + val row = rowService.update( InferencePipelineRowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -30,14 +31,13 @@ class RowServiceTest { InferencePipelineRowUpdateParams.Config.builder() .groundTruthColumnName("ground_truth") .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") .latencyColumnName("latency") .timestampColumnName("timestamp") .build() ) .build() ) - println(inferencePipelineRowUpdateResponse) - inferencePipelineRowUpdateResponse.validate() + + row.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceTest.kt index 21524e9f..05acf486 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceTest.kt @@ -12,14 +12,15 @@ import org.junit.jupiter.api.extension.ExtendWith class TestResultServiceTest { @Test - fun callList() { + fun list() { val client = OpenlayerOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val testResultService = client.inferencePipelines().testResults() - val inferencePipelineTestResultListResponse = + + val testResult = testResultService.list( InferencePipelineTestResultListParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -29,7 +30,7 @@ class TestResultServiceTest { .type(InferencePipelineTestResultListParams.Type.INTEGRITY) .build() ) - println(inferencePipelineTestResultListResponse) - inferencePipelineTestResultListResponse.validate() + + testResult.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt index 452f62fa..34211f99 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt @@ -6,6 +6,7 @@ import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.ProjectCommitCreateParams import com.openlayer.api.models.ProjectCommitListParams +import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -13,40 +14,72 @@ import org.junit.jupiter.api.extension.ExtendWith class CommitServiceTest { @Test - fun callCreate() { + fun create() { val client = OpenlayerOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val commitService = client.projects().commits() - val projectCommitCreateResponse = + + val commit = commitService.create( ProjectCommitCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( ProjectCommitCreateParams.Commit.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .fileSize(1024L) .message("Updated the prompt.") + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .storageUri("s3://...") + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .gitCommitRef("main") + .gitCommitSha(0L) + .gitCommitUrl("gitCommitUrl") .build() ) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(1L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectCommitCreateParams.Status.QUEUED) + .statusMessage("Commit successfully processed.") .storageUri("s3://...") + .totalGoalCount(6L) + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .archived(false) .deploymentStatus("Deployed") + .links( + ProjectCommitCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) .build() ) - println(projectCommitCreateResponse) - projectCommitCreateResponse.validate() + + commit.validate() } @Test - fun callList() { + fun list() { val client = OpenlayerOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val commitService = client.projects().commits() - val projectCommitListResponse = + + val commit = commitService.list( ProjectCommitListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -54,7 +87,7 @@ class CommitServiceTest { .perPage(1L) .build() ) - println(projectCommitListResponse) - projectCommitListResponse.validate() + + commit.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt index e8af5cb7..b1a86009 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt @@ -6,6 +6,8 @@ import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.ProjectInferencePipelineCreateParams import com.openlayer.api.models.ProjectInferencePipelineListParams +import java.time.LocalDate +import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -13,52 +15,125 @@ import org.junit.jupiter.api.extension.ExtendWith class InferencePipelineServiceTest { @Test - fun callCreate() { + fun create() { val client = OpenlayerOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val inferencePipelineService = client.projects().inferencePipelines() - val projectInferencePipelineCreateResponse = + + val inferencePipeline = inferencePipelineService.create( ProjectInferencePipelineCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastSampleReceived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .description("This pipeline is used for production.") + .failingGoalCount(1L) + .links( + ProjectInferencePipelineCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) .name("production") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineCreateParams.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(6L) .project( ProjectInferencePipelineCreateParams.Project.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + ProjectInferencePipelineCreateParams.Project.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) .name("My Project") + .source(ProjectInferencePipelineCreateParams.Project.Source.WEB) .taskType( ProjectInferencePipelineCreateParams.Project.TaskType.LLM_BASE ) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") + .gitRepo( + ProjectInferencePipelineCreateParams.Project.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) .build() ) .workspace( ProjectInferencePipelineCreateParams.Workspace.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .inviteCount(0L) + .memberCount(0L) .name("Openlayer") + .periodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .projectCount(0L) .slug("openlayer") - .inviteCode("inviteCode") + .status(ProjectInferencePipelineCreateParams.Workspace.Status.ACTIVE) + .addMonthlyUsage( + ProjectInferencePipelineCreateParams.Workspace.MonthlyUsage + .builder() + .executionTimeMs(0L) + .monthYear(LocalDate.parse("2019-12-27")) + .predictionCount(0L) + .build() + ) .samlOnlyAccess(true) .addWildcardDomain("string") .build() ) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .build() ) - println(projectInferencePipelineCreateResponse) - projectInferencePipelineCreateResponse.validate() + + inferencePipeline.validate() } @Test - fun callList() { + fun list() { val client = OpenlayerOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val inferencePipelineService = client.projects().inferencePipelines() - val projectInferencePipelineListResponse = + + val inferencePipeline = inferencePipelineService.list( ProjectInferencePipelineListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -67,7 +142,7 @@ class InferencePipelineServiceTest { .perPage(1L) .build() ) - println(projectInferencePipelineListResponse) - projectInferencePipelineListResponse.validate() + + inferencePipeline.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt index c2986d3e..09338d14 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt @@ -12,18 +12,19 @@ import org.junit.jupiter.api.extension.ExtendWith class PresignedUrlServiceTest { @Test - fun callCreate() { + fun create() { val client = OpenlayerOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val presignedUrlService = client.storage().presignedUrl() - val storagePresignedUrlCreateResponse = + + val presignedUrl = presignedUrlService.create( StoragePresignedUrlCreateParams.builder().objectName("objectName").build() ) - println(storagePresignedUrlCreateResponse) - storagePresignedUrlCreateResponse.validate() + + presignedUrl.validate() } } diff --git a/scripts/format b/scripts/format index c6239fab..456a69db 100755 --- a/scripts/format +++ b/scripts/format @@ -5,4 +5,4 @@ set -e cd "$(dirname "$0")/.." echo "==> Running spotlessApply" -./gradlew --build-cache --parallel --no-daemon spotlessApply +./gradlew spotlessApply diff --git a/scripts/lint b/scripts/lint index 58753d0b..e3a5f5e2 100755 --- a/scripts/lint +++ b/scripts/lint @@ -5,4 +5,4 @@ set -e cd "$(dirname "$0")/.." echo "==> Build classes" -./gradlew --build-cache --parallel --no-daemon build testClasses -x test +./gradlew build testClasses -x test diff --git a/scripts/test b/scripts/test index 72ed0333..6b750a74 100755 --- a/scripts/test +++ b/scripts/test @@ -53,4 +53,4 @@ else fi echo "==> Running tests" -./gradlew --build-cache --parallel --no-daemon test +./gradlew test From 2fca9f1dbdc492be75166cc9727660dffd325ce8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 08:21:56 +0000 Subject: [PATCH 12/74] chore(internal): refactor `ErrorHandlingTest` --- .../api/services/ErrorHandlingTest.kt | 976 ++++++++---------- 1 file changed, 406 insertions(+), 570 deletions(-) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt index 53253412..ebf9f15a 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt @@ -2,9 +2,7 @@ package com.openlayer.api.services -import com.fasterxml.jackson.databind.json.JsonMapper import com.github.tomakehurst.wiremock.client.WireMock.anyUrl -import com.github.tomakehurst.wiremock.client.WireMock.ok import com.github.tomakehurst.wiremock.client.WireMock.post import com.github.tomakehurst.wiremock.client.WireMock.status import com.github.tomakehurst.wiremock.client.WireMock.stubFor @@ -26,20 +24,30 @@ import com.openlayer.api.errors.UnauthorizedException import com.openlayer.api.errors.UnexpectedStatusCodeException import com.openlayer.api.errors.UnprocessableEntityException import com.openlayer.api.models.InferencePipelineDataStreamParams -import com.openlayer.api.models.InferencePipelineDataStreamResponse import org.assertj.core.api.Assertions.assertThat -import org.assertj.core.api.Assertions.assertThatThrownBy -import org.assertj.core.api.InstanceOfAssertFactories +import org.assertj.core.api.Assertions.entry import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows @WireMockTest class ErrorHandlingTest { - private val JSON_MAPPER: JsonMapper = jsonMapper() + companion object { - private val OPENLAYER_ERROR: OpenlayerError = - OpenlayerError.builder().putAdditionalProperty("key", JsonValue.from("value")).build() + private val ERROR: OpenlayerError = + OpenlayerError.builder() + .putAdditionalProperty("errorProperty", JsonValue.from("42")) + .build() + + private val ERROR_JSON: ByteArray = jsonMapper().writeValueAsBytes(ERROR) + + private const val HEADER_NAME: String = "Error-Header" + + private const val HEADER_VALUE: String = "42" + + private const val NOT_JSON: String = "Not JSON" + } private lateinit var client: OpenlayerClient @@ -47,656 +55,484 @@ class ErrorHandlingTest { fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { client = OpenlayerOkHttpClient.builder() - .baseUrl(wmRuntimeInfo.getHttpBaseUrl()) + .baseUrl(wmRuntimeInfo.httpBaseUrl) .apiKey("My API Key") .build() } @Test - fun dataStream200() { - val params = - InferencePipelineDataStreamParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .addInputVariableName("user_query") - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") + fun dataStream400() { + val dataService = client.inferencePipelines().data() + stubFor( + post(anyUrl()) + .willReturn(status(400).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) + ) + + val e = + assertThrows { + dataService.stream( + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - .addRow( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .build() - - val expected = - InferencePipelineDataStreamResponse.builder() - .success(InferencePipelineDataStreamResponse.Success.TRUE) - .build() + } - stubFor(post(anyUrl()).willReturn(ok().withBody(toJson(expected)))) - - assertThat(client.inferencePipelines().data().stream(params)).isEqualTo(expected) + assertThat(e.statusCode()).isEqualTo(400) + assertThat(e.error()).isEqualTo(ERROR) + assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) } @Test - fun dataStream400() { - val params = - InferencePipelineDataStreamParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .addInputVariableName("user_query") - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - .addRow( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) - .build() - + fun dataStream401() { + val dataService = client.inferencePipelines().data() stubFor( post(anyUrl()) - .willReturn(status(400).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + .willReturn(status(401).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) ) - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> - assertBadRequest(e, Headers.builder().put("Foo", "Bar").build(), OPENLAYER_ERROR) - }) - } - - @Test - fun dataStream401() { - val params = - InferencePipelineDataStreamParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .addInputVariableName("user_query") - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") + val e = + assertThrows { + dataService.stream( + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - .addRow( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .build() + } - stubFor( - post(anyUrl()) - .willReturn(status(401).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) - ) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> - assertUnauthorized(e, Headers.builder().put("Foo", "Bar").build(), OPENLAYER_ERROR) - }) + assertThat(e.statusCode()).isEqualTo(401) + assertThat(e.error()).isEqualTo(ERROR) + assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) } @Test fun dataStream403() { - val params = - InferencePipelineDataStreamParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .addInputVariableName("user_query") - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") - .build() - ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - .addRow( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) - .build() - + val dataService = client.inferencePipelines().data() stubFor( post(anyUrl()) - .willReturn(status(403).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + .willReturn(status(403).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) ) - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> - assertPermissionDenied( - e, - Headers.builder().put("Foo", "Bar").build(), - OPENLAYER_ERROR, - ) - }) - } - - @Test - fun dataStream404() { - val params = - InferencePipelineDataStreamParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .addInputVariableName("user_query") - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") + val e = + assertThrows { + dataService.stream( + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - .addRow( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .build() + } + assertThat(e.statusCode()).isEqualTo(403) + assertThat(e.error()).isEqualTo(ERROR) + assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + } + + @Test + fun dataStream404() { + val dataService = client.inferencePipelines().data() stubFor( post(anyUrl()) - .willReturn(status(404).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + .willReturn(status(404).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) ) - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> - assertNotFound(e, Headers.builder().put("Foo", "Bar").build(), OPENLAYER_ERROR) - }) - } - - @Test - fun dataStream422() { - val params = - InferencePipelineDataStreamParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .addInputVariableName("user_query") - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") + val e = + assertThrows { + dataService.stream( + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - .addRow( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .build() + } + assertThat(e.statusCode()).isEqualTo(404) + assertThat(e.error()).isEqualTo(ERROR) + assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + } + + @Test + fun dataStream422() { + val dataService = client.inferencePipelines().data() stubFor( post(anyUrl()) - .willReturn(status(422).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + .willReturn(status(422).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) ) - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> - assertUnprocessableEntity( - e, - Headers.builder().put("Foo", "Bar").build(), - OPENLAYER_ERROR, - ) - }) - } - - @Test - fun dataStream429() { - val params = - InferencePipelineDataStreamParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .addInputVariableName("user_query") - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") + val e = + assertThrows { + dataService.stream( + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - .addRow( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .build() + } + assertThat(e.statusCode()).isEqualTo(422) + assertThat(e.error()).isEqualTo(ERROR) + assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + } + + @Test + fun dataStream429() { + val dataService = client.inferencePipelines().data() stubFor( post(anyUrl()) - .willReturn(status(429).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + .willReturn(status(429).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) ) - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> - assertRateLimit(e, Headers.builder().put("Foo", "Bar").build(), OPENLAYER_ERROR) - }) - } - - @Test - fun dataStream500() { - val params = - InferencePipelineDataStreamParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .addInputVariableName("user_query") - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") + val e = + assertThrows { + dataService.stream( + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - .addRow( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .build() + } + + assertThat(e.statusCode()).isEqualTo(429) + assertThat(e.error()).isEqualTo(ERROR) + assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + } + @Test + fun dataStream500() { + val dataService = client.inferencePipelines().data() stubFor( post(anyUrl()) - .willReturn(status(500).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + .willReturn(status(500).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) ) - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> - assertInternalServer( - e, - Headers.builder().put("Foo", "Bar").build(), - OPENLAYER_ERROR, - ) - }) - } - - @Test - fun unexpectedStatusCode() { - val params = - InferencePipelineDataStreamParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .addInputVariableName("user_query") - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") + val e = + assertThrows { + dataService.stream( + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - .addRow( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .build() + } + + assertThat(e.statusCode()).isEqualTo(500) + assertThat(e.error()).isEqualTo(ERROR) + assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + } + @Test + fun dataStream999() { + val dataService = client.inferencePipelines().data() stubFor( post(anyUrl()) - .willReturn(status(999).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + .willReturn(status(999).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) ) - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> - assertUnexpectedStatusCodeException( - e, - 999, - Headers.builder().put("Foo", "Bar").build(), - toJson(OPENLAYER_ERROR), - ) - }) - } - - @Test - fun invalidBody() { - val params = - InferencePipelineDataStreamParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .addInputVariableName("user_query") - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") + val e = + assertThrows { + dataService.stream( + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - .addRow( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .build() - - stubFor(post(anyUrl()).willReturn(status(200).withBody("Not JSON"))) + } - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> - assertThat(e) - .isInstanceOf(OpenlayerException::class.java) - .hasMessage("Error reading response") - }) + assertThat(e.statusCode()).isEqualTo(999) + assertThat(e.error()).isEqualTo(ERROR) + assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) } @Test - fun invalidErrorBody() { - val params = - InferencePipelineDataStreamParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .contextColumnName("context") - .costColumnName("cost") - .groundTruthColumnName("ground_truth") - .inferenceIdColumnName("id") - .addInputVariableName("user_query") - .latencyColumnName("latency") - .metadata(JsonValue.from(mapOf())) - .numOfTokenColumnName("tokens") - .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() - .content("{{ user_query }}") - .role("user") + fun dataStreamInvalidJsonBody() { + val dataService = client.inferencePipelines().data() + stubFor( + post(anyUrl()) + .willReturn(status(200).withHeader(HEADER_NAME, HEADER_VALUE).withBody(NOT_JSON)) + ) + + val e = + assertThrows { + dataService.stream( + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .addInputVariableName("user_query") + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("tokens") + .addPrompt( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + .addRow( + InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .questionColumnName("question") - .timestampColumnName("timestamp") - .build() - ) - .addRow( - InferencePipelineDataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) .build() ) - .build() - - stubFor(post(anyUrl()).willReturn(status(400).withBody("Not JSON"))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> - assertBadRequest(e, Headers.builder().build(), OpenlayerError.builder().build()) - }) - } - - private fun toJson(body: T): ByteArray { - return JSON_MAPPER.writeValueAsBytes(body) - } - - private fun assertUnexpectedStatusCodeException( - throwable: Throwable, - statusCode: Int, - headers: Headers, - responseBody: ByteArray, - ) { - assertThat(throwable) - .asInstanceOf( - InstanceOfAssertFactories.throwable(UnexpectedStatusCodeException::class.java) - ) - .satisfies({ e -> - assertThat(e.statusCode()).isEqualTo(statusCode) - assertThat(e.body()).isEqualTo(String(responseBody)) - assertThat(e.headers().toMap()).containsAllEntriesOf(headers.toMap()) - }) - } - - private fun assertBadRequest(throwable: Throwable, headers: Headers, error: OpenlayerError) { - assertThat(throwable) - .asInstanceOf(InstanceOfAssertFactories.throwable(BadRequestException::class.java)) - .satisfies({ e -> - assertThat(e.statusCode()).isEqualTo(400) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers().toMap()).containsAllEntriesOf(headers.toMap()) - }) - } - - private fun assertUnauthorized(throwable: Throwable, headers: Headers, error: OpenlayerError) { - assertThat(throwable) - .asInstanceOf(InstanceOfAssertFactories.throwable(UnauthorizedException::class.java)) - .satisfies({ e -> - assertThat(e.statusCode()).isEqualTo(401) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers().toMap()).containsAllEntriesOf(headers.toMap()) - }) - } - - private fun assertPermissionDenied( - throwable: Throwable, - headers: Headers, - error: OpenlayerError, - ) { - assertThat(throwable) - .asInstanceOf( - InstanceOfAssertFactories.throwable(PermissionDeniedException::class.java) - ) - .satisfies({ e -> - assertThat(e.statusCode()).isEqualTo(403) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers().toMap()).containsAllEntriesOf(headers.toMap()) - }) - } - - private fun assertNotFound(throwable: Throwable, headers: Headers, error: OpenlayerError) { - assertThat(throwable) - .asInstanceOf(InstanceOfAssertFactories.throwable(NotFoundException::class.java)) - .satisfies({ e -> - assertThat(e.statusCode()).isEqualTo(404) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers().toMap()).containsAllEntriesOf(headers.toMap()) - }) - } - - private fun assertUnprocessableEntity( - throwable: Throwable, - headers: Headers, - error: OpenlayerError, - ) { - assertThat(throwable) - .asInstanceOf( - InstanceOfAssertFactories.throwable(UnprocessableEntityException::class.java) - ) - .satisfies({ e -> - assertThat(e.statusCode()).isEqualTo(422) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers().toMap()).containsAllEntriesOf(headers.toMap()) - }) - } - - private fun assertRateLimit(throwable: Throwable, headers: Headers, error: OpenlayerError) { - assertThat(throwable) - .asInstanceOf(InstanceOfAssertFactories.throwable(RateLimitException::class.java)) - .satisfies({ e -> - assertThat(e.statusCode()).isEqualTo(429) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers().toMap()).containsAllEntriesOf(headers.toMap()) - }) - } + } - private fun assertInternalServer( - throwable: Throwable, - headers: Headers, - error: OpenlayerError, - ) { - assertThat(throwable) - .asInstanceOf(InstanceOfAssertFactories.throwable(InternalServerException::class.java)) - .satisfies({ e -> - assertThat(e.statusCode()).isEqualTo(500) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers().toMap()).containsAllEntriesOf(headers.toMap()) - }) + assertThat(e).hasMessage("Error reading response") } private fun Headers.toMap(): Map> = From 50872978eab416d1395b8619b965e7135d2aef65 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 13 Mar 2025 19:27:38 +0000 Subject: [PATCH 13/74] feat(api): add endpoint to retrieve commit by id (#77) --- .github/workflows/publish-sonatype.yml | 8 +- .github/workflows/release-doctor.yml | 1 - .stats.yml | 2 +- bin/check-release-environment | 4 - .../api/models/CommitRetrieveParams.kt | 181 +++ .../api/models/CommitRetrieveResponse.kt | 1083 +++++++++++++++++ .../api/services/async/CommitServiceAsync.kt | 13 + .../services/async/CommitServiceAsyncImpl.kt | 41 + .../api/services/blocking/CommitService.kt | 12 + .../services/blocking/CommitServiceImpl.kt | 37 + .../api/models/CommitRetrieveParamsTest.kt | 29 + .../api/models/CommitRetrieveResponseTest.kt | 101 ++ .../services/async/CommitServiceAsyncTest.kt | 33 + .../services/blocking/CommitServiceTest.kt | 32 + 14 files changed, 1569 insertions(+), 8 deletions(-) create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveResponse.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitRetrieveParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitRetrieveResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/CommitServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index d852c899..de1b147f 100644 --- a/.github/workflows/publish-sonatype.yml +++ b/.github/workflows/publish-sonatype.yml @@ -1,9 +1,13 @@ -# workflow for re-running publishing to Sonatype in case it fails for some reason -# you can run this workflow by navigating to https://www.github.com/openlayer-ai/openlayer-java/actions/workflows/publish-sonatype.yml +# This workflow is triggered when a GitHub release is created. +# It can also be run manually to re-publish to Sonatype in case it failed for some reason. +# You can run this workflow by navigating to https://www.github.com/openlayer-ai/openlayer-java/actions/workflows/publish-sonatype.yml name: Publish Sonatype on: workflow_dispatch: + release: + types: [published] + jobs: publish: name: publish diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index d2c76fa2..b4ed7fd0 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -18,7 +18,6 @@ jobs: run: | bash ./bin/check-release-environment env: - STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }} SONATYPE_USERNAME: ${{ secrets.OPENLAYER_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.OPENLAYER_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }} GPG_SIGNING_KEY: ${{ secrets.OPENLAYER_SONATYPE_GPG_SIGNING_KEY || secrets.GPG_SIGNING_KEY }} diff --git a/.stats.yml b/.stats.yml index dd473053..c2549479 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 14 +configured_endpoints: 15 diff --git a/bin/check-release-environment b/bin/check-release-environment index c393cdbb..14a9e4dc 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,10 +2,6 @@ errors=() -if [ -z "${STAINLESS_API_KEY}" ]; then - errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organization secrets on GitHub.") -fi - if [ -z "${SONATYPE_USERNAME}" ]; then errors+=("The OPENLAYER_SONATYPE_USERNAME secret has not been set. Please set it in either this repository's secrets or your organization secrets") fi diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveParams.kt new file mode 100644 index 00000000..1cf69247 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveParams.kt @@ -0,0 +1,181 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.Params +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import java.util.Objects + +/** Retrieve a project version (commit) by its id. */ +class CommitRetrieveParams +private constructor( + private val projectVersionId: String, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun projectVersionId(): String = projectVersionId + + fun _additionalHeaders(): Headers = additionalHeaders + + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> projectVersionId + else -> "" + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CommitRetrieveParams]. */ + @NoAutoDetect + class Builder internal constructor() { + + private var projectVersionId: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(commitRetrieveParams: CommitRetrieveParams) = apply { + projectVersionId = commitRetrieveParams.projectVersionId + additionalHeaders = commitRetrieveParams.additionalHeaders.toBuilder() + additionalQueryParams = commitRetrieveParams.additionalQueryParams.toBuilder() + } + + fun projectVersionId(projectVersionId: String) = apply { + this.projectVersionId = projectVersionId + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + fun build(): CommitRetrieveParams = + CommitRetrieveParams( + checkRequired("projectVersionId", projectVersionId), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is CommitRetrieveParams && projectVersionId == other.projectVersionId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(projectVersionId, additionalHeaders, additionalQueryParams) /* spotless:on */ + + override fun toString() = + "CommitRetrieveParams{projectVersionId=$projectVersionId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveResponse.kt new file mode 100644 index 00000000..5a3a6888 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveResponse.kt @@ -0,0 +1,1083 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.immutableEmptyMap +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Objects +import java.util.Optional + +@NoAutoDetect +class CommitRetrieveResponse +@JsonCreator +private constructor( + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("commit") + @ExcludeMissing + private val commit: JsonField = JsonMissing.of(), + @JsonProperty("dateArchived") + @ExcludeMissing + private val dateArchived: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("failingGoalCount") + @ExcludeMissing + private val failingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("mlModelId") + @ExcludeMissing + private val mlModelId: JsonField = JsonMissing.of(), + @JsonProperty("passingGoalCount") + @ExcludeMissing + private val passingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + private val projectId: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + private val statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + private val storageUri: JsonField = JsonMissing.of(), + @JsonProperty("totalGoalCount") + @ExcludeMissing + private val totalGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("trainingDatasetId") + @ExcludeMissing + private val trainingDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("validationDatasetId") + @ExcludeMissing + private val validationDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("archived") + @ExcludeMissing + private val archived: JsonField = JsonMissing.of(), + @JsonProperty("deploymentStatus") + @ExcludeMissing + private val deploymentStatus: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing private val links: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), +) { + + /** The project version (commit) id. */ + fun id(): String = id.getRequired("id") + + /** The details of a commit (project version). */ + fun commit(): Commit = commit.getRequired("commit") + + /** The commit archive date. */ + fun dateArchived(): Optional = + Optional.ofNullable(dateArchived.getNullable("dateArchived")) + + /** The project version (commit) creation date. */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** The number of tests that are failing for the commit. */ + fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") + + /** The model id. */ + fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + + /** The number of tests that are passing for the commit. */ + fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") + + /** The project id. */ + fun projectId(): String = projectId.getRequired("projectId") + + /** + * The commit status. Initially, the commit is `queued`, then, it switches to `running`. + * Finally, it can be `paused`, `failed`, or `completed`. + */ + fun status(): Status = status.getRequired("status") + + /** The commit status message. */ + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) + + /** The storage URI where the commit bundle is stored. */ + fun storageUri(): String = storageUri.getRequired("storageUri") + + /** The total number of tests for the commit. */ + fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") + + /** The training dataset id. */ + fun trainingDatasetId(): Optional = + Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + + /** The validation dataset id. */ + fun validationDatasetId(): Optional = + Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + + /** Whether the commit is archived. */ + fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) + + /** The deployment status associated with the commit's model. */ + fun deploymentStatus(): Optional = + Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + + fun links(): Optional = Optional.ofNullable(links.getNullable("links")) + + /** The project version (commit) id. */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** The details of a commit (project version). */ + @JsonProperty("commit") @ExcludeMissing fun _commit(): JsonField = commit + + /** The commit archive date. */ + @JsonProperty("dateArchived") + @ExcludeMissing + fun _dateArchived(): JsonField = dateArchived + + /** The project version (commit) creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** The number of tests that are failing for the commit. */ + @JsonProperty("failingGoalCount") + @ExcludeMissing + fun _failingGoalCount(): JsonField = failingGoalCount + + /** The model id. */ + @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId(): JsonField = mlModelId + + /** The number of tests that are passing for the commit. */ + @JsonProperty("passingGoalCount") + @ExcludeMissing + fun _passingGoalCount(): JsonField = passingGoalCount + + /** The project id. */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + + /** + * The commit status. Initially, the commit is `queued`, then, it switches to `running`. + * Finally, it can be `paused`, `failed`, or `completed`. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** The commit status message. */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + + /** The storage URI where the commit bundle is stored. */ + @JsonProperty("storageUri") @ExcludeMissing fun _storageUri(): JsonField = storageUri + + /** The total number of tests for the commit. */ + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun _totalGoalCount(): JsonField = totalGoalCount + + /** The training dataset id. */ + @JsonProperty("trainingDatasetId") + @ExcludeMissing + fun _trainingDatasetId(): JsonField = trainingDatasetId + + /** The validation dataset id. */ + @JsonProperty("validationDatasetId") + @ExcludeMissing + fun _validationDatasetId(): JsonField = validationDatasetId + + /** Whether the commit is archived. */ + @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived + + /** The deployment status associated with the commit's model. */ + @JsonProperty("deploymentStatus") + @ExcludeMissing + fun _deploymentStatus(): JsonField = deploymentStatus + + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): CommitRetrieveResponse = apply { + if (validated) { + return@apply + } + + id() + commit().validate() + dateArchived() + dateCreated() + failingGoalCount() + mlModelId() + passingGoalCount() + projectId() + status() + statusMessage() + storageUri() + totalGoalCount() + trainingDatasetId() + validationDatasetId() + archived() + deploymentStatus() + links().ifPresent { it.validate() } + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CommitRetrieveResponse]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var commit: JsonField? = null + private var dateArchived: JsonField? = null + private var dateCreated: JsonField? = null + private var failingGoalCount: JsonField? = null + private var mlModelId: JsonField? = null + private var passingGoalCount: JsonField? = null + private var projectId: JsonField? = null + private var status: JsonField? = null + private var statusMessage: JsonField? = null + private var storageUri: JsonField? = null + private var totalGoalCount: JsonField? = null + private var trainingDatasetId: JsonField? = null + private var validationDatasetId: JsonField? = null + private var archived: JsonField = JsonMissing.of() + private var deploymentStatus: JsonField = JsonMissing.of() + private var links: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(commitRetrieveResponse: CommitRetrieveResponse) = apply { + id = commitRetrieveResponse.id + commit = commitRetrieveResponse.commit + dateArchived = commitRetrieveResponse.dateArchived + dateCreated = commitRetrieveResponse.dateCreated + failingGoalCount = commitRetrieveResponse.failingGoalCount + mlModelId = commitRetrieveResponse.mlModelId + passingGoalCount = commitRetrieveResponse.passingGoalCount + projectId = commitRetrieveResponse.projectId + status = commitRetrieveResponse.status + statusMessage = commitRetrieveResponse.statusMessage + storageUri = commitRetrieveResponse.storageUri + totalGoalCount = commitRetrieveResponse.totalGoalCount + trainingDatasetId = commitRetrieveResponse.trainingDatasetId + validationDatasetId = commitRetrieveResponse.validationDatasetId + archived = commitRetrieveResponse.archived + deploymentStatus = commitRetrieveResponse.deploymentStatus + links = commitRetrieveResponse.links + additionalProperties = commitRetrieveResponse.additionalProperties.toMutableMap() + } + + /** The project version (commit) id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** The project version (commit) id. */ + fun id(id: JsonField) = apply { this.id = id } + + /** The details of a commit (project version). */ + fun commit(commit: Commit) = commit(JsonField.of(commit)) + + /** The details of a commit (project version). */ + fun commit(commit: JsonField) = apply { this.commit = commit } + + /** The commit archive date. */ + fun dateArchived(dateArchived: OffsetDateTime?) = + dateArchived(JsonField.ofNullable(dateArchived)) + + /** The commit archive date. */ + fun dateArchived(dateArchived: Optional) = + dateArchived(dateArchived.orElse(null)) + + /** The commit archive date. */ + fun dateArchived(dateArchived: JsonField) = apply { + this.dateArchived = dateArchived + } + + /** The project version (commit) creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** The project version (commit) creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The number of tests that are failing for the commit. */ + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) + + /** The number of tests that are failing for the commit. */ + fun failingGoalCount(failingGoalCount: JsonField) = apply { + this.failingGoalCount = failingGoalCount + } + + /** The model id. */ + fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) + + /** The model id. */ + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.orElse(null)) + + /** The model id. */ + fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } + + /** The number of tests that are passing for the commit. */ + fun passingGoalCount(passingGoalCount: Long) = + passingGoalCount(JsonField.of(passingGoalCount)) + + /** The number of tests that are passing for the commit. */ + fun passingGoalCount(passingGoalCount: JsonField) = apply { + this.passingGoalCount = passingGoalCount + } + + /** The project id. */ + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + + /** The project id. */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + + /** + * The commit status. Initially, the commit is `queued`, then, it switches to `running`. + * Finally, it can be `paused`, `failed`, or `completed`. + */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * The commit status. Initially, the commit is `queued`, then, it switches to `running`. + * Finally, it can be `paused`, `failed`, or `completed`. + */ + fun status(status: JsonField) = apply { this.status = status } + + /** The commit status message. */ + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** The commit status message. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.orElse(null)) + + /** The commit status message. */ + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + /** The storage URI where the commit bundle is stored. */ + fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) + + /** The storage URI where the commit bundle is stored. */ + fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } + + /** The total number of tests for the commit. */ + fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) + + /** The total number of tests for the commit. */ + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount + } + + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: String?) = + trainingDatasetId(JsonField.ofNullable(trainingDatasetId)) + + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: Optional) = + trainingDatasetId(trainingDatasetId.orElse(null)) + + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: JsonField) = apply { + this.trainingDatasetId = trainingDatasetId + } + + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: String?) = + validationDatasetId(JsonField.ofNullable(validationDatasetId)) + + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: Optional) = + validationDatasetId(validationDatasetId.orElse(null)) + + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: JsonField) = apply { + this.validationDatasetId = validationDatasetId + } + + /** Whether the commit is archived. */ + fun archived(archived: Boolean?) = archived(JsonField.ofNullable(archived)) + + /** Whether the commit is archived. */ + fun archived(archived: Boolean) = archived(archived as Boolean?) + + /** Whether the commit is archived. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun archived(archived: Optional) = archived(archived.orElse(null) as Boolean?) + + /** Whether the commit is archived. */ + fun archived(archived: JsonField) = apply { this.archived = archived } + + /** The deployment status associated with the commit's model. */ + fun deploymentStatus(deploymentStatus: String) = + deploymentStatus(JsonField.of(deploymentStatus)) + + /** The deployment status associated with the commit's model. */ + fun deploymentStatus(deploymentStatus: JsonField) = apply { + this.deploymentStatus = deploymentStatus + } + + fun links(links: Links) = links(JsonField.of(links)) + + fun links(links: JsonField) = apply { this.links = links } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): CommitRetrieveResponse = + CommitRetrieveResponse( + checkRequired("id", id), + checkRequired("commit", commit), + checkRequired("dateArchived", dateArchived), + checkRequired("dateCreated", dateCreated), + checkRequired("failingGoalCount", failingGoalCount), + checkRequired("mlModelId", mlModelId), + checkRequired("passingGoalCount", passingGoalCount), + checkRequired("projectId", projectId), + checkRequired("status", status), + checkRequired("statusMessage", statusMessage), + checkRequired("storageUri", storageUri), + checkRequired("totalGoalCount", totalGoalCount), + checkRequired("trainingDatasetId", trainingDatasetId), + checkRequired("validationDatasetId", validationDatasetId), + archived, + deploymentStatus, + links, + additionalProperties.toImmutable(), + ) + } + + /** The details of a commit (project version). */ + @NoAutoDetect + class Commit + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("authorId") + @ExcludeMissing + private val authorId: JsonField = JsonMissing.of(), + @JsonProperty("fileSize") + @ExcludeMissing + private val fileSize: JsonField = JsonMissing.of(), + @JsonProperty("message") + @ExcludeMissing + private val message: JsonField = JsonMissing.of(), + @JsonProperty("mlModelId") + @ExcludeMissing + private val mlModelId: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + private val storageUri: JsonField = JsonMissing.of(), + @JsonProperty("trainingDatasetId") + @ExcludeMissing + private val trainingDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("validationDatasetId") + @ExcludeMissing + private val validationDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + private val dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitRef") + @ExcludeMissing + private val gitCommitRef: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitSha") + @ExcludeMissing + private val gitCommitSha: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitUrl") + @ExcludeMissing + private val gitCommitUrl: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The commit id. */ + fun id(): String = id.getRequired("id") + + /** The author id of the commit. */ + fun authorId(): String = authorId.getRequired("authorId") + + /** The size of the commit bundle in bytes. */ + fun fileSize(): Optional = Optional.ofNullable(fileSize.getNullable("fileSize")) + + /** The commit message. */ + fun message(): String = message.getRequired("message") + + /** The model id. */ + fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + + /** The storage URI where the commit bundle is stored. */ + fun storageUri(): String = storageUri.getRequired("storageUri") + + /** The training dataset id. */ + fun trainingDatasetId(): Optional = + Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + + /** The validation dataset id. */ + fun validationDatasetId(): Optional = + Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + + /** The commit creation date. */ + fun dateCreated(): Optional = + Optional.ofNullable(dateCreated.getNullable("dateCreated")) + + /** The ref of the corresponding git commit. */ + fun gitCommitRef(): Optional = + Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) + + /** The SHA of the corresponding git commit. */ + fun gitCommitSha(): Optional = + Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) + + /** The URL of the corresponding git commit. */ + fun gitCommitUrl(): Optional = + Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) + + /** The commit id. */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** The author id of the commit. */ + @JsonProperty("authorId") @ExcludeMissing fun _authorId(): JsonField = authorId + + /** The size of the commit bundle in bytes. */ + @JsonProperty("fileSize") @ExcludeMissing fun _fileSize(): JsonField = fileSize + + /** The commit message. */ + @JsonProperty("message") @ExcludeMissing fun _message(): JsonField = message + + /** The model id. */ + @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId(): JsonField = mlModelId + + /** The storage URI where the commit bundle is stored. */ + @JsonProperty("storageUri") + @ExcludeMissing + fun _storageUri(): JsonField = storageUri + + /** The training dataset id. */ + @JsonProperty("trainingDatasetId") + @ExcludeMissing + fun _trainingDatasetId(): JsonField = trainingDatasetId + + /** The validation dataset id. */ + @JsonProperty("validationDatasetId") + @ExcludeMissing + fun _validationDatasetId(): JsonField = validationDatasetId + + /** The commit creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** The ref of the corresponding git commit. */ + @JsonProperty("gitCommitRef") + @ExcludeMissing + fun _gitCommitRef(): JsonField = gitCommitRef + + /** The SHA of the corresponding git commit. */ + @JsonProperty("gitCommitSha") + @ExcludeMissing + fun _gitCommitSha(): JsonField = gitCommitSha + + /** The URL of the corresponding git commit. */ + @JsonProperty("gitCommitUrl") + @ExcludeMissing + fun _gitCommitUrl(): JsonField = gitCommitUrl + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Commit = apply { + if (validated) { + return@apply + } + + id() + authorId() + fileSize() + message() + mlModelId() + storageUri() + trainingDatasetId() + validationDatasetId() + dateCreated() + gitCommitRef() + gitCommitSha() + gitCommitUrl() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Commit]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var authorId: JsonField? = null + private var fileSize: JsonField? = null + private var message: JsonField? = null + private var mlModelId: JsonField? = null + private var storageUri: JsonField? = null + private var trainingDatasetId: JsonField? = null + private var validationDatasetId: JsonField? = null + private var dateCreated: JsonField = JsonMissing.of() + private var gitCommitRef: JsonField = JsonMissing.of() + private var gitCommitSha: JsonField = JsonMissing.of() + private var gitCommitUrl: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(commit: Commit) = apply { + id = commit.id + authorId = commit.authorId + fileSize = commit.fileSize + message = commit.message + mlModelId = commit.mlModelId + storageUri = commit.storageUri + trainingDatasetId = commit.trainingDatasetId + validationDatasetId = commit.validationDatasetId + dateCreated = commit.dateCreated + gitCommitRef = commit.gitCommitRef + gitCommitSha = commit.gitCommitSha + gitCommitUrl = commit.gitCommitUrl + additionalProperties = commit.additionalProperties.toMutableMap() + } + + /** The commit id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** The commit id. */ + fun id(id: JsonField) = apply { this.id = id } + + /** The author id of the commit. */ + fun authorId(authorId: String) = authorId(JsonField.of(authorId)) + + /** The author id of the commit. */ + fun authorId(authorId: JsonField) = apply { this.authorId = authorId } + + /** The size of the commit bundle in bytes. */ + fun fileSize(fileSize: Long?) = fileSize(JsonField.ofNullable(fileSize)) + + /** The size of the commit bundle in bytes. */ + fun fileSize(fileSize: Long) = fileSize(fileSize as Long?) + + /** The size of the commit bundle in bytes. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fileSize(fileSize: Optional) = fileSize(fileSize.orElse(null) as Long?) + + /** The size of the commit bundle in bytes. */ + fun fileSize(fileSize: JsonField) = apply { this.fileSize = fileSize } + + /** The commit message. */ + fun message(message: String) = message(JsonField.of(message)) + + /** The commit message. */ + fun message(message: JsonField) = apply { this.message = message } + + /** The model id. */ + fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) + + /** The model id. */ + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.orElse(null)) + + /** The model id. */ + fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } + + /** The storage URI where the commit bundle is stored. */ + fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) + + /** The storage URI where the commit bundle is stored. */ + fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } + + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: String?) = + trainingDatasetId(JsonField.ofNullable(trainingDatasetId)) + + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: Optional) = + trainingDatasetId(trainingDatasetId.orElse(null)) + + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: JsonField) = apply { + this.trainingDatasetId = trainingDatasetId + } + + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: String?) = + validationDatasetId(JsonField.ofNullable(validationDatasetId)) + + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: Optional) = + validationDatasetId(validationDatasetId.orElse(null)) + + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: JsonField) = apply { + this.validationDatasetId = validationDatasetId + } + + /** The commit creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** The commit creation date. */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The ref of the corresponding git commit. */ + fun gitCommitRef(gitCommitRef: String) = gitCommitRef(JsonField.of(gitCommitRef)) + + /** The ref of the corresponding git commit. */ + fun gitCommitRef(gitCommitRef: JsonField) = apply { + this.gitCommitRef = gitCommitRef + } + + /** The SHA of the corresponding git commit. */ + fun gitCommitSha(gitCommitSha: Long) = gitCommitSha(JsonField.of(gitCommitSha)) + + /** The SHA of the corresponding git commit. */ + fun gitCommitSha(gitCommitSha: JsonField) = apply { + this.gitCommitSha = gitCommitSha + } + + /** The URL of the corresponding git commit. */ + fun gitCommitUrl(gitCommitUrl: String) = gitCommitUrl(JsonField.of(gitCommitUrl)) + + /** The URL of the corresponding git commit. */ + fun gitCommitUrl(gitCommitUrl: JsonField) = apply { + this.gitCommitUrl = gitCommitUrl + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Commit = + Commit( + checkRequired("id", id), + checkRequired("authorId", authorId), + checkRequired("fileSize", fileSize), + checkRequired("message", message), + checkRequired("mlModelId", mlModelId), + checkRequired("storageUri", storageUri), + checkRequired("trainingDatasetId", trainingDatasetId), + checkRequired("validationDatasetId", validationDatasetId), + dateCreated, + gitCommitRef, + gitCommitSha, + gitCommitUrl, + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Commit && id == other.id && authorId == other.authorId && fileSize == other.fileSize && message == other.message && mlModelId == other.mlModelId && storageUri == other.storageUri && trainingDatasetId == other.trainingDatasetId && validationDatasetId == other.validationDatasetId && dateCreated == other.dateCreated && gitCommitRef == other.gitCommitRef && gitCommitSha == other.gitCommitSha && gitCommitUrl == other.gitCommitUrl && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, authorId, fileSize, message, mlModelId, storageUri, trainingDatasetId, validationDatasetId, dateCreated, gitCommitRef, gitCommitSha, gitCommitUrl, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Commit{id=$id, authorId=$authorId, fileSize=$fileSize, message=$message, mlModelId=$mlModelId, storageUri=$storageUri, trainingDatasetId=$trainingDatasetId, validationDatasetId=$validationDatasetId, dateCreated=$dateCreated, gitCommitRef=$gitCommitRef, gitCommitSha=$gitCommitSha, gitCommitUrl=$gitCommitUrl, additionalProperties=$additionalProperties}" + } + + /** + * The commit status. Initially, the commit is `queued`, then, it switches to `running`. + * Finally, it can be `paused`, `failed`, or `completed`. + */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val QUEUED = of("queued") + + @JvmField val RUNNING = of("running") + + @JvmField val PAUSED = of("paused") + + @JvmField val FAILED = of("failed") + + @JvmField val COMPLETED = of("completed") + + @JvmField val UNKNOWN = of("unknown") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + QUEUED, + RUNNING, + PAUSED, + FAILED, + COMPLETED, + UNKNOWN, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + QUEUED, + RUNNING, + PAUSED, + FAILED, + COMPLETED, + UNKNOWN, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + QUEUED -> Value.QUEUED + RUNNING -> Value.RUNNING + PAUSED -> Value.PAUSED + FAILED -> Value.FAILED + COMPLETED -> Value.COMPLETED + UNKNOWN -> Value.UNKNOWN + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + QUEUED -> Known.QUEUED + RUNNING -> Known.RUNNING + PAUSED -> Known.PAUSED + FAILED -> Known.FAILED + COMPLETED -> Known.COMPLETED + UNKNOWN -> Known.UNKNOWN + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Status && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + @NoAutoDetect + class Links + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing private val app: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + fun app(): String = app.getRequired("app") + + @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Links]. */ + class Builder internal constructor() { + + private var app: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(links: Links) = apply { + app = links.app + additionalProperties = links.additionalProperties.toMutableMap() + } + + fun app(app: String) = app(JsonField.of(app)) + + fun app(app: JsonField) = apply { this.app = app } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Links = + Links(checkRequired("app", app), additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Links && app == other.app && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(app, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is CommitRetrieveResponse && id == other.id && commit == other.commit && dateArchived == other.dateArchived && dateCreated == other.dateCreated && failingGoalCount == other.failingGoalCount && mlModelId == other.mlModelId && passingGoalCount == other.passingGoalCount && projectId == other.projectId && status == other.status && statusMessage == other.statusMessage && storageUri == other.storageUri && totalGoalCount == other.totalGoalCount && trainingDatasetId == other.trainingDatasetId && validationDatasetId == other.validationDatasetId && archived == other.archived && deploymentStatus == other.deploymentStatus && links == other.links && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, commit, dateArchived, dateCreated, failingGoalCount, mlModelId, passingGoalCount, projectId, status, statusMessage, storageUri, totalGoalCount, trainingDatasetId, validationDatasetId, archived, deploymentStatus, links, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CommitRetrieveResponse{id=$id, commit=$commit, dateArchived=$dateArchived, dateCreated=$dateCreated, failingGoalCount=$failingGoalCount, mlModelId=$mlModelId, passingGoalCount=$passingGoalCount, projectId=$projectId, status=$status, statusMessage=$statusMessage, storageUri=$storageUri, totalGoalCount=$totalGoalCount, trainingDatasetId=$trainingDatasetId, validationDatasetId=$validationDatasetId, archived=$archived, deploymentStatus=$deploymentStatus, links=$links, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt index 2fbb5b68..f7973ee0 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt @@ -1,10 +1,23 @@ // File generated from our OpenAPI spec by Stainless. +@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 + package com.openlayer.api.services.async +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.CommitRetrieveParams +import com.openlayer.api.models.CommitRetrieveResponse import com.openlayer.api.services.async.commits.TestResultServiceAsync +import java.util.concurrent.CompletableFuture interface CommitServiceAsync { fun testResults(): TestResultServiceAsync + + /** Retrieve a project version (commit) by its id. */ + @JvmOverloads + fun retrieve( + params: CommitRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt index e2da7f51..edaf826d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt @@ -3,15 +3,56 @@ package com.openlayer.api.services.async import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.prepareAsync +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.models.CommitRetrieveParams +import com.openlayer.api.models.CommitRetrieveResponse import com.openlayer.api.services.async.commits.TestResultServiceAsync import com.openlayer.api.services.async.commits.TestResultServiceAsyncImpl +import java.util.concurrent.CompletableFuture class CommitServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : CommitServiceAsync { + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val testResults: TestResultServiceAsync by lazy { TestResultServiceAsyncImpl(clientOptions) } override fun testResults(): TestResultServiceAsync = testResults + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + /** Retrieve a project version (commit) by its id. */ + override fun retrieve( + params: CommitRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("versions", params.getPathParam(0)) + .build() + .prepareAsync(clientOptions, params) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() + } + } + } + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt index 6c803869..c026c86b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt @@ -1,10 +1,22 @@ // File generated from our OpenAPI spec by Stainless. +@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 + package com.openlayer.api.services.blocking +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.CommitRetrieveParams +import com.openlayer.api.models.CommitRetrieveResponse import com.openlayer.api.services.blocking.commits.TestResultService interface CommitService { fun testResults(): TestResultService + + /** Retrieve a project version (commit) by its id. */ + @JvmOverloads + fun retrieve( + params: CommitRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CommitRetrieveResponse } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt index 4c9d1b3b..2c944d89 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt @@ -3,13 +3,50 @@ package com.openlayer.api.services.blocking import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.prepare +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.models.CommitRetrieveParams +import com.openlayer.api.models.CommitRetrieveResponse import com.openlayer.api.services.blocking.commits.TestResultService import com.openlayer.api.services.blocking.commits.TestResultServiceImpl class CommitServiceImpl internal constructor(private val clientOptions: ClientOptions) : CommitService { + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val testResults: TestResultService by lazy { TestResultServiceImpl(clientOptions) } override fun testResults(): TestResultService = testResults + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + /** Retrieve a project version (commit) by its id. */ + override fun retrieve( + params: CommitRetrieveParams, + requestOptions: RequestOptions, + ): CommitRetrieveResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("versions", params.getPathParam(0)) + .build() + .prepare(clientOptions, params) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + it.validate() + } + } + } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitRetrieveParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitRetrieveParamsTest.kt new file mode 100644 index 00000000..6ec60cd9 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitRetrieveParamsTest.kt @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class CommitRetrieveParamsTest { + + @Test + fun create() { + CommitRetrieveParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + } + + @Test + fun getPathParam() { + val params = + CommitRetrieveParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + assertThat(params).isNotNull + // path param "projectVersionId" + assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params.getPathParam(1)).isEqualTo("") + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitRetrieveResponseTest.kt new file mode 100644 index 00000000..581ef8da --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitRetrieveResponseTest.kt @@ -0,0 +1,101 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class CommitRetrieveResponseTest { + + @Test + fun createCommitRetrieveResponse() { + val commitRetrieveResponse = + CommitRetrieveResponse.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commit( + CommitRetrieveResponse.Commit.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .fileSize(1024L) + .message("Updated the prompt.") + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .storageUri("s3://...") + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .gitCommitRef("main") + .gitCommitSha(0L) + .gitCommitUrl("gitCommitUrl") + .build() + ) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(1L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(CommitRetrieveResponse.Status.QUEUED) + .statusMessage("Commit successfully processed.") + .totalGoalCount(6L) + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .archived(false) + .deploymentStatus("Deployed") + .links( + CommitRetrieveResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .build() + assertThat(commitRetrieveResponse).isNotNull + assertThat(commitRetrieveResponse.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(commitRetrieveResponse.commit()) + .isEqualTo( + CommitRetrieveResponse.Commit.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .fileSize(1024L) + .message("Updated the prompt.") + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .storageUri("s3://...") + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .gitCommitRef("main") + .gitCommitSha(0L) + .gitCommitUrl("gitCommitUrl") + .build() + ) + assertThat(commitRetrieveResponse.dateArchived()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(commitRetrieveResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(commitRetrieveResponse.failingGoalCount()).isEqualTo(1L) + assertThat(commitRetrieveResponse.mlModelId()) + .contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(commitRetrieveResponse.passingGoalCount()).isEqualTo(5L) + assertThat(commitRetrieveResponse.projectId()) + .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(commitRetrieveResponse.status()).isEqualTo(CommitRetrieveResponse.Status.QUEUED) + assertThat(commitRetrieveResponse.statusMessage()) + .contains("Commit successfully processed.") + assertThat(commitRetrieveResponse.totalGoalCount()).isEqualTo(6L) + assertThat(commitRetrieveResponse.trainingDatasetId()) + .contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(commitRetrieveResponse.validationDatasetId()) + .contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(commitRetrieveResponse.archived()).contains(false) + assertThat(commitRetrieveResponse.deploymentStatus()).contains("Deployed") + assertThat(commitRetrieveResponse.links()) + .contains( + CommitRetrieveResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/CommitServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/CommitServiceAsyncTest.kt new file mode 100644 index 00000000..c2e20b61 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/CommitServiceAsyncTest.kt @@ -0,0 +1,33 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.models.CommitRetrieveParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class CommitServiceAsyncTest { + + @Test + fun retrieve() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val commitServiceAsync = client.commits() + + val commitFuture = + commitServiceAsync.retrieve( + CommitRetrieveParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + + val commit = commitFuture.get() + commit.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt new file mode 100644 index 00000000..ed876dd9 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt @@ -0,0 +1,32 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.models.CommitRetrieveParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class CommitServiceTest { + + @Test + fun retrieve() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val commitService = client.commits() + + val commit = + commitService.retrieve( + CommitRetrieveParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + + commit.validate() + } +} From 3ee21d4a05dddebac33326fd9c0cbde11bf39062 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 14 Mar 2025 05:07:01 +0000 Subject: [PATCH 14/74] chore(internal): codegen related update (#79) --- .gitignore | 1 + README.md | 105 +++++++++- build.gradle.kts | 19 ++ .../main/kotlin/openlayer.kotlin.gradle.kts | 9 +- .../main/kotlin/openlayer.publish.gradle.kts | 8 + .../api/client/okhttp/OkHttpClient.kt | 27 +-- .../client/okhttp/OpenlayerOkHttpClient.kt | 22 +- .../okhttp/OpenlayerOkHttpClientAsync.kt | 24 ++- openlayer-java-core/build.gradle.kts | 1 + .../openlayer/api/client/OpenlayerClient.kt | 17 ++ .../api/client/OpenlayerClientAsync.kt | 19 ++ .../api/client/OpenlayerClientAsyncImpl.kt | 35 ++++ .../api/client/OpenlayerClientImpl.kt | 35 ++++ .../kotlin/com/openlayer/api/core/Check.kt | 12 ++ .../com/openlayer/api/core/ClientOptions.kt | 21 +- .../openlayer/api/core/HttpRequestBodies.kt | 108 ---------- .../com/openlayer/api/core/ObjectMappers.kt | 59 ++++++ .../com/openlayer/api/core/RequestOptions.kt | 33 +-- .../kotlin/com/openlayer/api/core/Timeout.kt | 189 ++++++++++++++++++ .../kotlin/com/openlayer/api/core/Values.kt | 131 ++++++------ .../api/core/handlers/JsonHandler.kt | 9 +- .../com/openlayer/api/core/http/HttpClient.kt | 9 +- .../api/core/http/HttpRequestBodies.kt | 131 ++++++++++++ .../api/core/http/HttpResponseFor.kt | 23 +++ .../openlayer/api/errors/OpenlayerError.kt | 1 + .../api/models/CommitRetrieveParams.kt | 8 + .../api/models/CommitRetrieveResponse.kt | 67 +++++-- .../api/models/CommitTestResultListParams.kt | 22 +- .../models/CommitTestResultListResponse.kt | 102 ++++++---- .../InferencePipelineDataStreamParams.kt | 146 +++++++------- .../InferencePipelineDataStreamResponse.kt | 9 + .../models/InferencePipelineDeleteParams.kt | 9 + .../models/InferencePipelineRetrieveParams.kt | 12 +- .../InferencePipelineRetrieveResponse.kt | 152 +++++++++++--- .../InferencePipelineRowUpdateParams.kt | 35 +++- .../InferencePipelineRowUpdateResponse.kt | 9 + .../InferencePipelineTestResultListParams.kt | 20 +- ...InferencePipelineTestResultListResponse.kt | 103 ++++++---- .../models/InferencePipelineUpdateParams.kt | 19 +- .../models/InferencePipelineUpdateResponse.kt | 152 +++++++++++--- .../api/models/ProjectCommitCreateParams.kt | 102 ++++++++-- .../api/models/ProjectCommitCreateResponse.kt | 67 +++++-- .../api/models/ProjectCommitListParams.kt | 15 +- .../api/models/ProjectCommitListResponse.kt | 86 ++++++-- .../api/models/ProjectCreateParams.kt | 88 +++++++- .../api/models/ProjectCreateResponse.kt | 57 +++++- .../ProjectInferencePipelineCreateParams.kt | 189 ++++++++++++++---- .../ProjectInferencePipelineCreateResponse.kt | 152 +++++++++++--- .../ProjectInferencePipelineListParams.kt | 18 +- .../ProjectInferencePipelineListResponse.kt | 170 ++++++++++++---- .../openlayer/api/models/ProjectListParams.kt | 12 +- .../api/models/ProjectListResponse.kt | 76 +++++-- .../models/StoragePresignedUrlCreateParams.kt | 9 + .../StoragePresignedUrlCreateResponse.kt | 10 + .../api/services/async/CommitServiceAsync.kt | 39 +++- .../services/async/CommitServiceAsyncImpl.kt | 72 +++++-- .../async/InferencePipelineServiceAsync.kt | 90 ++++++++- .../InferencePipelineServiceAsyncImpl.kt | 188 +++++++++++------ .../api/services/async/ProjectServiceAsync.kt | 81 +++++++- .../services/async/ProjectServiceAsyncImpl.kt | 139 ++++++++----- .../api/services/async/StorageServiceAsync.kt | 13 ++ .../services/async/StorageServiceAsyncImpl.kt | 16 ++ .../async/commits/TestResultServiceAsync.kt | 38 +++- .../commits/TestResultServiceAsyncImpl.kt | 65 ++++-- .../inferencePipelines/DataServiceAsync.kt | 38 +++- .../DataServiceAsyncImpl.kt | 69 ++++--- .../inferencePipelines/RowServiceAsync.kt | 36 +++- .../inferencePipelines/RowServiceAsyncImpl.kt | 69 ++++--- .../TestResultServiceAsync.kt | 40 +++- .../TestResultServiceAsyncImpl.kt | 65 ++++-- .../async/projects/CommitServiceAsync.kt | 59 +++++- .../async/projects/CommitServiceAsyncImpl.kt | 126 +++++++----- .../projects/InferencePipelineServiceAsync.kt | 63 +++++- .../InferencePipelineServiceAsyncImpl.kt | 126 +++++++----- .../async/storage/PresignedUrlServiceAsync.kt | 39 +++- .../storage/PresignedUrlServiceAsyncImpl.kt | 69 ++++--- .../api/services/blocking/CommitService.kt | 35 +++- .../services/blocking/CommitServiceImpl.kt | 66 ++++-- .../blocking/InferencePipelineService.kt | 85 +++++++- .../blocking/InferencePipelineServiceImpl.kt | 171 ++++++++++------ .../api/services/blocking/ProjectService.kt | 72 ++++++- .../services/blocking/ProjectServiceImpl.kt | 127 ++++++++---- .../api/services/blocking/StorageService.kt | 11 + .../services/blocking/StorageServiceImpl.kt | 16 ++ .../blocking/commits/TestResultService.kt | 34 +++- .../blocking/commits/TestResultServiceImpl.kt | 59 ++++-- .../inferencePipelines/DataService.kt | 36 +++- .../inferencePipelines/DataServiceImpl.kt | 63 ++++-- .../blocking/inferencePipelines/RowService.kt | 35 +++- .../inferencePipelines/RowServiceImpl.kt | 63 ++++-- .../inferencePipelines/TestResultService.kt | 36 +++- .../TestResultServiceImpl.kt | 59 ++++-- .../blocking/projects/CommitService.kt | 54 ++++- .../blocking/projects/CommitServiceImpl.kt | 114 +++++++---- .../projects/InferencePipelineService.kt | 61 +++++- .../projects/InferencePipelineServiceImpl.kt | 114 +++++++---- .../blocking/storage/PresignedUrlService.kt | 37 +++- .../storage/PresignedUrlServiceImpl.kt | 63 ++++-- openlayer-java/build.gradle.kts | 21 ++ 99 files changed, 4526 insertions(+), 1410 deletions(-) delete mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/core/HttpRequestBodies.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Timeout.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBodies.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponseFor.kt diff --git a/.gitignore b/.gitignore index 39c31e3e..4e81838d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .prism.log .gradle .idea +.kotlin build codegen.log kls_database.db diff --git a/README.md b/README.md index b4545652..fb01744f 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![Maven Central](https://img.shields.io/maven-central/v/com.openlayer.api/openlayer-java)](https://central.sonatype.com/artifact/com.openlayer.api/openlayer-java/0.1.0-alpha.11) +[![javadoc](https://javadoc.io/badge2/com.openlayer.api/openlayer-java/0.1.0-alpha.11/javadoc.svg)](https://javadoc.io/doc/com.openlayer.api/openlayer-java/0.1.0-alpha.11) @@ -10,7 +11,7 @@ The Openlayer Java SDK provides convenient access to the Openlayer REST API from It is generated with [Stainless](https://www.stainless.com/). -The REST API documentation can be found on [openlayer.com](https://openlayer.com/docs/api-reference/rest/overview). +The REST API documentation can be found on [openlayer.com](https://openlayer.com/docs/api-reference/rest/overview). Javadocs are also available on [javadoc.io](https://javadoc.io/doc/com.openlayer.api/openlayer-java/0.1.0-alpha.11). ## Installation @@ -200,6 +201,50 @@ CompletableFuture response = client.inferen The asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s. +## Raw responses + +The SDK defines methods that deserialize responses into instances of Java classes. However, these methods don't provide access to the response headers, status code, or the raw response body. + +To access this data, prefix any HTTP method call on a client or service with `withRawResponse()`: + +```java +import com.openlayer.api.core.JsonValue; +import com.openlayer.api.core.http.Headers; +import com.openlayer.api.core.http.HttpResponseFor; +import com.openlayer.api.models.InferencePipelineDataStreamParams; +import com.openlayer.api.models.InferencePipelineDataStreamResponse; + +InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config(InferencePipelineDataStreamParams.Config.LlmData.builder() + .addInputVariableName("user_query") + .outputColumnName("output") + .numOfTokenColumnName("tokens") + .costColumnName("cost") + .timestampColumnName("timestamp") + .build()) + .addRow(InferencePipelineDataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("what is the meaning of life?")) + .putAdditionalProperty("output", JsonValue.from("42")) + .putAdditionalProperty("tokens", JsonValue.from(7)) + .putAdditionalProperty("cost", JsonValue.from(0.02)) + .putAdditionalProperty("timestamp", JsonValue.from(1610000000)) + .build()) + .build(); +HttpResponseFor response = client.inferencePipelines().data().withRawResponse().stream(params); + +int statusCode = response.statusCode(); +Headers headers = response.headers(); +``` + +You can still deserialize the response into an instance of a Java class if needed: + +```java +import com.openlayer.api.models.InferencePipelineDataStreamResponse; + +InferencePipelineDataStreamResponse parsedResponse = response.parse(); +``` + ## Error handling The SDK throws custom unchecked exception types: @@ -335,9 +380,24 @@ InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.bui .build(); ``` -These can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods. You can also set undocumented parameters on nested headers, query params, or body classes using the `putAdditionalProperty` method. These properties can be accessed on the built object later using the `_additionalProperties()` method. +These can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods. -To set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](openlayer-java-core/src/main/kotlin/com/openlayer/api/core/JsonValue.kt) object to its setter: +To set undocumented parameters on _nested_ headers, query params, or body classes, call the `putAdditionalProperty` method on the nested class: + +```java +import com.openlayer.api.core.JsonValue; +import com.openlayer.api.models.ProjectCreateParams; + +ProjectCreateParams params = ProjectCreateParams.builder() + .links(ProjectCreateParams.Links.builder() + .putAdditionalProperty("secretProperty", JsonValue.from("42")) + .build()) + .build(); +``` + +These properties can be accessed on the nested built object later using the `_additionalProperties()` method. + +To set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt) object to its setter: ```java import com.openlayer.api.core.JsonValue; @@ -356,6 +416,45 @@ InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.bui .build(); ``` +The most straightforward way to create a [`JsonValue`](openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt) is using its `from(...)` method: + +```java +import com.openlayer.api.core.JsonValue; +import java.util.List; +import java.util.Map; + +// Create primitive JSON values +JsonValue nullValue = JsonValue.from(null); +JsonValue booleanValue = JsonValue.from(true); +JsonValue numberValue = JsonValue.from(42); +JsonValue stringValue = JsonValue.from("Hello World!"); + +// Create a JSON array value equivalent to `["Hello", "World"]` +JsonValue arrayValue = JsonValue.from(List.of( + "Hello", "World" +)); + +// Create a JSON object value equivalent to `{ "a": 1, "b": 2 }` +JsonValue objectValue = JsonValue.from(Map.of( + "a", 1, + "b", 2 +)); + +// Create an arbitrarily nested JSON equivalent to: +// { +// "a": [1, 2], +// "b": [3, 4] +// } +JsonValue complexValue = JsonValue.from(Map.of( + "a", List.of( + 1, 2 + ), + "b", List.of( + 3, 4 + ) +)); +``` + ### Response properties To access undocumented response properties, call the `_additionalProperties()` method: diff --git a/build.gradle.kts b/build.gradle.kts index 9e6b6623..90d26370 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,23 @@ +plugins { + id("org.jetbrains.dokka") version "2.0.0" +} + +repositories { + mavenCentral() +} + allprojects { group = "com.openlayer.api" version = "0.1.0-alpha.11" // x-release-please-version } + +subprojects { + apply(plugin = "org.jetbrains.dokka") +} + +// Avoid race conditions between `dokkaJavadocCollector` and `dokkaJavadocJar` tasks +tasks.named("dokkaJavadocCollector").configure { + subprojects.flatMap { it.tasks } + .filter { it.project.name != "openlayer-java" && it.name == "dokkaJavadocJar" } + .forEach { mustRunAfter(it) } +} diff --git a/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts b/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts index 7e46247b..703a05e9 100644 --- a/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts @@ -22,11 +22,12 @@ configure { tasks.withType().configureEach { compilerOptions { + allWarningsAsErrors = true freeCompilerArgs = listOf( - "-Xjvm-default=all", - "-Xjdk-release=1.8", - // Suppress deprecation warnings because we may still reference and test deprecated members. - "-Xsuppress-warning=DEPRECATION" + "-Xjvm-default=all", + "-Xjdk-release=1.8", + // Suppress deprecation warnings because we may still reference and test deprecated members. + "-Xsuppress-warning=DEPRECATION" ) jvmTarget.set(JvmTarget.JVM_1_8) } diff --git a/buildSrc/src/main/kotlin/openlayer.publish.gradle.kts b/buildSrc/src/main/kotlin/openlayer.publish.gradle.kts index 51f10524..5f23d62a 100644 --- a/buildSrc/src/main/kotlin/openlayer.publish.gradle.kts +++ b/buildSrc/src/main/kotlin/openlayer.publish.gradle.kts @@ -1,3 +1,5 @@ +import com.vanniktech.maven.publish.JavadocJar +import com.vanniktech.maven.publish.KotlinJvm import com.vanniktech.maven.publish.MavenPublishBaseExtension import com.vanniktech.maven.publish.SonatypeHost @@ -19,6 +21,12 @@ configure { publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) coordinates(project.group.toString(), project.name, project.version.toString()) + configure( + KotlinJvm( + javadocJar = JavadocJar.Dokka("dokkaJavadoc"), + sourcesJar = true, + ) + ) pom { name.set("Openlayer API") diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt index d5dc82df..83f7a9cf 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt @@ -1,6 +1,7 @@ package com.openlayer.api.client.okhttp import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.Timeout import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.HttpClient @@ -88,13 +89,12 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val ) } - val timeout = requestOptions.timeout - if (timeout != null) { + requestOptions.timeout?.let { clientBuilder - .connectTimeout(timeout) - .readTimeout(timeout) - .writeTimeout(timeout) - .callTimeout(if (timeout.seconds == 0L) timeout else timeout.plusSeconds(30)) + .connectTimeout(it.connect()) + .readTimeout(it.read()) + .writeTimeout(it.write()) + .callTimeout(it.request()) } val client = clientBuilder.build() @@ -195,23 +195,24 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val class Builder internal constructor() { private var baseUrl: HttpUrl? = null - // The default timeout is 1 minute. - private var timeout: Duration = Duration.ofSeconds(60) + private var timeout: Timeout = Timeout.default() private var proxy: Proxy? = null fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl.toHttpUrl() } - fun timeout(timeout: Duration) = apply { this.timeout = timeout } + fun timeout(timeout: Timeout) = apply { this.timeout = timeout } + + fun timeout(timeout: Duration) = timeout(Timeout.builder().request(timeout).build()) fun proxy(proxy: Proxy?) = apply { this.proxy = proxy } fun build(): OkHttpClient = OkHttpClient( okhttp3.OkHttpClient.Builder() - .connectTimeout(timeout) - .readTimeout(timeout) - .writeTimeout(timeout) - .callTimeout(if (timeout.seconds == 0L) timeout else timeout.plusSeconds(30)) + .connectTimeout(timeout.connect()) + .readTimeout(timeout.read()) + .writeTimeout(timeout.write()) + .callTimeout(timeout.request()) .proxy(proxy) .build(), checkRequired("baseUrl", baseUrl), diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt index 56f960da..a8e78d19 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt @@ -6,17 +6,20 @@ import com.fasterxml.jackson.databind.json.JsonMapper import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.OpenlayerClientImpl import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.Timeout import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams import java.net.Proxy import java.time.Clock import java.time.Duration import java.util.Optional +import kotlin.jvm.optionals.getOrNull class OpenlayerOkHttpClient private constructor() { companion object { + /** Returns a mutable builder for constructing an instance of [OpenlayerOkHttpClient]. */ @JvmStatic fun builder() = Builder() @JvmStatic fun fromEnv(): OpenlayerClient = builder().fromEnv().build() @@ -27,8 +30,7 @@ class OpenlayerOkHttpClient private constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() private var baseUrl: String = ClientOptions.PRODUCTION_URL - // The default timeout for the client is 1 minute. - private var timeout: Duration = Duration.ofSeconds(60) + private var timeout: Timeout = Timeout.default() private var proxy: Proxy? = null fun baseUrl(baseUrl: String) = apply { @@ -120,7 +122,19 @@ class OpenlayerOkHttpClient private constructor() { clientOptions.removeAllQueryParams(keys) } - fun timeout(timeout: Duration) = apply { this.timeout = timeout } + fun timeout(timeout: Timeout) = apply { + clientOptions.timeout(timeout) + this.timeout = timeout + } + + /** + * Sets the maximum time allowed for a complete HTTP call, not including retries. + * + * See [Timeout.request] for more details. + * + * For fine-grained control, pass a [Timeout] object. + */ + fun timeout(timeout: Duration) = timeout(Timeout.builder().request(timeout).build()) fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) } @@ -132,7 +146,7 @@ class OpenlayerOkHttpClient private constructor() { fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) } - fun apiKey(apiKey: Optional) = apiKey(apiKey.orElse(null)) + fun apiKey(apiKey: Optional) = apiKey(apiKey.getOrNull()) fun fromEnv() = apply { clientOptions.fromEnv() } diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt index ecb83599..d41b82f7 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt @@ -6,17 +6,22 @@ import com.fasterxml.jackson.databind.json.JsonMapper import com.openlayer.api.client.OpenlayerClientAsync import com.openlayer.api.client.OpenlayerClientAsyncImpl import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.Timeout import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams import java.net.Proxy import java.time.Clock import java.time.Duration import java.util.Optional +import kotlin.jvm.optionals.getOrNull class OpenlayerOkHttpClientAsync private constructor() { companion object { + /** + * Returns a mutable builder for constructing an instance of [OpenlayerOkHttpClientAsync]. + */ @JvmStatic fun builder() = Builder() @JvmStatic fun fromEnv(): OpenlayerClientAsync = builder().fromEnv().build() @@ -27,8 +32,7 @@ class OpenlayerOkHttpClientAsync private constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() private var baseUrl: String = ClientOptions.PRODUCTION_URL - // The default timeout for the client is 1 minute. - private var timeout: Duration = Duration.ofSeconds(60) + private var timeout: Timeout = Timeout.default() private var proxy: Proxy? = null fun baseUrl(baseUrl: String) = apply { @@ -120,7 +124,19 @@ class OpenlayerOkHttpClientAsync private constructor() { clientOptions.removeAllQueryParams(keys) } - fun timeout(timeout: Duration) = apply { this.timeout = timeout } + fun timeout(timeout: Timeout) = apply { + clientOptions.timeout(timeout) + this.timeout = timeout + } + + /** + * Sets the maximum time allowed for a complete HTTP call, not including retries. + * + * See [Timeout.request] for more details. + * + * For fine-grained control, pass a [Timeout] object. + */ + fun timeout(timeout: Duration) = timeout(Timeout.builder().request(timeout).build()) fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) } @@ -132,7 +148,7 @@ class OpenlayerOkHttpClientAsync private constructor() { fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) } - fun apiKey(apiKey: Optional) = apiKey(apiKey.orElse(null)) + fun apiKey(apiKey: Optional) = apiKey(apiKey.getOrNull()) fun fromEnv() = apply { clientOptions.fromEnv() } diff --git a/openlayer-java-core/build.gradle.kts b/openlayer-java-core/build.gradle.kts index cbb56c6f..a6caa5b3 100644 --- a/openlayer-java-core/build.gradle.kts +++ b/openlayer-java-core/build.gradle.kts @@ -6,6 +6,7 @@ plugins { dependencies { api("com.fasterxml.jackson.core:jackson-core:2.18.1") api("com.fasterxml.jackson.core:jackson-databind:2.18.1") + api("com.google.errorprone:error_prone_annotations:2.33.0") implementation("com.fasterxml.jackson.core:jackson-annotations:2.18.1") implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.1") diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt index 621c6e7a..7697f0c8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt @@ -31,6 +31,11 @@ interface OpenlayerClient { */ fun async(): OpenlayerClientAsync + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun projects(): ProjectService fun commits(): CommitService @@ -51,4 +56,16 @@ interface OpenlayerClient { * method. */ fun close() + + /** A view of [OpenlayerClient] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + fun projects(): ProjectService.WithRawResponse + + fun commits(): CommitService.WithRawResponse + + fun inferencePipelines(): InferencePipelineService.WithRawResponse + + fun storage(): StorageService.WithRawResponse + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt index f8c3b6de..cd90e546 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt @@ -31,6 +31,11 @@ interface OpenlayerClientAsync { */ fun sync(): OpenlayerClient + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun projects(): ProjectServiceAsync fun commits(): CommitServiceAsync @@ -51,4 +56,18 @@ interface OpenlayerClientAsync { * method. */ fun close() + + /** + * A view of [OpenlayerClientAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + fun projects(): ProjectServiceAsync.WithRawResponse + + fun commits(): CommitServiceAsync.WithRawResponse + + fun inferencePipelines(): InferencePipelineServiceAsync.WithRawResponse + + fun storage(): StorageServiceAsync.WithRawResponse + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt index 85b8f6e6..1a5e1785 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt @@ -26,6 +26,10 @@ class OpenlayerClientAsyncImpl(private val clientOptions: ClientOptions) : Openl // Pass the original clientOptions so that this client sets its own User-Agent. private val sync: OpenlayerClient by lazy { OpenlayerClientImpl(clientOptions) } + private val withRawResponse: OpenlayerClientAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + private val projects: ProjectServiceAsync by lazy { ProjectServiceAsyncImpl(clientOptionsWithUserAgent) } @@ -44,6 +48,8 @@ class OpenlayerClientAsyncImpl(private val clientOptions: ClientOptions) : Openl override fun sync(): OpenlayerClient = sync + override fun withRawResponse(): OpenlayerClientAsync.WithRawResponse = withRawResponse + override fun projects(): ProjectServiceAsync = projects override fun commits(): CommitServiceAsync = commits @@ -53,4 +59,33 @@ class OpenlayerClientAsyncImpl(private val clientOptions: ClientOptions) : Openl override fun storage(): StorageServiceAsync = storage override fun close() = clientOptions.httpClient.close() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + OpenlayerClientAsync.WithRawResponse { + + private val projects: ProjectServiceAsync.WithRawResponse by lazy { + ProjectServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val commits: CommitServiceAsync.WithRawResponse by lazy { + CommitServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val inferencePipelines: InferencePipelineServiceAsync.WithRawResponse by lazy { + InferencePipelineServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val storage: StorageServiceAsync.WithRawResponse by lazy { + StorageServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun projects(): ProjectServiceAsync.WithRawResponse = projects + + override fun commits(): CommitServiceAsync.WithRawResponse = commits + + override fun inferencePipelines(): InferencePipelineServiceAsync.WithRawResponse = + inferencePipelines + + override fun storage(): StorageServiceAsync.WithRawResponse = storage + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt index 3b607e5f..f11b7575 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt @@ -26,6 +26,10 @@ class OpenlayerClientImpl(private val clientOptions: ClientOptions) : OpenlayerC // Pass the original clientOptions so that this client sets its own User-Agent. private val async: OpenlayerClientAsync by lazy { OpenlayerClientAsyncImpl(clientOptions) } + private val withRawResponse: OpenlayerClient.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + private val projects: ProjectService by lazy { ProjectServiceImpl(clientOptionsWithUserAgent) } private val commits: CommitService by lazy { CommitServiceImpl(clientOptionsWithUserAgent) } @@ -38,6 +42,8 @@ class OpenlayerClientImpl(private val clientOptions: ClientOptions) : OpenlayerC override fun async(): OpenlayerClientAsync = async + override fun withRawResponse(): OpenlayerClient.WithRawResponse = withRawResponse + override fun projects(): ProjectService = projects override fun commits(): CommitService = commits @@ -47,4 +53,33 @@ class OpenlayerClientImpl(private val clientOptions: ClientOptions) : OpenlayerC override fun storage(): StorageService = storage override fun close() = clientOptions.httpClient.close() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + OpenlayerClient.WithRawResponse { + + private val projects: ProjectService.WithRawResponse by lazy { + ProjectServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val commits: CommitService.WithRawResponse by lazy { + CommitServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val inferencePipelines: InferencePipelineService.WithRawResponse by lazy { + InferencePipelineServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val storage: StorageService.WithRawResponse by lazy { + StorageServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun projects(): ProjectService.WithRawResponse = projects + + override fun commits(): CommitService.WithRawResponse = commits + + override fun inferencePipelines(): InferencePipelineService.WithRawResponse = + inferencePipelines + + override fun storage(): StorageService.WithRawResponse = storage + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt index 7769d6ed..4101db01 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt @@ -5,6 +5,18 @@ package com.openlayer.api.core fun checkRequired(name: String, value: T?): T = checkNotNull(value) { "`$name` is required, but was not set" } +@JvmSynthetic +internal fun checkKnown(name: String, value: JsonField): T = + value.asKnown().orElseThrow { + IllegalStateException("`$name` is not a known type: ${value.javaClass.simpleName}") + } + +@JvmSynthetic +internal fun checkKnown(name: String, value: MultipartField): T = + value.value.asKnown().orElseThrow { + IllegalStateException("`$name` is not a known type: ${value.javaClass.simpleName}") + } + @JvmSynthetic internal fun checkLength(name: String, value: String, length: Int): String = value.also { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt index 9c72c1ad..1606933d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt @@ -10,6 +10,7 @@ import com.openlayer.api.core.http.QueryParams import com.openlayer.api.core.http.RetryingHttpClient import java.time.Clock import java.util.Optional +import kotlin.jvm.optionals.getOrNull class ClientOptions private constructor( @@ -21,16 +22,27 @@ private constructor( @get:JvmName("headers") val headers: Headers, @get:JvmName("queryParams") val queryParams: QueryParams, @get:JvmName("responseValidation") val responseValidation: Boolean, + @get:JvmName("timeout") val timeout: Timeout, @get:JvmName("maxRetries") val maxRetries: Int, - @get:JvmName("apiKey") val apiKey: String?, + private val apiKey: String?, ) { + fun apiKey(): Optional = Optional.ofNullable(apiKey) + fun toBuilder() = Builder().from(this) companion object { const val PRODUCTION_URL = "https://api.openlayer.com/v1" + /** + * Returns a mutable builder for constructing an instance of [ClientOptions]. + * + * The following fields are required: + * ```java + * .httpClient() + * ``` + */ @JvmStatic fun builder() = Builder() @JvmStatic fun fromEnv(): ClientOptions = builder().fromEnv().build() @@ -46,6 +58,7 @@ private constructor( private var headers: Headers.Builder = Headers.builder() private var queryParams: QueryParams.Builder = QueryParams.builder() private var responseValidation: Boolean = false + private var timeout: Timeout = Timeout.default() private var maxRetries: Int = 2 private var apiKey: String? = null @@ -58,6 +71,7 @@ private constructor( headers = clientOptions.headers.toBuilder() queryParams = clientOptions.queryParams.toBuilder() responseValidation = clientOptions.responseValidation + timeout = clientOptions.timeout maxRetries = clientOptions.maxRetries apiKey = clientOptions.apiKey } @@ -74,11 +88,13 @@ private constructor( this.responseValidation = responseValidation } + fun timeout(timeout: Timeout) = apply { this.timeout = timeout } + fun maxRetries(maxRetries: Int) = apply { this.maxRetries = maxRetries } fun apiKey(apiKey: String?) = apply { this.apiKey = apiKey } - fun apiKey(apiKey: Optional) = apiKey(apiKey.orElse(null)) + fun apiKey(apiKey: Optional) = apiKey(apiKey.getOrNull()) fun headers(headers: Headers) = apply { this.headers.clear() @@ -197,6 +213,7 @@ private constructor( headers.build(), queryParams.build(), responseValidation, + timeout, maxRetries, apiKey, ) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/HttpRequestBodies.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/HttpRequestBodies.kt deleted file mode 100644 index 9372483c..00000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/HttpRequestBodies.kt +++ /dev/null @@ -1,108 +0,0 @@ -@file:JvmName("HttpRequestBodies") - -package com.openlayer.api.core - -import com.fasterxml.jackson.databind.json.JsonMapper -import com.openlayer.api.core.http.HttpRequestBody -import com.openlayer.api.errors.OpenlayerException -import java.io.ByteArrayOutputStream -import java.io.OutputStream -import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder - -@JvmSynthetic -internal inline fun json(jsonMapper: JsonMapper, value: T): HttpRequestBody { - return object : HttpRequestBody { - private var cachedBytes: ByteArray? = null - - private fun serialize(): ByteArray { - if (cachedBytes != null) return cachedBytes!! - - val buffer = ByteArrayOutputStream() - try { - jsonMapper.writeValue(buffer, value) - cachedBytes = buffer.toByteArray() - return cachedBytes!! - } catch (e: Exception) { - throw OpenlayerException("Error writing request", e) - } - } - - override fun writeTo(outputStream: OutputStream) { - outputStream.write(serialize()) - } - - override fun contentType(): String = "application/json" - - override fun contentLength(): Long { - return serialize().size.toLong() - } - - override fun repeatable(): Boolean = true - - override fun close() {} - } -} - -@JvmSynthetic -internal fun multipartFormData( - jsonMapper: JsonMapper, - parts: Array?>, -): HttpRequestBody { - val builder = MultipartEntityBuilder.create() - parts.forEach { part -> - if (part?.value != null) { - when (part.value) { - is JsonValue -> { - val buffer = ByteArrayOutputStream() - try { - jsonMapper.writeValue(buffer, part.value) - } catch (e: Exception) { - throw OpenlayerException("Error serializing value to json", e) - } - builder.addBinaryBody( - part.name, - buffer.toByteArray(), - part.contentType, - part.filename, - ) - } - is Boolean -> - builder.addTextBody( - part.name, - if (part.value) "true" else "false", - part.contentType, - ) - is Int -> builder.addTextBody(part.name, part.value.toString(), part.contentType) - is Long -> builder.addTextBody(part.name, part.value.toString(), part.contentType) - is Double -> builder.addTextBody(part.name, part.value.toString(), part.contentType) - is ByteArray -> - builder.addBinaryBody(part.name, part.value, part.contentType, part.filename) - is String -> builder.addTextBody(part.name, part.value, part.contentType) - is Enum -> builder.addTextBody(part.name, part.value.toString(), part.contentType) - else -> - throw IllegalArgumentException( - "Unsupported content type: ${part.value::class.java.simpleName}" - ) - } - } - } - val entity = builder.build() - - return object : HttpRequestBody { - override fun writeTo(outputStream: OutputStream) { - try { - return entity.writeTo(outputStream) - } catch (e: Exception) { - throw OpenlayerException("Error writing request", e) - } - } - - override fun contentType(): String = entity.contentType - - override fun contentLength(): Long = -1 - - override fun repeatable(): Boolean = entity.isRepeatable - - override fun close() = entity.close() - } -} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt index 2a22f38a..f34c69bd 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt @@ -3,19 +3,28 @@ package com.openlayer.api.core import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.core.JsonGenerator import com.fasterxml.jackson.databind.DeserializationFeature import com.fasterxml.jackson.databind.SerializationFeature +import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.cfg.CoercionAction.Fail import com.fasterxml.jackson.databind.cfg.CoercionInputShape.Integer +import com.fasterxml.jackson.databind.exc.InvalidDefinitionException +import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.databind.module.SimpleModule import com.fasterxml.jackson.datatype.jdk8.Jdk8Module import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import com.fasterxml.jackson.module.kotlin.jacksonMapperBuilder +import com.openlayer.api.errors.OpenlayerException +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.io.InputStream fun jsonMapper(): JsonMapper = jacksonMapperBuilder() .addModule(Jdk8Module()) .addModule(JavaTimeModule()) + .addModule(SimpleModule().addSerializer(InputStreamJsonSerializer)) .serializationInclusion(JsonInclude.Include.NON_ABSENT) .disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE) .disable(SerializationFeature.FLUSH_AFTER_WRITE_VALUE) @@ -23,3 +32,53 @@ fun jsonMapper(): JsonMapper = .disable(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS) .withCoercionConfig(String::class.java) { it.setCoercion(Integer, Fail) } .build() + +private object InputStreamJsonSerializer : BaseSerializer(InputStream::class) { + + override fun serialize( + value: InputStream?, + gen: JsonGenerator?, + serializers: SerializerProvider?, + ) { + if (value == null) { + gen?.writeNull() + } else { + value.use { gen?.writeBinary(it.readBytes()) } + } + } +} + +@JvmSynthetic +internal fun enhanceJacksonException(fallbackMessage: String, e: Exception): Exception { + // These exceptions should only happen if our code is wrong OR if the user is using a binary + // incompatible version of `com.fasterxml.jackson.core:jackson-databind`: + // https://javadoc.io/static/com.fasterxml.jackson.core/jackson-databind/2.18.1/index.html + val isUnexpectedException = + e is UnrecognizedPropertyException || e is InvalidDefinitionException + if (!isUnexpectedException) { + return OpenlayerInvalidDataException(fallbackMessage, e) + } + + val jacksonVersion = JsonMapper::class.java.`package`.implementationVersion + if (jacksonVersion.isNullOrEmpty() || jacksonVersion == COMPILED_JACKSON_VERSION) { + return OpenlayerInvalidDataException(fallbackMessage, e) + } + + return OpenlayerException( + """ + Jackson threw an unexpected exception and its runtime version ($jacksonVersion) mismatches the version the SDK was compiled with ($COMPILED_JACKSON_VERSION). + + You may be using a version of `com.fasterxml.jackson.core:jackson-databind` that's not binary compatible with the SDK. + + This can happen if you are either: + 1. Directly depending on a different Jackson version + 2. Depending on some library that depends on a different Jackson version, potentially transitively + + Double-check that you are depending on a compatible Jackson version. + """ + .trimIndent(), + e, + ) +} + +const val COMPILED_JACKSON_VERSION = "2.18.1" diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt index 0bf29708..5ca3fddb 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt @@ -2,13 +2,7 @@ package com.openlayer.api.core import java.time.Duration -class RequestOptions private constructor(val responseValidation: Boolean?, val timeout: Duration?) { - fun applyDefaults(options: RequestOptions): RequestOptions { - return RequestOptions( - responseValidation = this.responseValidation ?: options.responseValidation, - timeout = this.timeout ?: options.timeout, - ) - } +class RequestOptions private constructor(val responseValidation: Boolean?, val timeout: Timeout?) { companion object { @@ -16,22 +10,37 @@ class RequestOptions private constructor(val responseValidation: Boolean?, val t @JvmStatic fun none() = NONE + @JvmSynthetic + internal fun from(clientOptions: ClientOptions): RequestOptions = + builder() + .responseValidation(clientOptions.responseValidation) + .timeout(clientOptions.timeout) + .build() + @JvmStatic fun builder() = Builder() } + fun applyDefaults(options: RequestOptions): RequestOptions = + RequestOptions( + responseValidation = responseValidation ?: options.responseValidation, + timeout = + if (options.timeout != null && timeout != null) timeout.assign(options.timeout) + else timeout ?: options.timeout, + ) + class Builder internal constructor() { private var responseValidation: Boolean? = null - private var timeout: Duration? = null + private var timeout: Timeout? = null fun responseValidation(responseValidation: Boolean) = apply { this.responseValidation = responseValidation } - fun timeout(timeout: Duration) = apply { this.timeout = timeout } + fun timeout(timeout: Timeout) = apply { this.timeout = timeout } - fun build(): RequestOptions { - return RequestOptions(responseValidation, timeout) - } + fun timeout(timeout: Duration) = timeout(Timeout.builder().request(timeout).build()) + + fun build(): RequestOptions = RequestOptions(responseValidation, timeout) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Timeout.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Timeout.kt new file mode 100644 index 00000000..cb3f493c --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Timeout.kt @@ -0,0 +1,189 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.core + +import java.time.Duration +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** A class containing timeouts for various processing phases of a request. */ +class Timeout +private constructor( + private val connect: Duration?, + private val read: Duration?, + private val write: Duration?, + private val request: Duration?, +) { + + /** + * The maximum time allowed to establish a connection with a host. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `Duration.ofMinutes(1)`. + */ + fun connect(): Duration = connect ?: Duration.ofMinutes(1) + + /** + * The maximum time allowed between two data packets when waiting for the server’s response. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `request()`. + */ + fun read(): Duration = read ?: request() + + /** + * The maximum time allowed between two data packets when sending the request to the server. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `request()`. + */ + fun write(): Duration = write ?: request() + + /** + * The maximum time allowed for a complete HTTP call, not including retries. + * + * This includes resolving DNS, connecting, writing the request body, server processing, as well + * as reading the response body. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `Duration.ofMinutes(1)`. + */ + fun request(): Duration = request ?: Duration.ofMinutes(1) + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun default() = builder().build() + + /** Returns a mutable builder for constructing an instance of [Timeout]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Timeout]. */ + class Builder internal constructor() { + + private var connect: Duration? = null + private var read: Duration? = null + private var write: Duration? = null + private var request: Duration? = null + + @JvmSynthetic + internal fun from(timeout: Timeout) = apply { + connect = timeout.connect + read = timeout.read + write = timeout.write + request = timeout.request + } + + /** + * The maximum time allowed to establish a connection with a host. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `Duration.ofMinutes(1)`. + */ + fun connect(connect: Duration?) = apply { this.connect = connect } + + /** + * The maximum time allowed to establish a connection with a host. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `Duration.ofMinutes(1)`. + */ + fun connect(connect: Optional) = connect(connect.getOrNull()) + + /** + * The maximum time allowed between two data packets when waiting for the server’s response. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `request()`. + */ + fun read(read: Duration?) = apply { this.read = read } + + /** + * The maximum time allowed between two data packets when waiting for the server’s response. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `request()`. + */ + fun read(read: Optional) = read(read.getOrNull()) + + /** + * The maximum time allowed between two data packets when sending the request to the server. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `request()`. + */ + fun write(write: Duration?) = apply { this.write = write } + + /** + * The maximum time allowed between two data packets when sending the request to the server. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `request()`. + */ + fun write(write: Optional) = write(write.getOrNull()) + + /** + * The maximum time allowed for a complete HTTP call, not including retries. + * + * This includes resolving DNS, connecting, writing the request body, server processing, as + * well as reading the response body. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `Duration.ofMinutes(1)`. + */ + fun request(request: Duration?) = apply { this.request = request } + + /** + * The maximum time allowed for a complete HTTP call, not including retries. + * + * This includes resolving DNS, connecting, writing the request body, server processing, as + * well as reading the response body. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `Duration.ofMinutes(1)`. + */ + fun request(request: Optional) = request(request.getOrNull()) + + fun build(): Timeout = Timeout(connect, read, write, request) + } + + @JvmSynthetic + internal fun assign(target: Timeout): Timeout = + target + .toBuilder() + .apply { + connect?.let(this::connect) + read?.let(this::read) + write?.let(this::write) + request?.let(this::request) + } + .build() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Timeout && connect == other.connect && read == other.read && write == other.write && request == other.request /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(connect, read, write, request) /* spotless:on */ + + override fun toString() = + "Timeout{connect=$connect, read=$read, write=$write, request=$request}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt index 5cdfc28e..3722256a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt @@ -27,10 +27,9 @@ import com.fasterxml.jackson.databind.node.JsonNodeType.POJO import com.fasterxml.jackson.databind.node.JsonNodeType.STRING import com.fasterxml.jackson.databind.ser.std.NullSerializer import com.openlayer.api.errors.OpenlayerInvalidDataException -import java.nio.charset.Charset +import java.io.InputStream import java.util.Objects import java.util.Optional -import org.apache.hc.core5.http.ContentType @JsonDeserialize(using = JsonField.Deserializer::class) sealed class JsonField { @@ -287,12 +286,12 @@ private constructor( return true } - return other is KnownValue<*> && value == other.value + return other is KnownValue<*> && value contentEquals other.value } - override fun hashCode() = value.hashCode() + override fun hashCode() = contentHash(value) - override fun toString() = value.toString() + override fun toString() = value.contentToString() companion object { @JsonCreator @JvmStatic fun of(value: T) = KnownValue(value) @@ -462,15 +461,66 @@ annotation class ExcludeMissing ) annotation class NoAutoDetect -class MultipartFormValue -internal constructor( - val name: String, - val value: T, - val contentType: ContentType, - val filename: String? = null, +class MultipartField +private constructor( + @get:JvmName("value") val value: JsonField, + @get:JvmName("contentType") val contentType: String, + private val filename: String?, ) { - private val hashCode: Int by lazy { contentHash(name, value, contentType, filename) } + companion object { + + @JvmStatic fun of(value: T?) = builder().value(value).build() + + @JvmStatic fun of(value: JsonField) = builder().value(value).build() + + @JvmStatic fun builder() = Builder() + } + + fun filename(): Optional = Optional.ofNullable(filename) + + @JvmSynthetic + internal fun map(transform: (T) -> R): MultipartField = + MultipartField.builder() + .value(value.map(transform)) + .contentType(contentType) + .filename(filename) + .build() + + /** A builder for [MultipartField]. */ + class Builder internal constructor() { + + private var value: JsonField? = null + private var contentType: String? = null + private var filename: String? = null + + fun value(value: JsonField) = apply { this.value = value } + + fun value(value: T?) = value(JsonField.ofNullable(value)) + + fun contentType(contentType: String) = apply { this.contentType = contentType } + + fun filename(filename: String?) = apply { this.filename = filename } + + fun filename(filename: Optional) = filename(filename.orElse(null)) + + fun build(): MultipartField { + val value = checkRequired("value", value) + return MultipartField( + value, + contentType + ?: if ( + value is KnownValue && + (value.value is InputStream || value.value is ByteArray) + ) + "application/octet-stream" + else "text/plain; charset=utf-8", + filename, + ) + } + } + + private val hashCode: Int by lazy { contentHash(value, contentType, filename) } override fun hashCode(): Int = hashCode @@ -479,63 +529,12 @@ internal constructor( return true } - return other is MultipartFormValue<*> && - name == other.name && - value contentEquals other.value && + return other is MultipartField<*> && + value == other.value && contentType == other.contentType && filename == other.filename } override fun toString(): String = - "MultipartFormValue{name=$name, contentType=$contentType, filename=$filename, value=${valueToString()}}" - - private fun valueToString(): String = - when (value) { - is ByteArray -> "ByteArray of size ${value.size}" - else -> value.toString() - } - - companion object { - internal fun fromString( - name: String, - value: String, - contentType: ContentType, - ): MultipartFormValue = MultipartFormValue(name, value, contentType) - - internal fun fromBoolean( - name: String, - value: Boolean, - contentType: ContentType, - ): MultipartFormValue = MultipartFormValue(name, value, contentType) - - internal fun fromLong( - name: String, - value: Long, - contentType: ContentType, - ): MultipartFormValue = MultipartFormValue(name, value, contentType) - - internal fun fromDouble( - name: String, - value: Double, - contentType: ContentType, - ): MultipartFormValue = MultipartFormValue(name, value, contentType) - - internal fun fromEnum( - name: String, - value: T, - contentType: ContentType, - ): MultipartFormValue = MultipartFormValue(name, value, contentType) - - internal fun fromByteArray( - name: String, - value: ByteArray, - contentType: ContentType, - filename: String? = null, - ): MultipartFormValue = MultipartFormValue(name, value, contentType, filename) - } -} - -internal object ContentTypes { - val DefaultText = ContentType.create(ContentType.TEXT_PLAIN.mimeType, Charset.forName("UTF-8")) - val DefaultBinary = ContentType.DEFAULT_BINARY + "MultipartField{value=$value, contentType=$contentType, filename=$filename}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/JsonHandler.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/JsonHandler.kt index 6babe3b3..9ed794b1 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/JsonHandler.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/JsonHandler.kt @@ -4,18 +4,17 @@ package com.openlayer.api.core.handlers import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.enhanceJacksonException import com.openlayer.api.core.http.HttpResponse import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.errors.OpenlayerException @JvmSynthetic internal inline fun jsonHandler(jsonMapper: JsonMapper): Handler = object : Handler { - override fun handle(response: HttpResponse): T { + override fun handle(response: HttpResponse): T = try { - return jsonMapper.readValue(response.body(), jacksonTypeRef()) + jsonMapper.readValue(response.body(), jacksonTypeRef()) } catch (e: Exception) { - throw OpenlayerException("Error reading response", e) + throw enhanceJacksonException("Error reading response", e) } - } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpClient.kt index e896be75..49aca933 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpClient.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpClient.kt @@ -1,5 +1,3 @@ -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.core.http import com.openlayer.api.core.RequestOptions @@ -8,18 +6,21 @@ import java.util.concurrent.CompletableFuture interface HttpClient : AutoCloseable { - @JvmOverloads fun execute( request: HttpRequest, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponse - @JvmOverloads + fun execute(request: HttpRequest): HttpResponse = execute(request, RequestOptions.none()) + fun executeAsync( request: HttpRequest, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + fun executeAsync(request: HttpRequest): CompletableFuture = + executeAsync(request, RequestOptions.none()) + /** Overridden from [AutoCloseable] to not have a checked exception in its signature. */ override fun close() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBodies.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBodies.kt new file mode 100644 index 00000000..6166963c --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBodies.kt @@ -0,0 +1,131 @@ +// File generated from our OpenAPI spec by Stainless. + +@file:JvmName("HttpRequestBodies") + +package com.openlayer.api.core.http + +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.databind.node.JsonNodeType +import com.openlayer.api.core.MultipartField +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.io.ByteArrayInputStream +import java.io.InputStream +import java.io.OutputStream +import kotlin.jvm.optionals.getOrNull +import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder +import org.apache.hc.core5.http.ContentType +import org.apache.hc.core5.http.HttpEntity + +@JvmSynthetic +internal inline fun json(jsonMapper: JsonMapper, value: T): HttpRequestBody = + object : HttpRequestBody { + private val bytes: ByteArray by lazy { jsonMapper.writeValueAsBytes(value) } + + override fun writeTo(outputStream: OutputStream) = outputStream.write(bytes) + + override fun contentType(): String = "application/json" + + override fun contentLength(): Long = bytes.size.toLong() + + override fun repeatable(): Boolean = true + + override fun close() {} + } + +@JvmSynthetic +internal fun multipartFormData( + jsonMapper: JsonMapper, + fields: Map>, +): HttpRequestBody = + object : HttpRequestBody { + private val entity: HttpEntity by lazy { + MultipartEntityBuilder.create() + .apply { + fields.forEach { (name, field) -> + val knownValue = field.value.asKnown().getOrNull() + val parts = + if (knownValue is InputStream) { + // Read directly from the `InputStream` instead of reading it all + // into memory due to the `jsonMapper` serialization below. + sequenceOf(name to knownValue) + } else { + val node = jsonMapper.valueToTree(field.value) + serializePart(name, node) + } + + parts.forEach { (name, bytes) -> + addBinaryBody( + name, + bytes, + ContentType.parseLenient(field.contentType), + field.filename().getOrNull(), + ) + } + } + } + .build() + } + + private fun serializePart( + name: String, + node: JsonNode, + ): Sequence> = + when (node.nodeType) { + JsonNodeType.MISSING, + JsonNodeType.NULL -> emptySequence() + JsonNodeType.BINARY -> sequenceOf(name to ByteArrayInputStream(node.binaryValue())) + JsonNodeType.STRING -> sequenceOf(name to node.textValue().toInputStream()) + JsonNodeType.BOOLEAN -> + sequenceOf(name to node.booleanValue().toString().toInputStream()) + JsonNodeType.NUMBER -> + sequenceOf(name to node.numberValue().toString().toInputStream()) + JsonNodeType.ARRAY -> + sequenceOf( + name to + node + .elements() + .asSequence() + .mapNotNull { element -> + when (element.nodeType) { + JsonNodeType.MISSING, + JsonNodeType.NULL -> null + JsonNodeType.STRING -> node.textValue() + JsonNodeType.BOOLEAN -> node.booleanValue().toString() + JsonNodeType.NUMBER -> node.numberValue().toString() + null, + JsonNodeType.BINARY, + JsonNodeType.ARRAY, + JsonNodeType.OBJECT, + JsonNodeType.POJO -> + throw OpenlayerInvalidDataException( + "Unexpected JsonNode type in array: ${node.nodeType}" + ) + } + } + .joinToString(",") + .toInputStream() + ) + JsonNodeType.OBJECT -> + node.fields().asSequence().flatMap { (key, value) -> + serializePart("$name[$key]", value) + } + JsonNodeType.POJO, + null -> + throw OpenlayerInvalidDataException( + "Unexpected JsonNode type: ${node.nodeType}" + ) + } + + private fun String.toInputStream(): InputStream = ByteArrayInputStream(toByteArray()) + + override fun writeTo(outputStream: OutputStream) = entity.writeTo(outputStream) + + override fun contentType(): String = entity.contentType + + override fun contentLength(): Long = entity.contentLength + + override fun repeatable(): Boolean = entity.isRepeatable + + override fun close() = entity.close() + } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponseFor.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponseFor.kt new file mode 100644 index 00000000..594d4825 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponseFor.kt @@ -0,0 +1,23 @@ +package com.openlayer.api.core.http + +import java.io.InputStream + +interface HttpResponseFor : HttpResponse { + + fun parse(): T +} + +@JvmSynthetic +internal fun HttpResponse.parseable(parse: () -> T): HttpResponseFor = + object : HttpResponseFor { + + override fun parse(): T = parse() + + override fun statusCode(): Int = this@parseable.statusCode() + + override fun headers(): Headers = this@parseable.headers() + + override fun body(): InputStream = this@parseable.body() + + override fun close() = this@parseable.close() + } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt index c6bf606e..76f53c88 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt @@ -27,6 +27,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [OpenlayerError]. */ @JvmStatic fun builder() = Builder() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveParams.kt index 1cf69247..e529617c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveParams.kt @@ -38,6 +38,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [CommitRetrieveParams]. + * + * The following fields are required: + * ```java + * .projectVersionId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveResponse.kt index 5a3a6888..ce103110 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveResponse.kt @@ -19,6 +19,7 @@ import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class CommitRetrieveResponse @@ -238,6 +239,27 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [CommitRetrieveResponse]. + * + * The following fields are required: + * ```java + * .id() + * .commit() + * .dateArchived() + * .dateCreated() + * .failingGoalCount() + * .mlModelId() + * .passingGoalCount() + * .projectId() + * .status() + * .statusMessage() + * .storageUri() + * .totalGoalCount() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -303,7 +325,7 @@ private constructor( /** The commit archive date. */ fun dateArchived(dateArchived: Optional) = - dateArchived(dateArchived.orElse(null)) + dateArchived(dateArchived.getOrNull()) /** The commit archive date. */ fun dateArchived(dateArchived: JsonField) = apply { @@ -331,7 +353,7 @@ private constructor( fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) /** The model id. */ - fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.orElse(null)) + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) /** The model id. */ fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } @@ -369,7 +391,7 @@ private constructor( /** The commit status message. */ fun statusMessage(statusMessage: Optional) = - statusMessage(statusMessage.orElse(null)) + statusMessage(statusMessage.getOrNull()) /** The commit status message. */ fun statusMessage(statusMessage: JsonField) = apply { @@ -396,7 +418,7 @@ private constructor( /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: Optional) = - trainingDatasetId(trainingDatasetId.orElse(null)) + trainingDatasetId(trainingDatasetId.getOrNull()) /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: JsonField) = apply { @@ -409,7 +431,7 @@ private constructor( /** The validation dataset id. */ fun validationDatasetId(validationDatasetId: Optional) = - validationDatasetId(validationDatasetId.orElse(null)) + validationDatasetId(validationDatasetId.getOrNull()) /** The validation dataset id. */ fun validationDatasetId(validationDatasetId: JsonField) = apply { @@ -423,8 +445,7 @@ private constructor( fun archived(archived: Boolean) = archived(archived as Boolean?) /** Whether the commit is archived. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun archived(archived: Optional) = archived(archived.orElse(null) as Boolean?) + fun archived(archived: Optional) = archived(archived.getOrNull()) /** Whether the commit is archived. */ fun archived(archived: JsonField) = apply { this.archived = archived } @@ -649,6 +670,21 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Commit]. + * + * The following fields are required: + * ```java + * .id() + * .authorId() + * .fileSize() + * .message() + * .mlModelId() + * .storageUri() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -705,8 +741,7 @@ private constructor( fun fileSize(fileSize: Long) = fileSize(fileSize as Long?) /** The size of the commit bundle in bytes. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fileSize(fileSize: Optional) = fileSize(fileSize.orElse(null) as Long?) + fun fileSize(fileSize: Optional) = fileSize(fileSize.getOrNull()) /** The size of the commit bundle in bytes. */ fun fileSize(fileSize: JsonField) = apply { this.fileSize = fileSize } @@ -721,7 +756,7 @@ private constructor( fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) /** The model id. */ - fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.orElse(null)) + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) /** The model id. */ fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } @@ -738,7 +773,7 @@ private constructor( /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: Optional) = - trainingDatasetId(trainingDatasetId.orElse(null)) + trainingDatasetId(trainingDatasetId.getOrNull()) /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: JsonField) = apply { @@ -751,7 +786,7 @@ private constructor( /** The validation dataset id. */ fun validationDatasetId(validationDatasetId: Optional) = - validationDatasetId(validationDatasetId.orElse(null)) + validationDatasetId(validationDatasetId.getOrNull()) /** The validation dataset id. */ fun validationDatasetId(validationDatasetId: JsonField) = apply { @@ -1005,6 +1040,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Links]. + * + * The following fields are required: + * ```java + * .app() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt index 41381416..99bd7a37 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt @@ -13,6 +13,7 @@ import com.openlayer.api.core.http.QueryParams import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** List the test results for a project commit (project version). */ class CommitTestResultListParams @@ -78,6 +79,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [CommitTestResultListParams]. + * + * The following fields are required: + * ```java + * .projectVersionId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -119,9 +128,8 @@ private constructor( fun includeArchived(includeArchived: Boolean) = includeArchived(includeArchived as Boolean?) /** Include archived goals. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun includeArchived(includeArchived: Optional) = - includeArchived(includeArchived.orElse(null) as Boolean?) + includeArchived(includeArchived.getOrNull()) /** The page to return in a paginated query. */ fun page(page: Long?) = apply { this.page = page } @@ -130,8 +138,7 @@ private constructor( fun page(page: Long) = page(page as Long?) /** The page to return in a paginated query. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun page(page: Optional) = page(page.orElse(null) as Long?) + fun page(page: Optional) = page(page.getOrNull()) /** Maximum number of items to return per page. */ fun perPage(perPage: Long?) = apply { this.perPage = perPage } @@ -140,8 +147,7 @@ private constructor( fun perPage(perPage: Long) = perPage(perPage as Long?) /** Maximum number of items to return per page. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun perPage(perPage: Optional) = perPage(perPage.orElse(null) as Long?) + fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) /** * Filter list of test results by status. Available statuses are `running`, `passing`, @@ -153,7 +159,7 @@ private constructor( * Filter list of test results by status. Available statuses are `running`, `passing`, * `failing`, `skipped`, and `error`. */ - fun status(status: Optional) = status(status.orElse(null)) + fun status(status: Optional) = status(status.getOrNull()) /** * Filter objects by test type. Available types are `integrity`, `consistency`, @@ -165,7 +171,7 @@ private constructor( * Filter objects by test type. Available types are `integrity`, `consistency`, * `performance`, `fairness`, and `robustness`. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt index a70de3ce..31b8a03e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt @@ -21,6 +21,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired import com.openlayer.api.core.getOrThrow import com.openlayer.api.core.immutableEmptyMap @@ -29,6 +30,7 @@ import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class CommitTestResultListResponse @@ -63,6 +65,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [CommitTestResultListResponse]. + * + * The following fields are required: + * ```java + * .items() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -86,15 +96,7 @@ private constructor( fun addItem(item: Item) = apply { items = - (items ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(item) - } + (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } } fun additionalProperties(additionalProperties: Map) = apply { @@ -272,6 +274,22 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Item]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateDataEnds() + * .dateDataStarts() + * .dateUpdated() + * .inferencePipelineId() + * .projectVersionId() + * .status() + * .statusMessage() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -327,7 +345,7 @@ private constructor( /** The data end date. */ fun dateDataEnds(dateDataEnds: Optional) = - dateDataEnds(dateDataEnds.orElse(null)) + dateDataEnds(dateDataEnds.getOrNull()) /** The data end date. */ fun dateDataEnds(dateDataEnds: JsonField) = apply { @@ -340,7 +358,7 @@ private constructor( /** The data start date. */ fun dateDataStarts(dateDataStarts: Optional) = - dateDataStarts(dateDataStarts.orElse(null)) + dateDataStarts(dateDataStarts.getOrNull()) /** The data start date. */ fun dateDataStarts(dateDataStarts: JsonField) = apply { @@ -361,7 +379,7 @@ private constructor( /** The inference pipeline id. */ fun inferencePipelineId(inferencePipelineId: Optional) = - inferencePipelineId(inferencePipelineId.orElse(null)) + inferencePipelineId(inferencePipelineId.getOrNull()) /** The inference pipeline id. */ fun inferencePipelineId(inferencePipelineId: JsonField) = apply { @@ -374,7 +392,7 @@ private constructor( /** The project version (commit) id. */ fun projectVersionId(projectVersionId: Optional) = - projectVersionId(projectVersionId.orElse(null)) + projectVersionId(projectVersionId.getOrNull()) /** The project version (commit) id. */ fun projectVersionId(projectVersionId: JsonField) = apply { @@ -393,7 +411,7 @@ private constructor( /** The status message. */ fun statusMessage(statusMessage: Optional) = - statusMessage(statusMessage.orElse(null)) + statusMessage(statusMessage.getOrNull()) /** The status message. */ fun statusMessage(statusMessage: JsonField) = apply { @@ -408,7 +426,7 @@ private constructor( fun goalId(goalId: String?) = goalId(JsonField.ofNullable(goalId)) /** The test id. */ - fun goalId(goalId: Optional) = goalId(goalId.orElse(null)) + fun goalId(goalId: Optional) = goalId(goalId.getOrNull()) /** The test id. */ fun goalId(goalId: JsonField) = apply { this.goalId = goalId } @@ -851,6 +869,27 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Goal]. + * + * The following fields are required: + * ```java + * .id() + * .commentCount() + * .creatorId() + * .dateArchived() + * .dateCreated() + * .dateUpdated() + * .description() + * .name() + * .number() + * .originProjectVersionId() + * .subtype() + * .suggested() + * .thresholds() + * .type() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -926,7 +965,7 @@ private constructor( fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The test creator id. */ - fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) /** The test creator id. */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } @@ -937,7 +976,7 @@ private constructor( /** The date the test was archived. */ fun dateArchived(dateArchived: Optional) = - dateArchived(dateArchived.orElse(null)) + dateArchived(dateArchived.getOrNull()) /** The date the test was archived. */ fun dateArchived(dateArchived: JsonField) = apply { @@ -983,7 +1022,7 @@ private constructor( /** The project version (commit) id where the test was created. */ fun originProjectVersionId(originProjectVersionId: Optional) = - originProjectVersionId(originProjectVersionId.orElse(null)) + originProjectVersionId(originProjectVersionId.getOrNull()) /** The project version (commit) id where the test was created. */ fun originProjectVersionId(originProjectVersionId: JsonField) = apply { @@ -1010,14 +1049,8 @@ private constructor( fun addThreshold(threshold: Threshold) = apply { thresholds = - (thresholds ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(threshold) + (thresholds ?: JsonField.of(mutableListOf())).also { + checkKnown("thresholds", it).add(threshold) } } @@ -1041,9 +1074,8 @@ private constructor( fun delayWindow(delayWindow: Double) = delayWindow(delayWindow as Double?) /** The delay window in seconds. Only applies to tests that use production data. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun delayWindow(delayWindow: Optional) = - delayWindow(delayWindow.orElse(null) as Double?) + delayWindow(delayWindow.getOrNull()) /** The delay window in seconds. Only applies to tests that use production data. */ fun delayWindow(delayWindow: JsonField) = apply { @@ -1065,9 +1097,8 @@ private constructor( /** * The evaluation window in seconds. Only applies to tests that use production data. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun evaluationWindow(evaluationWindow: Optional) = - evaluationWindow(evaluationWindow.orElse(null) as Double?) + evaluationWindow(evaluationWindow.getOrNull()) /** * The evaluation window in seconds. Only applies to tests that use production data. @@ -1256,6 +1287,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Threshold]. */ @JvmStatic fun builder() = Builder() } @@ -1296,14 +1328,8 @@ private constructor( fun addInsightParameter(insightParameter: JsonValue) = apply { insightParameters = - (insightParameters ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(insightParameter) + (insightParameters ?: JsonField.of(mutableListOf())).also { + checkKnown("insightParameters", it).add(insightParameter) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt index bdfcbde8..b01da61e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt @@ -21,6 +21,7 @@ import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params +import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired import com.openlayer.api.core.getOrThrow import com.openlayer.api.core.http.Headers @@ -30,6 +31,7 @@ import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Publish an inference data point to an inference pipeline. */ class InferencePipelineDataStreamParams @@ -119,6 +121,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .config() + * .rows() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -180,15 +191,7 @@ private constructor( /** A list of inference data points with inputs and outputs */ fun addRow(row: Row) = apply { rows = - (rows ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(row) - } + (rows ?: JsonField.of(mutableListOf())).also { checkKnown("rows", it).add(row) } } fun additionalProperties(additionalProperties: Map) = apply { @@ -240,6 +243,17 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InferencePipelineDataStreamParams]. + * + * The following fields are required: + * ```java + * .inferencePipelineId() + * .config() + * .rows() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -827,6 +841,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [LlmData]. + * + * The following fields are required: + * ```java + * .outputColumnName() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -941,14 +963,8 @@ private constructor( */ fun addInputVariableName(inputVariableName: String) = apply { inputVariableNames = - (inputVariableNames ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(inputVariableName) + (inputVariableNames ?: JsonField.of(mutableListOf())).also { + checkKnown("inputVariableNames", it).add(inputVariableName) } } @@ -970,7 +986,7 @@ private constructor( /** Name of the column with the total number of tokens. */ fun numOfTokenColumnName(numOfTokenColumnName: Optional) = - numOfTokenColumnName(numOfTokenColumnName.orElse(null)) + numOfTokenColumnName(numOfTokenColumnName.getOrNull()) /** Name of the column with the total number of tokens. */ fun numOfTokenColumnName(numOfTokenColumnName: JsonField) = apply { @@ -988,14 +1004,8 @@ private constructor( /** Prompt for the LLM. */ fun addPrompt(prompt: Prompt) = apply { this.prompt = - (this.prompt ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(prompt) + (this.prompt ?: JsonField.of(mutableListOf())).also { + checkKnown("prompt", it).add(prompt) } } @@ -1116,6 +1126,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Prompt]. */ @JvmStatic fun builder() = Builder() } @@ -1390,6 +1401,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [TabularClassificationData]. + * + * The following fields are required: + * ```java + * .classNames() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -1446,14 +1466,8 @@ private constructor( */ fun addClassName(className: String) = apply { classNames = - (classNames ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(className) + (classNames ?: JsonField.of(mutableListOf())).also { + checkKnown("classNames", it).add(className) } } @@ -1480,14 +1494,8 @@ private constructor( */ fun addCategoricalFeatureName(categoricalFeatureName: String) = apply { categoricalFeatureNames = - (categoricalFeatureNames ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(categoricalFeatureName) + (categoricalFeatureNames ?: JsonField.of(mutableListOf())).also { + checkKnown("categoricalFeatureNames", it).add(categoricalFeatureName) } } @@ -1503,14 +1511,8 @@ private constructor( /** Array with all input feature names. */ fun addFeatureName(featureName: String) = apply { featureNames = - (featureNames ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(featureName) + (featureNames ?: JsonField.of(mutableListOf())).also { + checkKnown("featureNames", it).add(featureName) } } @@ -1795,6 +1797,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [TabularRegressionData]. + */ @JvmStatic fun builder() = Builder() } @@ -1848,14 +1854,8 @@ private constructor( */ fun addCategoricalFeatureName(categoricalFeatureName: String) = apply { categoricalFeatureNames = - (categoricalFeatureNames ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(categoricalFeatureName) + (categoricalFeatureNames ?: JsonField.of(mutableListOf())).also { + checkKnown("categoricalFeatureNames", it).add(categoricalFeatureName) } } @@ -1871,14 +1871,8 @@ private constructor( /** Array with all input feature names. */ fun addFeatureName(featureName: String) = apply { featureNames = - (featureNames ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(featureName) + (featureNames ?: JsonField.of(mutableListOf())).also { + checkKnown("featureNames", it).add(featureName) } } @@ -2163,6 +2157,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [TextClassificationData]. + * + * The following fields are required: + * ```java + * .classNames() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -2215,14 +2218,8 @@ private constructor( */ fun addClassName(className: String) = apply { classNames = - (classNames ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(className) + (classNames ?: JsonField.of(mutableListOf())).also { + checkKnown("classNames", it).add(className) } } @@ -2401,6 +2398,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Row]. */ @JvmStatic fun builder() = Builder() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt index f5a04063..fce75b93 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt @@ -51,6 +51,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InferencePipelineDataStreamResponse]. + * + * The following fields are required: + * ```java + * .success() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt index 4cb15c35..d2bb0594 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt @@ -48,6 +48,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InferencePipelineDeleteParams]. + * + * The following fields are required: + * ```java + * .inferencePipelineId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt index ecfc7bb4..c8e70b84 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt @@ -14,6 +14,7 @@ import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Retrieve inference pipeline. */ class InferencePipelineRetrieveParams @@ -53,6 +54,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InferencePipelineRetrieveParams]. + * + * The following fields are required: + * ```java + * .inferencePipelineId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -83,7 +93,7 @@ private constructor( fun expand(expand: List?) = apply { this.expand = expand?.toMutableList() } /** Expand specific nested objects. */ - fun expand(expand: Optional>) = expand(expand.orElse(null)) + fun expand(expand: Optional>) = expand(expand.getOrNull()) /** Expand specific nested objects. */ fun addExpand(expand: Expand) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt index 56b384ef..0a154fc1 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt @@ -12,6 +12,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable @@ -20,6 +21,7 @@ import java.time.LocalDate import java.time.OffsetDateTime import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class InferencePipelineRetrieveResponse @@ -238,6 +240,29 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InferencePipelineRetrieveResponse]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateLastEvaluated() + * .dateLastSampleReceived() + * .dateOfNextEvaluation() + * .dateUpdated() + * .description() + * .failingGoalCount() + * .links() + * .name() + * .passingGoalCount() + * .projectId() + * .status() + * .statusMessage() + * .totalGoalCount() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -309,7 +334,7 @@ private constructor( /** The last test evaluation date. */ fun dateLastEvaluated(dateLastEvaluated: Optional) = - dateLastEvaluated(dateLastEvaluated.orElse(null)) + dateLastEvaluated(dateLastEvaluated.getOrNull()) /** The last test evaluation date. */ fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { @@ -322,7 +347,7 @@ private constructor( /** The last data sample received date. */ fun dateLastSampleReceived(dateLastSampleReceived: Optional) = - dateLastSampleReceived(dateLastSampleReceived.orElse(null)) + dateLastSampleReceived(dateLastSampleReceived.getOrNull()) /** The last data sample received date. */ fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { @@ -335,7 +360,7 @@ private constructor( /** The next test evaluation date. */ fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = - dateOfNextEvaluation(dateOfNextEvaluation.orElse(null)) + dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) /** The next test evaluation date. */ fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { @@ -354,7 +379,7 @@ private constructor( fun description(description: String?) = description(JsonField.ofNullable(description)) /** The inference pipeline description. */ - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) /** The inference pipeline description. */ fun description(description: JsonField) = apply { this.description = description } @@ -405,7 +430,7 @@ private constructor( /** The status message of test evaluation for the inference pipeline. */ fun statusMessage(statusMessage: Optional) = - statusMessage(statusMessage.orElse(null)) + statusMessage(statusMessage.getOrNull()) /** The status message of test evaluation for the inference pipeline. */ fun statusMessage(statusMessage: JsonField) = apply { @@ -422,13 +447,13 @@ private constructor( fun project(project: Project?) = project(JsonField.ofNullable(project)) - fun project(project: Optional) = project(project.orElse(null)) + fun project(project: Optional) = project(project.getOrNull()) fun project(project: JsonField) = apply { this.project = project } fun workspace(workspace: Workspace?) = workspace(JsonField.ofNullable(workspace)) - fun workspace(workspace: Optional) = workspace(workspace.orElse(null)) + fun workspace(workspace: Optional) = workspace(workspace.getOrNull()) fun workspace(workspace: JsonField) = apply { this.workspace = workspace } @@ -513,6 +538,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Links]. + * + * The following fields are required: + * ```java + * .app() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -898,6 +931,27 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Project]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -953,7 +1007,7 @@ private constructor( fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The project creator id. */ - fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) /** The project creator id. */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } @@ -1023,7 +1077,7 @@ private constructor( fun source(source: Source?) = source(JsonField.ofNullable(source)) /** The source of the project. */ - fun source(source: Optional) = source(source.orElse(null)) + fun source(source: Optional) = source(source.getOrNull()) /** The source of the project. */ fun source(source: JsonField) = apply { this.source = source } @@ -1046,7 +1100,7 @@ private constructor( fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) /** The workspace id. */ - fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.orElse(null)) + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) /** The workspace id. */ fun workspaceId(workspaceId: JsonField) = apply { @@ -1057,7 +1111,7 @@ private constructor( fun description(description: String?) = description(JsonField.ofNullable(description)) /** The project description. */ - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) /** The project description. */ fun description(description: JsonField) = apply { @@ -1066,7 +1120,7 @@ private constructor( fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) - fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.orElse(null)) + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } @@ -1146,6 +1200,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Links]. + * + * The following fields are required: + * ```java + * .app() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -1563,6 +1625,23 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [GitRepo]. + * + * The following fields are required: + * ```java + * .id() + * .dateConnected() + * .dateUpdated() + * .gitAccountId() + * .gitId() + * .name() + * .private_() + * .projectId() + * .slug() + * .url() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -1938,6 +2017,25 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Workspace]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .inviteCount() + * .memberCount() + * .name() + * .periodEndDate() + * .periodStartDate() + * .projectCount() + * .slug() + * .status() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -1993,7 +2091,7 @@ private constructor( fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The workspace creator id. */ - fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) /** The workspace creator id. */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } @@ -2038,7 +2136,7 @@ private constructor( /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: Optional) = - periodEndDate(periodEndDate.orElse(null)) + periodEndDate(periodEndDate.getOrNull()) /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: JsonField) = apply { @@ -2051,7 +2149,7 @@ private constructor( /** The start date of the current billing period. */ fun periodStartDate(periodStartDate: Optional) = - periodStartDate(periodStartDate.orElse(null)) + periodStartDate(periodStartDate.getOrNull()) /** The start date of the current billing period. */ fun periodStartDate(periodStartDate: JsonField) = apply { @@ -2091,14 +2189,8 @@ private constructor( fun addMonthlyUsage(monthlyUsage: MonthlyUsage) = apply { this.monthlyUsage = - (this.monthlyUsage ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(monthlyUsage) + (this.monthlyUsage ?: JsonField.of(mutableListOf())).also { + checkKnown("monthlyUsage", it).add(monthlyUsage) } } @@ -2120,14 +2212,8 @@ private constructor( fun addWildcardDomain(wildcardDomain: String) = apply { wildcardDomains = - (wildcardDomains ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(wildcardDomain) + (wildcardDomains ?: JsonField.of(mutableListOf())).also { + checkKnown("wildcardDomains", it).add(wildcardDomain) } } @@ -2369,6 +2455,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [MonthlyUsage]. */ @JvmStatic fun builder() = Builder() } @@ -2394,9 +2481,8 @@ private constructor( fun executionTimeMs(executionTimeMs: Long) = executionTimeMs(executionTimeMs as Long?) - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun executionTimeMs(executionTimeMs: Optional) = - executionTimeMs(executionTimeMs.orElse(null) as Long?) + executionTimeMs(executionTimeMs.getOrNull()) fun executionTimeMs(executionTimeMs: JsonField) = apply { this.executionTimeMs = executionTimeMs diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt index ccdfc55f..72704fb6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt @@ -19,6 +19,7 @@ import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Update an inference data point in an inference pipeline. */ class InferencePipelineRowUpdateParams @@ -102,6 +103,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .row() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -123,7 +132,7 @@ private constructor( fun config(config: Config?) = config(JsonField.ofNullable(config)) - fun config(config: Optional) = config(config.orElse(null)) + fun config(config: Optional) = config(config.getOrNull()) fun config(config: JsonField) = apply { this.config = config } @@ -172,6 +181,17 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InferencePipelineRowUpdateParams]. + * + * The following fields are required: + * ```java + * .inferencePipelineId() + * .inferenceId() + * .row() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -207,7 +227,7 @@ private constructor( fun config(config: Config?) = apply { body.config(config) } - fun config(config: Optional) = config(config.orElse(null)) + fun config(config: Optional) = config(config.getOrNull()) fun config(config: JsonField) = apply { body.config(config) } @@ -441,6 +461,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Config]. */ @JvmStatic fun builder() = Builder() } @@ -470,7 +491,7 @@ private constructor( /** Name of the column with the ground truths. */ fun groundTruthColumnName(groundTruthColumnName: Optional) = - groundTruthColumnName(groundTruthColumnName.orElse(null)) + groundTruthColumnName(groundTruthColumnName.getOrNull()) /** Name of the column with the ground truths. */ fun groundTruthColumnName(groundTruthColumnName: JsonField) = apply { @@ -483,7 +504,7 @@ private constructor( /** Name of the column with human feedback. */ fun humanFeedbackColumnName(humanFeedbackColumnName: Optional) = - humanFeedbackColumnName(humanFeedbackColumnName.orElse(null)) + humanFeedbackColumnName(humanFeedbackColumnName.getOrNull()) /** Name of the column with human feedback. */ fun humanFeedbackColumnName(humanFeedbackColumnName: JsonField) = apply { @@ -502,7 +523,7 @@ private constructor( * at a later point in time. If not provided, a unique id is generated by Openlayer. */ fun inferenceIdColumnName(inferenceIdColumnName: Optional) = - inferenceIdColumnName(inferenceIdColumnName.orElse(null)) + inferenceIdColumnName(inferenceIdColumnName.getOrNull()) /** * Name of the column with the inference ids. This is useful if you want to update rows @@ -518,7 +539,7 @@ private constructor( /** Name of the column with the latencies. */ fun latencyColumnName(latencyColumnName: Optional) = - latencyColumnName(latencyColumnName.orElse(null)) + latencyColumnName(latencyColumnName.getOrNull()) /** Name of the column with the latencies. */ fun latencyColumnName(latencyColumnName: JsonField) = apply { @@ -537,7 +558,7 @@ private constructor( * provided, the upload timestamp is used. */ fun timestampColumnName(timestampColumnName: Optional) = - timestampColumnName(timestampColumnName.orElse(null)) + timestampColumnName(timestampColumnName.getOrNull()) /** * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt index 54d7c27d..93991f55 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt @@ -51,6 +51,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InferencePipelineRowUpdateResponse]. + * + * The following fields are required: + * ```java + * .success() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt index f45bbaae..dfecb3d3 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt @@ -13,6 +13,7 @@ import com.openlayer.api.core.http.QueryParams import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** List the latest test results for an inference pipeline. */ class InferencePipelineTestResultListParams @@ -73,6 +74,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InferencePipelineTestResultListParams]. + * + * The following fields are required: + * ```java + * .inferencePipelineId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -113,8 +123,7 @@ private constructor( fun page(page: Long) = page(page as Long?) /** The page to return in a paginated query. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun page(page: Optional) = page(page.orElse(null) as Long?) + fun page(page: Optional) = page(page.getOrNull()) /** Maximum number of items to return per page. */ fun perPage(perPage: Long?) = apply { this.perPage = perPage } @@ -123,8 +132,7 @@ private constructor( fun perPage(perPage: Long) = perPage(perPage as Long?) /** Maximum number of items to return per page. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun perPage(perPage: Optional) = perPage(perPage.orElse(null) as Long?) + fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) /** * Filter list of test results by status. Available statuses are `running`, `passing`, @@ -136,7 +144,7 @@ private constructor( * Filter list of test results by status. Available statuses are `running`, `passing`, * `failing`, `skipped`, and `error`. */ - fun status(status: Optional) = status(status.orElse(null)) + fun status(status: Optional) = status(status.getOrNull()) /** * Filter objects by test type. Available types are `integrity`, `consistency`, @@ -148,7 +156,7 @@ private constructor( * Filter objects by test type. Available types are `integrity`, `consistency`, * `performance`, `fairness`, and `robustness`. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt index 66529984..d9de48fc 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt @@ -21,6 +21,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired import com.openlayer.api.core.getOrThrow import com.openlayer.api.core.immutableEmptyMap @@ -29,6 +30,7 @@ import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class InferencePipelineTestResultListResponse @@ -63,6 +65,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InferencePipelineTestResultListResponse]. + * + * The following fields are required: + * ```java + * .items() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -89,15 +100,7 @@ private constructor( fun addItem(item: Item) = apply { items = - (items ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(item) - } + (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } } fun additionalProperties(additionalProperties: Map) = apply { @@ -275,6 +278,22 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Item]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateDataEnds() + * .dateDataStarts() + * .dateUpdated() + * .inferencePipelineId() + * .projectVersionId() + * .status() + * .statusMessage() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -330,7 +349,7 @@ private constructor( /** The data end date. */ fun dateDataEnds(dateDataEnds: Optional) = - dateDataEnds(dateDataEnds.orElse(null)) + dateDataEnds(dateDataEnds.getOrNull()) /** The data end date. */ fun dateDataEnds(dateDataEnds: JsonField) = apply { @@ -343,7 +362,7 @@ private constructor( /** The data start date. */ fun dateDataStarts(dateDataStarts: Optional) = - dateDataStarts(dateDataStarts.orElse(null)) + dateDataStarts(dateDataStarts.getOrNull()) /** The data start date. */ fun dateDataStarts(dateDataStarts: JsonField) = apply { @@ -364,7 +383,7 @@ private constructor( /** The inference pipeline id. */ fun inferencePipelineId(inferencePipelineId: Optional) = - inferencePipelineId(inferencePipelineId.orElse(null)) + inferencePipelineId(inferencePipelineId.getOrNull()) /** The inference pipeline id. */ fun inferencePipelineId(inferencePipelineId: JsonField) = apply { @@ -377,7 +396,7 @@ private constructor( /** The project version (commit) id. */ fun projectVersionId(projectVersionId: Optional) = - projectVersionId(projectVersionId.orElse(null)) + projectVersionId(projectVersionId.getOrNull()) /** The project version (commit) id. */ fun projectVersionId(projectVersionId: JsonField) = apply { @@ -396,7 +415,7 @@ private constructor( /** The status message. */ fun statusMessage(statusMessage: Optional) = - statusMessage(statusMessage.orElse(null)) + statusMessage(statusMessage.getOrNull()) /** The status message. */ fun statusMessage(statusMessage: JsonField) = apply { @@ -411,7 +430,7 @@ private constructor( fun goalId(goalId: String?) = goalId(JsonField.ofNullable(goalId)) /** The test id. */ - fun goalId(goalId: Optional) = goalId(goalId.orElse(null)) + fun goalId(goalId: Optional) = goalId(goalId.getOrNull()) /** The test id. */ fun goalId(goalId: JsonField) = apply { this.goalId = goalId } @@ -854,6 +873,27 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Goal]. + * + * The following fields are required: + * ```java + * .id() + * .commentCount() + * .creatorId() + * .dateArchived() + * .dateCreated() + * .dateUpdated() + * .description() + * .name() + * .number() + * .originProjectVersionId() + * .subtype() + * .suggested() + * .thresholds() + * .type() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -929,7 +969,7 @@ private constructor( fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The test creator id. */ - fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) /** The test creator id. */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } @@ -940,7 +980,7 @@ private constructor( /** The date the test was archived. */ fun dateArchived(dateArchived: Optional) = - dateArchived(dateArchived.orElse(null)) + dateArchived(dateArchived.getOrNull()) /** The date the test was archived. */ fun dateArchived(dateArchived: JsonField) = apply { @@ -986,7 +1026,7 @@ private constructor( /** The project version (commit) id where the test was created. */ fun originProjectVersionId(originProjectVersionId: Optional) = - originProjectVersionId(originProjectVersionId.orElse(null)) + originProjectVersionId(originProjectVersionId.getOrNull()) /** The project version (commit) id where the test was created. */ fun originProjectVersionId(originProjectVersionId: JsonField) = apply { @@ -1013,14 +1053,8 @@ private constructor( fun addThreshold(threshold: Threshold) = apply { thresholds = - (thresholds ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(threshold) + (thresholds ?: JsonField.of(mutableListOf())).also { + checkKnown("thresholds", it).add(threshold) } } @@ -1044,9 +1078,8 @@ private constructor( fun delayWindow(delayWindow: Double) = delayWindow(delayWindow as Double?) /** The delay window in seconds. Only applies to tests that use production data. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun delayWindow(delayWindow: Optional) = - delayWindow(delayWindow.orElse(null) as Double?) + delayWindow(delayWindow.getOrNull()) /** The delay window in seconds. Only applies to tests that use production data. */ fun delayWindow(delayWindow: JsonField) = apply { @@ -1068,9 +1101,8 @@ private constructor( /** * The evaluation window in seconds. Only applies to tests that use production data. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun evaluationWindow(evaluationWindow: Optional) = - evaluationWindow(evaluationWindow.orElse(null) as Double?) + evaluationWindow(evaluationWindow.getOrNull()) /** * The evaluation window in seconds. Only applies to tests that use production data. @@ -1259,6 +1291,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Threshold]. */ @JvmStatic fun builder() = Builder() } @@ -1299,14 +1332,8 @@ private constructor( fun addInsightParameter(insightParameter: JsonValue) = apply { insightParameters = - (insightParameters ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(insightParameter) + (insightParameters ?: JsonField.of(mutableListOf())).also { + checkKnown("insightParameters", it).add(insightParameter) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt index 69beb028..f5193a7c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt @@ -19,6 +19,7 @@ import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Update inference pipeline. */ class InferencePipelineUpdateParams @@ -142,6 +143,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Body]. */ @JvmStatic fun builder() = Builder() } @@ -165,7 +167,7 @@ private constructor( fun description(description: String?) = description(JsonField.ofNullable(description)) /** The inference pipeline description. */ - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) /** The inference pipeline description. */ fun description(description: JsonField) = apply { @@ -190,7 +192,7 @@ private constructor( * UI to handle your reference dataset updates. */ fun referenceDatasetUri(referenceDatasetUri: Optional) = - referenceDatasetUri(referenceDatasetUri.orElse(null)) + referenceDatasetUri(referenceDatasetUri.getOrNull()) /** * The storage uri of your reference dataset. We recommend using the Python SDK or the @@ -245,6 +247,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InferencePipelineUpdateParams]. + * + * The following fields are required: + * ```java + * .inferencePipelineId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -273,7 +284,7 @@ private constructor( fun description(description: String?) = apply { body.description(description) } /** The inference pipeline description. */ - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) /** The inference pipeline description. */ fun description(description: JsonField) = apply { body.description(description) } @@ -297,7 +308,7 @@ private constructor( * handle your reference dataset updates. */ fun referenceDatasetUri(referenceDatasetUri: Optional) = - referenceDatasetUri(referenceDatasetUri.orElse(null)) + referenceDatasetUri(referenceDatasetUri.getOrNull()) /** * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt index bad46f2c..815ec148 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt @@ -12,6 +12,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable @@ -20,6 +21,7 @@ import java.time.LocalDate import java.time.OffsetDateTime import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class InferencePipelineUpdateResponse @@ -238,6 +240,29 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InferencePipelineUpdateResponse]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateLastEvaluated() + * .dateLastSampleReceived() + * .dateOfNextEvaluation() + * .dateUpdated() + * .description() + * .failingGoalCount() + * .links() + * .name() + * .passingGoalCount() + * .projectId() + * .status() + * .statusMessage() + * .totalGoalCount() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -309,7 +334,7 @@ private constructor( /** The last test evaluation date. */ fun dateLastEvaluated(dateLastEvaluated: Optional) = - dateLastEvaluated(dateLastEvaluated.orElse(null)) + dateLastEvaluated(dateLastEvaluated.getOrNull()) /** The last test evaluation date. */ fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { @@ -322,7 +347,7 @@ private constructor( /** The last data sample received date. */ fun dateLastSampleReceived(dateLastSampleReceived: Optional) = - dateLastSampleReceived(dateLastSampleReceived.orElse(null)) + dateLastSampleReceived(dateLastSampleReceived.getOrNull()) /** The last data sample received date. */ fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { @@ -335,7 +360,7 @@ private constructor( /** The next test evaluation date. */ fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = - dateOfNextEvaluation(dateOfNextEvaluation.orElse(null)) + dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) /** The next test evaluation date. */ fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { @@ -354,7 +379,7 @@ private constructor( fun description(description: String?) = description(JsonField.ofNullable(description)) /** The inference pipeline description. */ - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) /** The inference pipeline description. */ fun description(description: JsonField) = apply { this.description = description } @@ -405,7 +430,7 @@ private constructor( /** The status message of test evaluation for the inference pipeline. */ fun statusMessage(statusMessage: Optional) = - statusMessage(statusMessage.orElse(null)) + statusMessage(statusMessage.getOrNull()) /** The status message of test evaluation for the inference pipeline. */ fun statusMessage(statusMessage: JsonField) = apply { @@ -422,13 +447,13 @@ private constructor( fun project(project: Project?) = project(JsonField.ofNullable(project)) - fun project(project: Optional) = project(project.orElse(null)) + fun project(project: Optional) = project(project.getOrNull()) fun project(project: JsonField) = apply { this.project = project } fun workspace(workspace: Workspace?) = workspace(JsonField.ofNullable(workspace)) - fun workspace(workspace: Optional) = workspace(workspace.orElse(null)) + fun workspace(workspace: Optional) = workspace(workspace.getOrNull()) fun workspace(workspace: JsonField) = apply { this.workspace = workspace } @@ -513,6 +538,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Links]. + * + * The following fields are required: + * ```java + * .app() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -898,6 +931,27 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Project]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -953,7 +1007,7 @@ private constructor( fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The project creator id. */ - fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) /** The project creator id. */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } @@ -1023,7 +1077,7 @@ private constructor( fun source(source: Source?) = source(JsonField.ofNullable(source)) /** The source of the project. */ - fun source(source: Optional) = source(source.orElse(null)) + fun source(source: Optional) = source(source.getOrNull()) /** The source of the project. */ fun source(source: JsonField) = apply { this.source = source } @@ -1046,7 +1100,7 @@ private constructor( fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) /** The workspace id. */ - fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.orElse(null)) + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) /** The workspace id. */ fun workspaceId(workspaceId: JsonField) = apply { @@ -1057,7 +1111,7 @@ private constructor( fun description(description: String?) = description(JsonField.ofNullable(description)) /** The project description. */ - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) /** The project description. */ fun description(description: JsonField) = apply { @@ -1066,7 +1120,7 @@ private constructor( fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) - fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.orElse(null)) + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } @@ -1146,6 +1200,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Links]. + * + * The following fields are required: + * ```java + * .app() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -1563,6 +1625,23 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [GitRepo]. + * + * The following fields are required: + * ```java + * .id() + * .dateConnected() + * .dateUpdated() + * .gitAccountId() + * .gitId() + * .name() + * .private_() + * .projectId() + * .slug() + * .url() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -1938,6 +2017,25 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Workspace]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .inviteCount() + * .memberCount() + * .name() + * .periodEndDate() + * .periodStartDate() + * .projectCount() + * .slug() + * .status() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -1993,7 +2091,7 @@ private constructor( fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The workspace creator id. */ - fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) /** The workspace creator id. */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } @@ -2038,7 +2136,7 @@ private constructor( /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: Optional) = - periodEndDate(periodEndDate.orElse(null)) + periodEndDate(periodEndDate.getOrNull()) /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: JsonField) = apply { @@ -2051,7 +2149,7 @@ private constructor( /** The start date of the current billing period. */ fun periodStartDate(periodStartDate: Optional) = - periodStartDate(periodStartDate.orElse(null)) + periodStartDate(periodStartDate.getOrNull()) /** The start date of the current billing period. */ fun periodStartDate(periodStartDate: JsonField) = apply { @@ -2091,14 +2189,8 @@ private constructor( fun addMonthlyUsage(monthlyUsage: MonthlyUsage) = apply { this.monthlyUsage = - (this.monthlyUsage ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(monthlyUsage) + (this.monthlyUsage ?: JsonField.of(mutableListOf())).also { + checkKnown("monthlyUsage", it).add(monthlyUsage) } } @@ -2120,14 +2212,8 @@ private constructor( fun addWildcardDomain(wildcardDomain: String) = apply { wildcardDomains = - (wildcardDomains ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(wildcardDomain) + (wildcardDomains ?: JsonField.of(mutableListOf())).also { + checkKnown("wildcardDomains", it).add(wildcardDomain) } } @@ -2369,6 +2455,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [MonthlyUsage]. */ @JvmStatic fun builder() = Builder() } @@ -2394,9 +2481,8 @@ private constructor( fun executionTimeMs(executionTimeMs: Long) = executionTimeMs(executionTimeMs as Long?) - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun executionTimeMs(executionTimeMs: Optional) = - executionTimeMs(executionTimeMs.orElse(null) as Long?) + executionTimeMs(executionTimeMs.getOrNull()) fun executionTimeMs(executionTimeMs: JsonField) = apply { this.executionTimeMs = executionTimeMs diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt index 7a5cd196..cf3ed57a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt @@ -22,6 +22,7 @@ import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Create a new commit (project version) in a project. */ class ProjectCommitCreateParams @@ -382,6 +383,27 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .id() + * .commit() + * .dateArchived() + * .dateCreated() + * .failingGoalCount() + * .mlModelId() + * .passingGoalCount() + * .projectId() + * .status() + * .statusMessage() + * .storageUri() + * .totalGoalCount() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -447,7 +469,7 @@ private constructor( /** The commit archive date. */ fun dateArchived(dateArchived: Optional) = - dateArchived(dateArchived.orElse(null)) + dateArchived(dateArchived.getOrNull()) /** The commit archive date. */ fun dateArchived(dateArchived: JsonField) = apply { @@ -475,7 +497,7 @@ private constructor( fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) /** The model id. */ - fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.orElse(null)) + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) /** The model id. */ fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } @@ -513,7 +535,7 @@ private constructor( /** The commit status message. */ fun statusMessage(statusMessage: Optional) = - statusMessage(statusMessage.orElse(null)) + statusMessage(statusMessage.getOrNull()) /** The commit status message. */ fun statusMessage(statusMessage: JsonField) = apply { @@ -540,7 +562,7 @@ private constructor( /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: Optional) = - trainingDatasetId(trainingDatasetId.orElse(null)) + trainingDatasetId(trainingDatasetId.getOrNull()) /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: JsonField) = apply { @@ -553,7 +575,7 @@ private constructor( /** The validation dataset id. */ fun validationDatasetId(validationDatasetId: Optional) = - validationDatasetId(validationDatasetId.orElse(null)) + validationDatasetId(validationDatasetId.getOrNull()) /** The validation dataset id. */ fun validationDatasetId(validationDatasetId: JsonField) = apply { @@ -567,8 +589,7 @@ private constructor( fun archived(archived: Boolean) = archived(archived as Boolean?) /** Whether the commit is archived. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun archived(archived: Optional) = archived(archived.orElse(null) as Boolean?) + fun archived(archived: Optional) = archived(archived.getOrNull()) /** Whether the commit is archived. */ fun archived(archived: JsonField) = apply { this.archived = archived } @@ -650,6 +671,28 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [ProjectCommitCreateParams]. + * + * The following fields are required: + * ```java + * .projectId() + * .id() + * .commit() + * .dateArchived() + * .dateCreated() + * .failingGoalCount() + * .mlModelId() + * .passingGoalCount() + * .projectId() + * .status() + * .statusMessage() + * .storageUri() + * .totalGoalCount() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -689,7 +732,7 @@ private constructor( /** The commit archive date. */ fun dateArchived(dateArchived: Optional) = - dateArchived(dateArchived.orElse(null)) + dateArchived(dateArchived.getOrNull()) /** The commit archive date. */ fun dateArchived(dateArchived: JsonField) = apply { @@ -718,7 +761,7 @@ private constructor( fun mlModelId(mlModelId: String?) = apply { body.mlModelId(mlModelId) } /** The model id. */ - fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.orElse(null)) + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) /** The model id. */ fun mlModelId(mlModelId: JsonField) = apply { body.mlModelId(mlModelId) } @@ -756,7 +799,7 @@ private constructor( /** The commit status message. */ fun statusMessage(statusMessage: Optional) = - statusMessage(statusMessage.orElse(null)) + statusMessage(statusMessage.getOrNull()) /** The commit status message. */ fun statusMessage(statusMessage: JsonField) = apply { @@ -784,7 +827,7 @@ private constructor( /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: Optional) = - trainingDatasetId(trainingDatasetId.orElse(null)) + trainingDatasetId(trainingDatasetId.getOrNull()) /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: JsonField) = apply { @@ -798,7 +841,7 @@ private constructor( /** The validation dataset id. */ fun validationDatasetId(validationDatasetId: Optional) = - validationDatasetId(validationDatasetId.orElse(null)) + validationDatasetId(validationDatasetId.getOrNull()) /** The validation dataset id. */ fun validationDatasetId(validationDatasetId: JsonField) = apply { @@ -812,8 +855,7 @@ private constructor( fun archived(archived: Boolean) = archived(archived as Boolean?) /** Whether the commit is archived. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun archived(archived: Optional) = archived(archived.orElse(null) as Boolean?) + fun archived(archived: Optional) = archived(archived.getOrNull()) /** Whether the commit is archived. */ fun archived(archived: JsonField) = apply { body.archived(archived) } @@ -1123,6 +1165,21 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Commit]. + * + * The following fields are required: + * ```java + * .id() + * .authorId() + * .fileSize() + * .message() + * .mlModelId() + * .storageUri() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -1179,8 +1236,7 @@ private constructor( fun fileSize(fileSize: Long) = fileSize(fileSize as Long?) /** The size of the commit bundle in bytes. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fileSize(fileSize: Optional) = fileSize(fileSize.orElse(null) as Long?) + fun fileSize(fileSize: Optional) = fileSize(fileSize.getOrNull()) /** The size of the commit bundle in bytes. */ fun fileSize(fileSize: JsonField) = apply { this.fileSize = fileSize } @@ -1195,7 +1251,7 @@ private constructor( fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) /** The model id. */ - fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.orElse(null)) + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) /** The model id. */ fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } @@ -1212,7 +1268,7 @@ private constructor( /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: Optional) = - trainingDatasetId(trainingDatasetId.orElse(null)) + trainingDatasetId(trainingDatasetId.getOrNull()) /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: JsonField) = apply { @@ -1225,7 +1281,7 @@ private constructor( /** The validation dataset id. */ fun validationDatasetId(validationDatasetId: Optional) = - validationDatasetId(validationDatasetId.orElse(null)) + validationDatasetId(validationDatasetId.getOrNull()) /** The validation dataset id. */ fun validationDatasetId(validationDatasetId: JsonField) = apply { @@ -1479,6 +1535,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Links]. + * + * The following fields are required: + * ```java + * .app() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt index f8f0bbdc..64e04dd8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt @@ -19,6 +19,7 @@ import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class ProjectCommitCreateResponse @@ -238,6 +239,27 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [ProjectCommitCreateResponse]. + * + * The following fields are required: + * ```java + * .id() + * .commit() + * .dateArchived() + * .dateCreated() + * .failingGoalCount() + * .mlModelId() + * .passingGoalCount() + * .projectId() + * .status() + * .statusMessage() + * .storageUri() + * .totalGoalCount() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -303,7 +325,7 @@ private constructor( /** The commit archive date. */ fun dateArchived(dateArchived: Optional) = - dateArchived(dateArchived.orElse(null)) + dateArchived(dateArchived.getOrNull()) /** The commit archive date. */ fun dateArchived(dateArchived: JsonField) = apply { @@ -331,7 +353,7 @@ private constructor( fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) /** The model id. */ - fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.orElse(null)) + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) /** The model id. */ fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } @@ -369,7 +391,7 @@ private constructor( /** The commit status message. */ fun statusMessage(statusMessage: Optional) = - statusMessage(statusMessage.orElse(null)) + statusMessage(statusMessage.getOrNull()) /** The commit status message. */ fun statusMessage(statusMessage: JsonField) = apply { @@ -396,7 +418,7 @@ private constructor( /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: Optional) = - trainingDatasetId(trainingDatasetId.orElse(null)) + trainingDatasetId(trainingDatasetId.getOrNull()) /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: JsonField) = apply { @@ -409,7 +431,7 @@ private constructor( /** The validation dataset id. */ fun validationDatasetId(validationDatasetId: Optional) = - validationDatasetId(validationDatasetId.orElse(null)) + validationDatasetId(validationDatasetId.getOrNull()) /** The validation dataset id. */ fun validationDatasetId(validationDatasetId: JsonField) = apply { @@ -423,8 +445,7 @@ private constructor( fun archived(archived: Boolean) = archived(archived as Boolean?) /** Whether the commit is archived. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun archived(archived: Optional) = archived(archived.orElse(null) as Boolean?) + fun archived(archived: Optional) = archived(archived.getOrNull()) /** Whether the commit is archived. */ fun archived(archived: JsonField) = apply { this.archived = archived } @@ -649,6 +670,21 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Commit]. + * + * The following fields are required: + * ```java + * .id() + * .authorId() + * .fileSize() + * .message() + * .mlModelId() + * .storageUri() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -705,8 +741,7 @@ private constructor( fun fileSize(fileSize: Long) = fileSize(fileSize as Long?) /** The size of the commit bundle in bytes. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fileSize(fileSize: Optional) = fileSize(fileSize.orElse(null) as Long?) + fun fileSize(fileSize: Optional) = fileSize(fileSize.getOrNull()) /** The size of the commit bundle in bytes. */ fun fileSize(fileSize: JsonField) = apply { this.fileSize = fileSize } @@ -721,7 +756,7 @@ private constructor( fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) /** The model id. */ - fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.orElse(null)) + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) /** The model id. */ fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } @@ -738,7 +773,7 @@ private constructor( /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: Optional) = - trainingDatasetId(trainingDatasetId.orElse(null)) + trainingDatasetId(trainingDatasetId.getOrNull()) /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: JsonField) = apply { @@ -751,7 +786,7 @@ private constructor( /** The validation dataset id. */ fun validationDatasetId(validationDatasetId: Optional) = - validationDatasetId(validationDatasetId.orElse(null)) + validationDatasetId(validationDatasetId.getOrNull()) /** The validation dataset id. */ fun validationDatasetId(validationDatasetId: JsonField) = apply { @@ -1005,6 +1040,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Links]. + * + * The following fields are required: + * ```java + * .app() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt index 961a26af..a643acd2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt @@ -9,6 +9,7 @@ import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** List the commits (project versions) in a project. */ class ProjectCommitListParams @@ -53,6 +54,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [ProjectCommitListParams]. + * + * The following fields are required: + * ```java + * .projectId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -84,8 +93,7 @@ private constructor( fun page(page: Long) = page(page as Long?) /** The page to return in a paginated query. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun page(page: Optional) = page(page.orElse(null) as Long?) + fun page(page: Optional) = page(page.getOrNull()) /** Maximum number of items to return per page. */ fun perPage(perPage: Long?) = apply { this.perPage = perPage } @@ -94,8 +102,7 @@ private constructor( fun perPage(perPage: Long) = perPage(perPage as Long?) /** Maximum number of items to return per page. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun perPage(perPage: Optional) = perPage(perPage.orElse(null) as Long?) + fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt index 5978c564..a63057d3 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt @@ -12,6 +12,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable @@ -19,6 +20,7 @@ import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class ProjectCommitListResponse @@ -53,6 +55,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [ProjectCommitListResponse]. + * + * The following fields are required: + * ```java + * .items() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -76,15 +86,7 @@ private constructor( fun addItem(item: Item) = apply { items = - (items ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(item) - } + (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } } fun additionalProperties(additionalProperties: Map) = apply { @@ -336,6 +338,27 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Item]. + * + * The following fields are required: + * ```java + * .id() + * .commit() + * .dateArchived() + * .dateCreated() + * .failingGoalCount() + * .mlModelId() + * .passingGoalCount() + * .projectId() + * .status() + * .statusMessage() + * .storageUri() + * .totalGoalCount() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -401,7 +424,7 @@ private constructor( /** The commit archive date. */ fun dateArchived(dateArchived: Optional) = - dateArchived(dateArchived.orElse(null)) + dateArchived(dateArchived.getOrNull()) /** The commit archive date. */ fun dateArchived(dateArchived: JsonField) = apply { @@ -429,7 +452,7 @@ private constructor( fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) /** The model id. */ - fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.orElse(null)) + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) /** The model id. */ fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } @@ -467,7 +490,7 @@ private constructor( /** The commit status message. */ fun statusMessage(statusMessage: Optional) = - statusMessage(statusMessage.orElse(null)) + statusMessage(statusMessage.getOrNull()) /** The commit status message. */ fun statusMessage(statusMessage: JsonField) = apply { @@ -494,7 +517,7 @@ private constructor( /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: Optional) = - trainingDatasetId(trainingDatasetId.orElse(null)) + trainingDatasetId(trainingDatasetId.getOrNull()) /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: JsonField) = apply { @@ -507,7 +530,7 @@ private constructor( /** The validation dataset id. */ fun validationDatasetId(validationDatasetId: Optional) = - validationDatasetId(validationDatasetId.orElse(null)) + validationDatasetId(validationDatasetId.getOrNull()) /** The validation dataset id. */ fun validationDatasetId(validationDatasetId: JsonField) = apply { @@ -521,8 +544,7 @@ private constructor( fun archived(archived: Boolean) = archived(archived as Boolean?) /** Whether the commit is archived. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun archived(archived: Optional) = archived(archived.orElse(null) as Boolean?) + fun archived(archived: Optional) = archived(archived.getOrNull()) /** Whether the commit is archived. */ fun archived(archived: JsonField) = apply { this.archived = archived } @@ -752,6 +774,21 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Commit]. + * + * The following fields are required: + * ```java + * .id() + * .authorId() + * .fileSize() + * .message() + * .mlModelId() + * .storageUri() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -808,8 +845,7 @@ private constructor( fun fileSize(fileSize: Long) = fileSize(fileSize as Long?) /** The size of the commit bundle in bytes. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fileSize(fileSize: Optional) = fileSize(fileSize.orElse(null) as Long?) + fun fileSize(fileSize: Optional) = fileSize(fileSize.getOrNull()) /** The size of the commit bundle in bytes. */ fun fileSize(fileSize: JsonField) = apply { this.fileSize = fileSize } @@ -824,7 +860,7 @@ private constructor( fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) /** The model id. */ - fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.orElse(null)) + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) /** The model id. */ fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } @@ -843,7 +879,7 @@ private constructor( /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: Optional) = - trainingDatasetId(trainingDatasetId.orElse(null)) + trainingDatasetId(trainingDatasetId.getOrNull()) /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: JsonField) = apply { @@ -856,7 +892,7 @@ private constructor( /** The validation dataset id. */ fun validationDatasetId(validationDatasetId: Optional) = - validationDatasetId(validationDatasetId.orElse(null)) + validationDatasetId(validationDatasetId.getOrNull()) /** The validation dataset id. */ fun validationDatasetId(validationDatasetId: JsonField) = apply { @@ -1118,6 +1154,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Links]. + * + * The following fields are required: + * ```java + * .app() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt index 0ee50423..3a35b840 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt @@ -22,6 +22,7 @@ import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Create a project in your workspace. */ class ProjectCreateParams @@ -338,6 +339,27 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -393,7 +415,7 @@ private constructor( fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The project creator id. */ - fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) /** The project creator id. */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } @@ -463,7 +485,7 @@ private constructor( fun source(source: Source?) = source(JsonField.ofNullable(source)) /** The source of the project. */ - fun source(source: Optional) = source(source.orElse(null)) + fun source(source: Optional) = source(source.getOrNull()) /** The source of the project. */ fun source(source: JsonField) = apply { this.source = source } @@ -486,7 +508,7 @@ private constructor( fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) /** The workspace id. */ - fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.orElse(null)) + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) /** The workspace id. */ fun workspaceId(workspaceId: JsonField) = apply { @@ -497,7 +519,7 @@ private constructor( fun description(description: String?) = description(JsonField.ofNullable(description)) /** The project description. */ - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) /** The project description. */ fun description(description: JsonField) = apply { @@ -506,7 +528,7 @@ private constructor( fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) - fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.orElse(null)) + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } @@ -573,6 +595,27 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [ProjectCreateParams]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -601,7 +644,7 @@ private constructor( fun creatorId(creatorId: String?) = apply { body.creatorId(creatorId) } /** The project creator id. */ - fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) /** The project creator id. */ fun creatorId(creatorId: JsonField) = apply { body.creatorId(creatorId) } @@ -674,7 +717,7 @@ private constructor( fun source(source: Source?) = apply { body.source(source) } /** The source of the project. */ - fun source(source: Optional) = source(source.orElse(null)) + fun source(source: Optional) = source(source.getOrNull()) /** The source of the project. */ fun source(source: JsonField) = apply { body.source(source) } @@ -695,7 +738,7 @@ private constructor( fun workspaceId(workspaceId: String?) = apply { body.workspaceId(workspaceId) } /** The workspace id. */ - fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.orElse(null)) + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) /** The workspace id. */ fun workspaceId(workspaceId: JsonField) = apply { body.workspaceId(workspaceId) } @@ -704,14 +747,14 @@ private constructor( fun description(description: String?) = apply { body.description(description) } /** The project description. */ - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) /** The project description. */ fun description(description: JsonField) = apply { body.description(description) } fun gitRepo(gitRepo: GitRepo?) = apply { body.gitRepo(gitRepo) } - fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.orElse(null)) + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) fun gitRepo(gitRepo: JsonField) = apply { body.gitRepo(gitRepo) } @@ -873,6 +916,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Links]. + * + * The following fields are required: + * ```java + * .app() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -1276,6 +1327,23 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [GitRepo]. + * + * The following fields are required: + * ```java + * .id() + * .dateConnected() + * .dateUpdated() + * .gitAccountId() + * .gitId() + * .name() + * .private_() + * .projectId() + * .slug() + * .url() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt index eaab4433..f9de023d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt @@ -19,6 +19,7 @@ import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class ProjectCreateResponse @@ -212,6 +213,27 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [ProjectCreateResponse]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -267,7 +289,7 @@ private constructor( fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The project creator id. */ - fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) /** The project creator id. */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } @@ -337,7 +359,7 @@ private constructor( fun source(source: Source?) = source(JsonField.ofNullable(source)) /** The source of the project. */ - fun source(source: Optional) = source(source.orElse(null)) + fun source(source: Optional) = source(source.getOrNull()) /** The source of the project. */ fun source(source: JsonField) = apply { this.source = source } @@ -358,7 +380,7 @@ private constructor( fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) /** The workspace id. */ - fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.orElse(null)) + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) /** The workspace id. */ fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } @@ -367,14 +389,14 @@ private constructor( fun description(description: String?) = description(JsonField.ofNullable(description)) /** The project description. */ - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) /** The project description. */ fun description(description: JsonField) = apply { this.description = description } fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) - fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.orElse(null)) + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } @@ -452,6 +474,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Links]. + * + * The following fields are required: + * ```java + * .app() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -855,6 +885,23 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [GitRepo]. + * + * The following fields are required: + * ```java + * .id() + * .dateConnected() + * .dateUpdated() + * .gitAccountId() + * .gitId() + * .name() + * .private_() + * .projectId() + * .slug() + * .url() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt index 85ba855a..563f2f33 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt @@ -13,6 +13,7 @@ import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params +import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams @@ -23,6 +24,7 @@ import java.time.LocalDate import java.time.OffsetDateTime import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Create an inference pipeline in a project. */ class ProjectInferencePipelineCreateParams @@ -385,6 +387,28 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateLastEvaluated() + * .dateLastSampleReceived() + * .dateOfNextEvaluation() + * .dateUpdated() + * .description() + * .failingGoalCount() + * .links() + * .name() + * .passingGoalCount() + * .projectId() + * .status() + * .statusMessage() + * .totalGoalCount() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -454,7 +478,7 @@ private constructor( /** The last test evaluation date. */ fun dateLastEvaluated(dateLastEvaluated: Optional) = - dateLastEvaluated(dateLastEvaluated.orElse(null)) + dateLastEvaluated(dateLastEvaluated.getOrNull()) /** The last test evaluation date. */ fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { @@ -467,7 +491,7 @@ private constructor( /** The last data sample received date. */ fun dateLastSampleReceived(dateLastSampleReceived: Optional) = - dateLastSampleReceived(dateLastSampleReceived.orElse(null)) + dateLastSampleReceived(dateLastSampleReceived.getOrNull()) /** The last data sample received date. */ fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { @@ -480,7 +504,7 @@ private constructor( /** The next test evaluation date. */ fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = - dateOfNextEvaluation(dateOfNextEvaluation.orElse(null)) + dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) /** The next test evaluation date. */ fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { @@ -499,7 +523,7 @@ private constructor( fun description(description: String?) = description(JsonField.ofNullable(description)) /** The inference pipeline description. */ - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) /** The inference pipeline description. */ fun description(description: JsonField) = apply { @@ -552,7 +576,7 @@ private constructor( /** The status message of test evaluation for the inference pipeline. */ fun statusMessage(statusMessage: Optional) = - statusMessage(statusMessage.orElse(null)) + statusMessage(statusMessage.getOrNull()) /** The status message of test evaluation for the inference pipeline. */ fun statusMessage(statusMessage: JsonField) = apply { @@ -569,13 +593,13 @@ private constructor( fun project(project: Project?) = project(JsonField.ofNullable(project)) - fun project(project: Optional) = project(project.orElse(null)) + fun project(project: Optional) = project(project.getOrNull()) fun project(project: JsonField) = apply { this.project = project } fun workspace(workspace: Workspace?) = workspace(JsonField.ofNullable(workspace)) - fun workspace(workspace: Optional) = workspace(workspace.orElse(null)) + fun workspace(workspace: Optional) = workspace(workspace.getOrNull()) fun workspace(workspace: JsonField) = apply { this.workspace = workspace } @@ -652,6 +676,30 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [ProjectInferencePipelineCreateParams]. + * + * The following fields are required: + * ```java + * .projectId() + * .id() + * .dateCreated() + * .dateLastEvaluated() + * .dateLastSampleReceived() + * .dateOfNextEvaluation() + * .dateUpdated() + * .description() + * .failingGoalCount() + * .links() + * .name() + * .passingGoalCount() + * .projectId() + * .status() + * .statusMessage() + * .totalGoalCount() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -698,7 +746,7 @@ private constructor( /** The last test evaluation date. */ fun dateLastEvaluated(dateLastEvaluated: Optional) = - dateLastEvaluated(dateLastEvaluated.orElse(null)) + dateLastEvaluated(dateLastEvaluated.getOrNull()) /** The last test evaluation date. */ fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { @@ -712,7 +760,7 @@ private constructor( /** The last data sample received date. */ fun dateLastSampleReceived(dateLastSampleReceived: Optional) = - dateLastSampleReceived(dateLastSampleReceived.orElse(null)) + dateLastSampleReceived(dateLastSampleReceived.getOrNull()) /** The last data sample received date. */ fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { @@ -726,7 +774,7 @@ private constructor( /** The next test evaluation date. */ fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = - dateOfNextEvaluation(dateOfNextEvaluation.orElse(null)) + dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) /** The next test evaluation date. */ fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { @@ -745,7 +793,7 @@ private constructor( fun description(description: String?) = apply { body.description(description) } /** The inference pipeline description. */ - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) /** The inference pipeline description. */ fun description(description: JsonField) = apply { body.description(description) } @@ -797,7 +845,7 @@ private constructor( /** The status message of test evaluation for the inference pipeline. */ fun statusMessage(statusMessage: Optional) = - statusMessage(statusMessage.orElse(null)) + statusMessage(statusMessage.getOrNull()) /** The status message of test evaluation for the inference pipeline. */ fun statusMessage(statusMessage: JsonField) = apply { @@ -814,13 +862,13 @@ private constructor( fun project(project: Project?) = apply { body.project(project) } - fun project(project: Optional) = project(project.orElse(null)) + fun project(project: Optional) = project(project.getOrNull()) fun project(project: JsonField) = apply { body.project(project) } fun workspace(workspace: Workspace?) = apply { body.workspace(workspace) } - fun workspace(workspace: Optional) = workspace(workspace.orElse(null)) + fun workspace(workspace: Optional) = workspace(workspace.getOrNull()) fun workspace(workspace: JsonField) = apply { body.workspace(workspace) } @@ -988,6 +1036,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Links]. + * + * The following fields are required: + * ```java + * .app() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -1373,6 +1429,27 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Project]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -1428,7 +1505,7 @@ private constructor( fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The project creator id. */ - fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) /** The project creator id. */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } @@ -1498,7 +1575,7 @@ private constructor( fun source(source: Source?) = source(JsonField.ofNullable(source)) /** The source of the project. */ - fun source(source: Optional) = source(source.orElse(null)) + fun source(source: Optional) = source(source.getOrNull()) /** The source of the project. */ fun source(source: JsonField) = apply { this.source = source } @@ -1521,7 +1598,7 @@ private constructor( fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) /** The workspace id. */ - fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.orElse(null)) + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) /** The workspace id. */ fun workspaceId(workspaceId: JsonField) = apply { @@ -1532,7 +1609,7 @@ private constructor( fun description(description: String?) = description(JsonField.ofNullable(description)) /** The project description. */ - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) /** The project description. */ fun description(description: JsonField) = apply { @@ -1541,7 +1618,7 @@ private constructor( fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) - fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.orElse(null)) + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } @@ -1621,6 +1698,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Links]. + * + * The following fields are required: + * ```java + * .app() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -2038,6 +2123,23 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [GitRepo]. + * + * The following fields are required: + * ```java + * .id() + * .dateConnected() + * .dateUpdated() + * .gitAccountId() + * .gitId() + * .name() + * .private_() + * .projectId() + * .slug() + * .url() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -2413,6 +2515,25 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Workspace]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .inviteCount() + * .memberCount() + * .name() + * .periodEndDate() + * .periodStartDate() + * .projectCount() + * .slug() + * .status() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -2468,7 +2589,7 @@ private constructor( fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The workspace creator id. */ - fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) /** The workspace creator id. */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } @@ -2513,7 +2634,7 @@ private constructor( /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: Optional) = - periodEndDate(periodEndDate.orElse(null)) + periodEndDate(periodEndDate.getOrNull()) /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: JsonField) = apply { @@ -2526,7 +2647,7 @@ private constructor( /** The start date of the current billing period. */ fun periodStartDate(periodStartDate: Optional) = - periodStartDate(periodStartDate.orElse(null)) + periodStartDate(periodStartDate.getOrNull()) /** The start date of the current billing period. */ fun periodStartDate(periodStartDate: JsonField) = apply { @@ -2566,14 +2687,8 @@ private constructor( fun addMonthlyUsage(monthlyUsage: MonthlyUsage) = apply { this.monthlyUsage = - (this.monthlyUsage ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(monthlyUsage) + (this.monthlyUsage ?: JsonField.of(mutableListOf())).also { + checkKnown("monthlyUsage", it).add(monthlyUsage) } } @@ -2595,14 +2710,8 @@ private constructor( fun addWildcardDomain(wildcardDomain: String) = apply { wildcardDomains = - (wildcardDomains ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(wildcardDomain) + (wildcardDomains ?: JsonField.of(mutableListOf())).also { + checkKnown("wildcardDomains", it).add(wildcardDomain) } } @@ -2844,6 +2953,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [MonthlyUsage]. */ @JvmStatic fun builder() = Builder() } @@ -2869,9 +2979,8 @@ private constructor( fun executionTimeMs(executionTimeMs: Long) = executionTimeMs(executionTimeMs as Long?) - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun executionTimeMs(executionTimeMs: Optional) = - executionTimeMs(executionTimeMs.orElse(null) as Long?) + executionTimeMs(executionTimeMs.getOrNull()) fun executionTimeMs(executionTimeMs: JsonField) = apply { this.executionTimeMs = executionTimeMs diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt index e20176c6..4875275a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt @@ -12,6 +12,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable @@ -20,6 +21,7 @@ import java.time.LocalDate import java.time.OffsetDateTime import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class ProjectInferencePipelineCreateResponse @@ -238,6 +240,29 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [ProjectInferencePipelineCreateResponse]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateLastEvaluated() + * .dateLastSampleReceived() + * .dateOfNextEvaluation() + * .dateUpdated() + * .description() + * .failingGoalCount() + * .links() + * .name() + * .passingGoalCount() + * .projectId() + * .status() + * .statusMessage() + * .totalGoalCount() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -310,7 +335,7 @@ private constructor( /** The last test evaluation date. */ fun dateLastEvaluated(dateLastEvaluated: Optional) = - dateLastEvaluated(dateLastEvaluated.orElse(null)) + dateLastEvaluated(dateLastEvaluated.getOrNull()) /** The last test evaluation date. */ fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { @@ -323,7 +348,7 @@ private constructor( /** The last data sample received date. */ fun dateLastSampleReceived(dateLastSampleReceived: Optional) = - dateLastSampleReceived(dateLastSampleReceived.orElse(null)) + dateLastSampleReceived(dateLastSampleReceived.getOrNull()) /** The last data sample received date. */ fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { @@ -336,7 +361,7 @@ private constructor( /** The next test evaluation date. */ fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = - dateOfNextEvaluation(dateOfNextEvaluation.orElse(null)) + dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) /** The next test evaluation date. */ fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { @@ -355,7 +380,7 @@ private constructor( fun description(description: String?) = description(JsonField.ofNullable(description)) /** The inference pipeline description. */ - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) /** The inference pipeline description. */ fun description(description: JsonField) = apply { this.description = description } @@ -406,7 +431,7 @@ private constructor( /** The status message of test evaluation for the inference pipeline. */ fun statusMessage(statusMessage: Optional) = - statusMessage(statusMessage.orElse(null)) + statusMessage(statusMessage.getOrNull()) /** The status message of test evaluation for the inference pipeline. */ fun statusMessage(statusMessage: JsonField) = apply { @@ -423,13 +448,13 @@ private constructor( fun project(project: Project?) = project(JsonField.ofNullable(project)) - fun project(project: Optional) = project(project.orElse(null)) + fun project(project: Optional) = project(project.getOrNull()) fun project(project: JsonField) = apply { this.project = project } fun workspace(workspace: Workspace?) = workspace(JsonField.ofNullable(workspace)) - fun workspace(workspace: Optional) = workspace(workspace.orElse(null)) + fun workspace(workspace: Optional) = workspace(workspace.getOrNull()) fun workspace(workspace: JsonField) = apply { this.workspace = workspace } @@ -514,6 +539,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Links]. + * + * The following fields are required: + * ```java + * .app() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -899,6 +932,27 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Project]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -954,7 +1008,7 @@ private constructor( fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The project creator id. */ - fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) /** The project creator id. */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } @@ -1024,7 +1078,7 @@ private constructor( fun source(source: Source?) = source(JsonField.ofNullable(source)) /** The source of the project. */ - fun source(source: Optional) = source(source.orElse(null)) + fun source(source: Optional) = source(source.getOrNull()) /** The source of the project. */ fun source(source: JsonField) = apply { this.source = source } @@ -1047,7 +1101,7 @@ private constructor( fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) /** The workspace id. */ - fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.orElse(null)) + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) /** The workspace id. */ fun workspaceId(workspaceId: JsonField) = apply { @@ -1058,7 +1112,7 @@ private constructor( fun description(description: String?) = description(JsonField.ofNullable(description)) /** The project description. */ - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) /** The project description. */ fun description(description: JsonField) = apply { @@ -1067,7 +1121,7 @@ private constructor( fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) - fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.orElse(null)) + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } @@ -1147,6 +1201,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Links]. + * + * The following fields are required: + * ```java + * .app() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -1564,6 +1626,23 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [GitRepo]. + * + * The following fields are required: + * ```java + * .id() + * .dateConnected() + * .dateUpdated() + * .gitAccountId() + * .gitId() + * .name() + * .private_() + * .projectId() + * .slug() + * .url() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -1939,6 +2018,25 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Workspace]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .inviteCount() + * .memberCount() + * .name() + * .periodEndDate() + * .periodStartDate() + * .projectCount() + * .slug() + * .status() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -1994,7 +2092,7 @@ private constructor( fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The workspace creator id. */ - fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) /** The workspace creator id. */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } @@ -2039,7 +2137,7 @@ private constructor( /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: Optional) = - periodEndDate(periodEndDate.orElse(null)) + periodEndDate(periodEndDate.getOrNull()) /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: JsonField) = apply { @@ -2052,7 +2150,7 @@ private constructor( /** The start date of the current billing period. */ fun periodStartDate(periodStartDate: Optional) = - periodStartDate(periodStartDate.orElse(null)) + periodStartDate(periodStartDate.getOrNull()) /** The start date of the current billing period. */ fun periodStartDate(periodStartDate: JsonField) = apply { @@ -2092,14 +2190,8 @@ private constructor( fun addMonthlyUsage(monthlyUsage: MonthlyUsage) = apply { this.monthlyUsage = - (this.monthlyUsage ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(monthlyUsage) + (this.monthlyUsage ?: JsonField.of(mutableListOf())).also { + checkKnown("monthlyUsage", it).add(monthlyUsage) } } @@ -2121,14 +2213,8 @@ private constructor( fun addWildcardDomain(wildcardDomain: String) = apply { wildcardDomains = - (wildcardDomains ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(wildcardDomain) + (wildcardDomains ?: JsonField.of(mutableListOf())).also { + checkKnown("wildcardDomains", it).add(wildcardDomain) } } @@ -2370,6 +2456,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [MonthlyUsage]. */ @JvmStatic fun builder() = Builder() } @@ -2395,9 +2482,8 @@ private constructor( fun executionTimeMs(executionTimeMs: Long) = executionTimeMs(executionTimeMs as Long?) - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun executionTimeMs(executionTimeMs: Optional) = - executionTimeMs(executionTimeMs.orElse(null) as Long?) + executionTimeMs(executionTimeMs.getOrNull()) fun executionTimeMs(executionTimeMs: JsonField) = apply { this.executionTimeMs = executionTimeMs diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt index 60f7d394..83b35ad8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt @@ -9,6 +9,7 @@ import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** List the inference pipelines in a project. */ class ProjectInferencePipelineListParams @@ -58,6 +59,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [ProjectInferencePipelineListParams]. + * + * The following fields are required: + * ```java + * .projectId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -90,7 +100,7 @@ private constructor( fun name(name: String?) = apply { this.name = name } /** Filter list of items by name. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The page to return in a paginated query. */ fun page(page: Long?) = apply { this.page = page } @@ -99,8 +109,7 @@ private constructor( fun page(page: Long) = page(page as Long?) /** The page to return in a paginated query. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun page(page: Optional) = page(page.orElse(null) as Long?) + fun page(page: Optional) = page(page.getOrNull()) /** Maximum number of items to return per page. */ fun perPage(perPage: Long?) = apply { this.perPage = perPage } @@ -109,8 +118,7 @@ private constructor( fun perPage(perPage: Long) = perPage(perPage as Long?) /** Maximum number of items to return per page. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun perPage(perPage: Optional) = perPage(perPage.orElse(null) as Long?) + fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt index 2e730349..b3eec966 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt @@ -12,6 +12,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable @@ -20,6 +21,7 @@ import java.time.LocalDate import java.time.OffsetDateTime import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class ProjectInferencePipelineListResponse @@ -54,6 +56,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [ProjectInferencePipelineListResponse]. + * + * The following fields are required: + * ```java + * .items() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -80,15 +91,7 @@ private constructor( fun addItem(item: Item) = apply { items = - (items ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(item) - } + (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } } fun additionalProperties(additionalProperties: Map) = apply { @@ -346,6 +349,28 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Item]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateLastEvaluated() + * .dateLastSampleReceived() + * .dateOfNextEvaluation() + * .dateUpdated() + * .description() + * .failingGoalCount() + * .links() + * .name() + * .passingGoalCount() + * .projectId() + * .status() + * .statusMessage() + * .totalGoalCount() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -415,7 +440,7 @@ private constructor( /** The last test evaluation date. */ fun dateLastEvaluated(dateLastEvaluated: Optional) = - dateLastEvaluated(dateLastEvaluated.orElse(null)) + dateLastEvaluated(dateLastEvaluated.getOrNull()) /** The last test evaluation date. */ fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { @@ -428,7 +453,7 @@ private constructor( /** The last data sample received date. */ fun dateLastSampleReceived(dateLastSampleReceived: Optional) = - dateLastSampleReceived(dateLastSampleReceived.orElse(null)) + dateLastSampleReceived(dateLastSampleReceived.getOrNull()) /** The last data sample received date. */ fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { @@ -441,7 +466,7 @@ private constructor( /** The next test evaluation date. */ fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = - dateOfNextEvaluation(dateOfNextEvaluation.orElse(null)) + dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) /** The next test evaluation date. */ fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { @@ -460,7 +485,7 @@ private constructor( fun description(description: String?) = description(JsonField.ofNullable(description)) /** The inference pipeline description. */ - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) /** The inference pipeline description. */ fun description(description: JsonField) = apply { @@ -513,7 +538,7 @@ private constructor( /** The status message of test evaluation for the inference pipeline. */ fun statusMessage(statusMessage: Optional) = - statusMessage(statusMessage.orElse(null)) + statusMessage(statusMessage.getOrNull()) /** The status message of test evaluation for the inference pipeline. */ fun statusMessage(statusMessage: JsonField) = apply { @@ -530,13 +555,13 @@ private constructor( fun project(project: Project?) = project(JsonField.ofNullable(project)) - fun project(project: Optional) = project(project.orElse(null)) + fun project(project: Optional) = project(project.getOrNull()) fun project(project: JsonField) = apply { this.project = project } fun workspace(workspace: Workspace?) = workspace(JsonField.ofNullable(workspace)) - fun workspace(workspace: Optional) = workspace(workspace.orElse(null)) + fun workspace(workspace: Optional) = workspace(workspace.getOrNull()) fun workspace(workspace: JsonField) = apply { this.workspace = workspace } @@ -625,6 +650,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Links]. + * + * The following fields are required: + * ```java + * .app() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -1023,6 +1056,27 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Project]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -1078,7 +1132,7 @@ private constructor( fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The project creator id. */ - fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) /** The project creator id. */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } @@ -1150,7 +1204,7 @@ private constructor( fun source(source: Source?) = source(JsonField.ofNullable(source)) /** The source of the project. */ - fun source(source: Optional) = source(source.orElse(null)) + fun source(source: Optional) = source(source.getOrNull()) /** The source of the project. */ fun source(source: JsonField) = apply { this.source = source } @@ -1175,7 +1229,7 @@ private constructor( /** The workspace id. */ fun workspaceId(workspaceId: Optional) = - workspaceId(workspaceId.orElse(null)) + workspaceId(workspaceId.getOrNull()) /** The workspace id. */ fun workspaceId(workspaceId: JsonField) = apply { @@ -1188,7 +1242,7 @@ private constructor( /** The project description. */ fun description(description: Optional) = - description(description.orElse(null)) + description(description.getOrNull()) /** The project description. */ fun description(description: JsonField) = apply { @@ -1197,7 +1251,7 @@ private constructor( fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) - fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.orElse(null)) + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } @@ -1280,6 +1334,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Links]. + * + * The following fields are required: + * ```java + * .app() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -1704,6 +1766,23 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [GitRepo]. + * + * The following fields are required: + * ```java + * .id() + * .dateConnected() + * .dateUpdated() + * .gitAccountId() + * .gitId() + * .name() + * .private_() + * .projectId() + * .slug() + * .url() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -2087,6 +2166,25 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Workspace]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .inviteCount() + * .memberCount() + * .name() + * .periodEndDate() + * .periodStartDate() + * .projectCount() + * .slug() + * .status() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -2142,7 +2240,7 @@ private constructor( fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The workspace creator id. */ - fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) /** The workspace creator id. */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } @@ -2193,7 +2291,7 @@ private constructor( /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: Optional) = - periodEndDate(periodEndDate.orElse(null)) + periodEndDate(periodEndDate.getOrNull()) /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: JsonField) = apply { @@ -2206,7 +2304,7 @@ private constructor( /** The start date of the current billing period. */ fun periodStartDate(periodStartDate: Optional) = - periodStartDate(periodStartDate.orElse(null)) + periodStartDate(periodStartDate.getOrNull()) /** The start date of the current billing period. */ fun periodStartDate(periodStartDate: JsonField) = apply { @@ -2248,14 +2346,8 @@ private constructor( fun addMonthlyUsage(monthlyUsage: MonthlyUsage) = apply { this.monthlyUsage = - (this.monthlyUsage ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(monthlyUsage) + (this.monthlyUsage ?: JsonField.of(mutableListOf())).also { + checkKnown("monthlyUsage", it).add(monthlyUsage) } } @@ -2277,14 +2369,8 @@ private constructor( fun addWildcardDomain(wildcardDomain: String) = apply { wildcardDomains = - (wildcardDomains ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(wildcardDomain) + (wildcardDomains ?: JsonField.of(mutableListOf())).also { + checkKnown("wildcardDomains", it).add(wildcardDomain) } } @@ -2531,6 +2617,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [MonthlyUsage]. */ @JvmStatic fun builder() = Builder() } @@ -2556,9 +2643,8 @@ private constructor( fun executionTimeMs(executionTimeMs: Long) = executionTimeMs(executionTimeMs as Long?) - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun executionTimeMs(executionTimeMs: Optional) = - executionTimeMs(executionTimeMs.orElse(null) as Long?) + executionTimeMs(executionTimeMs.getOrNull()) fun executionTimeMs(executionTimeMs: JsonField) = apply { this.executionTimeMs = executionTimeMs diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt index 6b02639d..a1bb13bd 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt @@ -12,6 +12,7 @@ import com.openlayer.api.core.http.QueryParams import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** List your workspace's projects. */ class ProjectListParams @@ -58,6 +59,7 @@ private constructor( @JvmStatic fun none(): ProjectListParams = builder().build() + /** Returns a mutable builder for constructing an instance of [ProjectListParams]. */ @JvmStatic fun builder() = Builder() } @@ -86,7 +88,7 @@ private constructor( fun name(name: String?) = apply { this.name = name } /** Filter list of items by project name. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The page to return in a paginated query. */ fun page(page: Long?) = apply { this.page = page } @@ -95,8 +97,7 @@ private constructor( fun page(page: Long) = page(page as Long?) /** The page to return in a paginated query. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun page(page: Optional) = page(page.orElse(null) as Long?) + fun page(page: Optional) = page(page.getOrNull()) /** Maximum number of items to return per page. */ fun perPage(perPage: Long?) = apply { this.perPage = perPage } @@ -105,14 +106,13 @@ private constructor( fun perPage(perPage: Long) = perPage(perPage as Long?) /** Maximum number of items to return per page. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun perPage(perPage: Optional) = perPage(perPage.orElse(null) as Long?) + fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) /** Filter list of items by task type. */ fun taskType(taskType: TaskType?) = apply { this.taskType = taskType } /** Filter list of items by task type. */ - fun taskType(taskType: Optional) = taskType(taskType.orElse(null)) + fun taskType(taskType: Optional) = taskType(taskType.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt index e3c4d5f7..06754244 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt @@ -12,6 +12,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable @@ -19,6 +20,7 @@ import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class ProjectListResponse @@ -53,6 +55,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [ProjectListResponse]. + * + * The following fields are required: + * ```java + * .items() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -76,15 +86,7 @@ private constructor( fun addItem(item: Item) = apply { items = - (items ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(item) - } + (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } } fun additionalProperties(additionalProperties: Map) = apply { @@ -314,6 +316,27 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Item]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -369,7 +392,7 @@ private constructor( fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) /** The project creator id. */ - fun creatorId(creatorId: Optional) = creatorId(creatorId.orElse(null)) + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) /** The project creator id. */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } @@ -439,7 +462,7 @@ private constructor( fun source(source: Source?) = source(JsonField.ofNullable(source)) /** The source of the project. */ - fun source(source: Optional) = source(source.orElse(null)) + fun source(source: Optional) = source(source.getOrNull()) /** The source of the project. */ fun source(source: JsonField) = apply { this.source = source } @@ -462,7 +485,7 @@ private constructor( fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) /** The workspace id. */ - fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.orElse(null)) + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) /** The workspace id. */ fun workspaceId(workspaceId: JsonField) = apply { @@ -473,7 +496,7 @@ private constructor( fun description(description: String?) = description(JsonField.ofNullable(description)) /** The project description. */ - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) /** The project description. */ fun description(description: JsonField) = apply { @@ -482,7 +505,7 @@ private constructor( fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) - fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.orElse(null)) + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } @@ -562,6 +585,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Links]. + * + * The following fields are required: + * ```java + * .app() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -979,6 +1010,23 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [GitRepo]. + * + * The following fields are required: + * ```java + * .id() + * .dateConnected() + * .dateUpdated() + * .gitAccountId() + * .gitId() + * .name() + * .private_() + * .projectId() + * .slug() + * .url() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt index 865a266e..30267079 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt @@ -47,6 +47,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [StoragePresignedUrlCreateParams]. + * + * The following fields are required: + * ```java + * .objectName() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt index 1d9b3561..1f4a027c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt @@ -63,6 +63,16 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [StoragePresignedUrlCreateResponse]. + * + * The following fields are required: + * ```java + * .storageUri() + * .url() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt index f7973ee0..f195887a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.async +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.CommitRetrieveParams import com.openlayer.api.models.CommitRetrieveResponse import com.openlayer.api.services.async.commits.TestResultServiceAsync @@ -12,12 +12,45 @@ import java.util.concurrent.CompletableFuture interface CommitServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun testResults(): TestResultServiceAsync /** Retrieve a project version (commit) by its id. */ - @JvmOverloads + fun retrieve(params: CommitRetrieveParams): CompletableFuture = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ fun retrieve( params: CommitRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [CommitServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + fun testResults(): TestResultServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `get /versions/{projectVersionId}`, but is otherwise the + * same as [CommitServiceAsync.retrieve]. + */ + @MustBeClosed + fun retrieve( + params: CommitRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + params: CommitRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt index edaf826d..9af60bfb 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.CommitRetrieveParams @@ -21,38 +23,64 @@ import java.util.concurrent.CompletableFuture class CommitServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : CommitServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: CommitServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } private val testResults: TestResultServiceAsync by lazy { TestResultServiceAsyncImpl(clientOptions) } - override fun testResults(): TestResultServiceAsync = testResults + override fun withRawResponse(): CommitServiceAsync.WithRawResponse = withRawResponse - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun testResults(): TestResultServiceAsync = testResults - /** Retrieve a project version (commit) by its id. */ override fun retrieve( params: CommitRetrieveParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("versions", params.getPathParam(0)) - .build() - .prepareAsync(clientOptions, params) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } + ): CompletableFuture = + // get /versions/{projectVersionId} + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + CommitServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val testResults: TestResultServiceAsync.WithRawResponse by lazy { + TestResultServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun testResults(): TestResultServiceAsync.WithRawResponse = testResults + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieve( + params: CommitRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("versions", params.getPathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt index bac0f357..3beedfa9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt @@ -1,10 +1,11 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.async +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.InferencePipelineDeleteParams import com.openlayer.api.models.InferencePipelineRetrieveParams import com.openlayer.api.models.InferencePipelineRetrieveResponse @@ -17,6 +18,11 @@ import java.util.concurrent.CompletableFuture interface InferencePipelineServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun data(): DataServiceAsync fun rows(): RowServiceAsync @@ -24,23 +30,97 @@ interface InferencePipelineServiceAsync { fun testResults(): TestResultServiceAsync /** Retrieve inference pipeline. */ - @JvmOverloads + fun retrieve( + params: InferencePipelineRetrieveParams + ): CompletableFuture = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ fun retrieve( params: InferencePipelineRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Update inference pipeline. */ - @JvmOverloads + fun update( + params: InferencePipelineUpdateParams + ): CompletableFuture = update(params, RequestOptions.none()) + + /** @see [update] */ fun update( params: InferencePipelineUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Delete inference pipeline. */ - @JvmOverloads + fun delete(params: InferencePipelineDeleteParams): CompletableFuture = + delete(params, RequestOptions.none()) + + /** @see [delete] */ fun delete( params: InferencePipelineDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [InferencePipelineServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + fun data(): DataServiceAsync.WithRawResponse + + fun rows(): RowServiceAsync.WithRawResponse + + fun testResults(): TestResultServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `get /inference-pipelines/{inferencePipelineId}`, but is + * otherwise the same as [InferencePipelineServiceAsync.retrieve]. + */ + @MustBeClosed + fun retrieve( + params: InferencePipelineRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + params: InferencePipelineRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `put /inference-pipelines/{inferencePipelineId}`, but is + * otherwise the same as [InferencePipelineServiceAsync.update]. + */ + @MustBeClosed + fun update( + params: InferencePipelineUpdateParams + ): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + params: InferencePipelineUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `delete /inference-pipelines/{inferencePipelineId}`, but + * is otherwise the same as [InferencePipelineServiceAsync.delete]. + */ + @MustBeClosed + fun delete(params: InferencePipelineDeleteParams): CompletableFuture = + delete(params, RequestOptions.none()) + + /** @see [delete] */ + @MustBeClosed + fun delete( + params: InferencePipelineDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt index 4a862369..1bffa027 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt @@ -10,8 +10,11 @@ import com.openlayer.api.core.handlers.jsonHandler import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.core.json +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineDeleteParams @@ -30,7 +33,9 @@ import java.util.concurrent.CompletableFuture class InferencePipelineServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : InferencePipelineServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: InferencePipelineServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } private val data: DataServiceAsync by lazy { DataServiceAsyncImpl(clientOptions) } @@ -40,85 +45,138 @@ internal constructor(private val clientOptions: ClientOptions) : InferencePipeli TestResultServiceAsyncImpl(clientOptions) } + override fun withRawResponse(): InferencePipelineServiceAsync.WithRawResponse = withRawResponse + override fun data(): DataServiceAsync = data override fun rows(): RowServiceAsync = rows override fun testResults(): TestResultServiceAsync = testResults - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Retrieve inference pipeline. */ override fun retrieve( params: InferencePipelineRetrieveParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("inference-pipelines", params.getPathParam(0)) - .build() - .prepareAsync(clientOptions, params) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } - } - } - } - - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + ): CompletableFuture = + // get /inference-pipelines/{inferencePipelineId} + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } - /** Update inference pipeline. */ override fun update( params: InferencePipelineUpdateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.PUT) - .addPathSegments("inference-pipelines", params.getPathParam(0)) - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } - } - } - } - - private val deleteHandler: Handler = emptyHandler().withErrorHandler(errorHandler) + ): CompletableFuture = + // put /inference-pipelines/{inferencePipelineId} + withRawResponse().update(params, requestOptions).thenApply { it.parse() } - /** Delete inference pipeline. */ override fun delete( params: InferencePipelineDeleteParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.DELETE) - .addPathSegments("inference-pipelines", params.getPathParam(0)) - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepareAsync(clientOptions, params) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> response.use { deleteHandler.handle(it) } } + ): CompletableFuture = + // delete /inference-pipelines/{inferencePipelineId} + withRawResponse().delete(params, requestOptions).thenAccept {} + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + InferencePipelineServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val data: DataServiceAsync.WithRawResponse by lazy { + DataServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val rows: RowServiceAsync.WithRawResponse by lazy { + RowServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val testResults: TestResultServiceAsync.WithRawResponse by lazy { + TestResultServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun data(): DataServiceAsync.WithRawResponse = data + + override fun rows(): RowServiceAsync.WithRawResponse = rows + + override fun testResults(): TestResultServiceAsync.WithRawResponse = testResults + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieve( + params: InferencePipelineRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("inference-pipelines", params.getPathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun update( + params: InferencePipelineUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("inference-pipelines", params.getPathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val deleteHandler: Handler = emptyHandler().withErrorHandler(errorHandler) + + override fun delete( + params: InferencePipelineDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .addPathSegments("inference-pipelines", params.getPathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { response.use { deleteHandler.handle(it) } } + } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt index b18378dd..5cd45434 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.async +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.ProjectCreateParams import com.openlayer.api.models.ProjectCreateResponse import com.openlayer.api.models.ProjectListParams @@ -15,25 +15,96 @@ import java.util.concurrent.CompletableFuture interface ProjectServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun commits(): CommitServiceAsync fun inferencePipelines(): InferencePipelineServiceAsync /** Create a project in your workspace. */ - @JvmOverloads + fun create(params: ProjectCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** @see [create] */ fun create( params: ProjectCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** List your workspace's projects. */ - @JvmOverloads + fun list(): CompletableFuture = list(ProjectListParams.none()) + + /** @see [list] */ fun list( params: ProjectListParams = ProjectListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** List your workspace's projects. */ + /** @see [list] */ + fun list( + params: ProjectListParams = ProjectListParams.none() + ): CompletableFuture = list(params, RequestOptions.none()) + + /** @see [list] */ fun list(requestOptions: RequestOptions): CompletableFuture = list(ProjectListParams.none(), requestOptions) + + /** + * A view of [ProjectServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + fun commits(): CommitServiceAsync.WithRawResponse + + fun inferencePipelines(): InferencePipelineServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /projects`, but is otherwise the same as + * [ProjectServiceAsync.create]. + */ + @MustBeClosed + fun create( + params: ProjectCreateParams + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see [create] */ + @MustBeClosed + fun create( + params: ProjectCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /projects`, but is otherwise the same as + * [ProjectServiceAsync.list]. + */ + @MustBeClosed + fun list(): CompletableFuture> = + list(ProjectListParams.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + params: ProjectListParams = ProjectListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see [list] */ + @MustBeClosed + fun list( + params: ProjectListParams = ProjectListParams.none() + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + requestOptions: RequestOptions + ): CompletableFuture> = + list(ProjectListParams.none(), requestOptions) + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt index 4add3977..7f9ce474 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt @@ -10,7 +10,9 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.core.json +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.ProjectCreateParams @@ -26,7 +28,9 @@ import java.util.concurrent.CompletableFuture class ProjectServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : ProjectServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: ProjectServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } private val commits: CommitServiceAsync by lazy { CommitServiceAsyncImpl(clientOptions) } @@ -34,62 +38,103 @@ class ProjectServiceAsyncImpl internal constructor(private val clientOptions: Cl InferencePipelineServiceAsyncImpl(clientOptions) } + override fun withRawResponse(): ProjectServiceAsync.WithRawResponse = withRawResponse + override fun commits(): CommitServiceAsync = commits override fun inferencePipelines(): InferencePipelineServiceAsync = inferencePipelines - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** Create a project in your workspace. */ override fun create( params: ProjectCreateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("projects") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } - } - } - } + ): CompletableFuture = + // post /projects + withRawResponse().create(params, requestOptions).thenApply { it.parse() } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** List your workspace's projects. */ override fun list( params: ProjectListParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("projects") - .build() - .prepareAsync(clientOptions, params) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } + ): CompletableFuture = + // get /projects + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + ProjectServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val commits: CommitServiceAsync.WithRawResponse by lazy { + CommitServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val inferencePipelines: InferencePipelineServiceAsync.WithRawResponse by lazy { + InferencePipelineServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun commits(): CommitServiceAsync.WithRawResponse = commits + + override fun inferencePipelines(): InferencePipelineServiceAsync.WithRawResponse = + inferencePipelines + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: ProjectCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: ProjectListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsync.kt index 2030c4a0..c5211be6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsync.kt @@ -6,5 +6,18 @@ import com.openlayer.api.services.async.storage.PresignedUrlServiceAsync interface StorageServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun presignedUrl(): PresignedUrlServiceAsync + + /** + * A view of [StorageServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + fun presignedUrl(): PresignedUrlServiceAsync.WithRawResponse + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsyncImpl.kt index 67c2446c..a1edb561 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsyncImpl.kt @@ -9,9 +9,25 @@ import com.openlayer.api.services.async.storage.PresignedUrlServiceAsyncImpl class StorageServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : StorageServiceAsync { + private val withRawResponse: StorageServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + private val presignedUrl: PresignedUrlServiceAsync by lazy { PresignedUrlServiceAsyncImpl(clientOptions) } + override fun withRawResponse(): StorageServiceAsync.WithRawResponse = withRawResponse + override fun presignedUrl(): PresignedUrlServiceAsync = presignedUrl + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + StorageServiceAsync.WithRawResponse { + + private val presignedUrl: PresignedUrlServiceAsync.WithRawResponse by lazy { + PresignedUrlServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun presignedUrl(): PresignedUrlServiceAsync.WithRawResponse = presignedUrl + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt index d41ac954..0e79fe81 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt @@ -1,20 +1,52 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.async.commits +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.CommitTestResultListParams import com.openlayer.api.models.CommitTestResultListResponse import java.util.concurrent.CompletableFuture interface TestResultServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** List the test results for a project commit (project version). */ - @JvmOverloads + fun list(params: CommitTestResultListParams): CompletableFuture = + list(params, RequestOptions.none()) + + /** @see [list] */ fun list( params: CommitTestResultListParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [TestResultServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /versions/{projectVersionId}/results`, but is + * otherwise the same as [TestResultServiceAsync.list]. + */ + @MustBeClosed + fun list( + params: CommitTestResultListParams + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + params: CommitTestResultListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt index 6b0074b3..c029761c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.CommitTestResultListParams @@ -19,33 +21,52 @@ import java.util.concurrent.CompletableFuture class TestResultServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : TestResultServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: TestResultServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): TestResultServiceAsync.WithRawResponse = withRawResponse - /** List the test results for a project commit (project version). */ override fun list( params: CommitTestResultListParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("versions", params.getPathParam(0), "results") - .build() - .prepareAsync(clientOptions, params) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } + ): CompletableFuture = + // get /versions/{projectVersionId}/results + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + TestResultServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: CommitTestResultListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("versions", params.getPathParam(0), "results") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsync.kt index b5bc400b..1793b25d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsync.kt @@ -1,20 +1,52 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.async.inferencePipelines +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.InferencePipelineDataStreamParams import com.openlayer.api.models.InferencePipelineDataStreamResponse import java.util.concurrent.CompletableFuture interface DataServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Publish an inference data point to an inference pipeline. */ - @JvmOverloads + fun stream( + params: InferencePipelineDataStreamParams + ): CompletableFuture = + stream(params, RequestOptions.none()) + + /** @see [stream] */ fun stream( params: InferencePipelineDataStreamParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** A view of [DataServiceAsync] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post + * /inference-pipelines/{inferencePipelineId}/data-stream`, but is otherwise the same as + * [DataServiceAsync.stream]. + */ + @MustBeClosed + fun stream( + params: InferencePipelineDataStreamParams + ): CompletableFuture> = + stream(params, RequestOptions.none()) + + /** @see [stream] */ + @MustBeClosed + fun stream( + params: InferencePipelineDataStreamParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt index 4ba145b6..84782001 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt @@ -10,7 +10,9 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.core.json +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineDataStreamParams @@ -20,34 +22,53 @@ import java.util.concurrent.CompletableFuture class DataServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : DataServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: DataServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val streamHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): DataServiceAsync.WithRawResponse = withRawResponse - /** Publish an inference data point to an inference pipeline. */ override fun stream( params: InferencePipelineDataStreamParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("inference-pipelines", params.getPathParam(0), "data-stream") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { streamHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } + ): CompletableFuture = + // post /inference-pipelines/{inferencePipelineId}/data-stream + withRawResponse().stream(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + DataServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val streamHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun stream( + params: InferencePipelineDataStreamParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("inference-pipelines", params.getPathParam(0), "data-stream") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { streamHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsync.kt index 01ebf016..d92a5677 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsync.kt @@ -1,20 +1,50 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.async.inferencePipelines +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.InferencePipelineRowUpdateParams import com.openlayer.api.models.InferencePipelineRowUpdateResponse import java.util.concurrent.CompletableFuture interface RowServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Update an inference data point in an inference pipeline. */ - @JvmOverloads + fun update( + params: InferencePipelineRowUpdateParams + ): CompletableFuture = update(params, RequestOptions.none()) + + /** @see [update] */ fun update( params: InferencePipelineRowUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** A view of [RowServiceAsync] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `put /inference-pipelines/{inferencePipelineId}/rows`, + * but is otherwise the same as [RowServiceAsync.update]. + */ + @MustBeClosed + fun update( + params: InferencePipelineRowUpdateParams + ): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + params: InferencePipelineRowUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt index 6bf281bc..041c1fd1 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt @@ -10,7 +10,9 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.core.json +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineRowUpdateParams @@ -20,34 +22,53 @@ import java.util.concurrent.CompletableFuture class RowServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : RowServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: RowServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): RowServiceAsync.WithRawResponse = withRawResponse - /** Update an inference data point in an inference pipeline. */ override fun update( params: InferencePipelineRowUpdateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.PUT) - .addPathSegments("inference-pipelines", params.getPathParam(0), "rows") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } + ): CompletableFuture = + // put /inference-pipelines/{inferencePipelineId}/rows + withRawResponse().update(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + RowServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun update( + params: InferencePipelineRowUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("inference-pipelines", params.getPathParam(0), "rows") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsync.kt index 88d0f082..96e82ac6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsync.kt @@ -1,20 +1,54 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.async.inferencePipelines +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.InferencePipelineTestResultListParams import com.openlayer.api.models.InferencePipelineTestResultListResponse import java.util.concurrent.CompletableFuture interface TestResultServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** List the latest test results for an inference pipeline. */ - @JvmOverloads + fun list( + params: InferencePipelineTestResultListParams + ): CompletableFuture = + list(params, RequestOptions.none()) + + /** @see [list] */ fun list( params: InferencePipelineTestResultListParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [TestResultServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /inference-pipelines/{inferencePipelineId}/results`, + * but is otherwise the same as [TestResultServiceAsync.list]. + */ + @MustBeClosed + fun list( + params: InferencePipelineTestResultListParams + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + params: InferencePipelineTestResultListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt index 0b4fd944..31b28206 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineTestResultListParams @@ -19,33 +21,52 @@ import java.util.concurrent.CompletableFuture class TestResultServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : TestResultServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: TestResultServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): TestResultServiceAsync.WithRawResponse = withRawResponse - /** List the latest test results for an inference pipeline. */ override fun list( params: InferencePipelineTestResultListParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("inference-pipelines", params.getPathParam(0), "results") - .build() - .prepareAsync(clientOptions, params) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } + ): CompletableFuture = + // get /inference-pipelines/{inferencePipelineId}/results + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + TestResultServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: InferencePipelineTestResultListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("inference-pipelines", params.getPathParam(0), "results") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt index 3005ad57..da2e4989 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.async.projects +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.ProjectCommitCreateParams import com.openlayer.api.models.ProjectCommitCreateResponse import com.openlayer.api.models.ProjectCommitListParams @@ -13,17 +13,68 @@ import java.util.concurrent.CompletableFuture interface CommitServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Create a new commit (project version) in a project. */ - @JvmOverloads + fun create(params: ProjectCommitCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** @see [create] */ fun create( params: ProjectCommitCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** List the commits (project versions) in a project. */ - @JvmOverloads + fun list(params: ProjectCommitListParams): CompletableFuture = + list(params, RequestOptions.none()) + + /** @see [list] */ fun list( params: ProjectCommitListParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [CommitServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /projects/{projectId}/versions`, but is otherwise + * the same as [CommitServiceAsync.create]. + */ + @MustBeClosed + fun create( + params: ProjectCommitCreateParams + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see [create] */ + @MustBeClosed + fun create( + params: ProjectCommitCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /projects/{projectId}/versions`, but is otherwise + * the same as [CommitServiceAsync.list]. + */ + @MustBeClosed + fun list( + params: ProjectCommitListParams + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + params: ProjectCommitListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt index 7a037b45..c4159be7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt @@ -10,7 +10,9 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.core.json +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.ProjectCommitCreateParams @@ -22,62 +24,90 @@ import java.util.concurrent.CompletableFuture class CommitServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : CommitServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: CommitServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): CommitServiceAsync.WithRawResponse = withRawResponse - /** Create a new commit (project version) in a project. */ override fun create( params: ProjectCommitCreateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("projects", params.getPathParam(0), "versions") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } - } - } - } + ): CompletableFuture = + // post /projects/{projectId}/versions + withRawResponse().create(params, requestOptions).thenApply { it.parse() } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** List the commits (project versions) in a project. */ override fun list( params: ProjectCommitListParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("projects", params.getPathParam(0), "versions") - .build() - .prepareAsync(clientOptions, params) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } + ): CompletableFuture = + // get /projects/{projectId}/versions + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + CommitServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: ProjectCommitCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects", params.getPathParam(0), "versions") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: ProjectCommitListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects", params.getPathParam(0), "versions") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsync.kt index bb60866b..403015e1 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsync.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.async.projects +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.ProjectInferencePipelineCreateParams import com.openlayer.api.models.ProjectInferencePipelineCreateResponse import com.openlayer.api.models.ProjectInferencePipelineListParams @@ -13,17 +13,72 @@ import java.util.concurrent.CompletableFuture interface InferencePipelineServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Create an inference pipeline in a project. */ - @JvmOverloads + fun create( + params: ProjectInferencePipelineCreateParams + ): CompletableFuture = + create(params, RequestOptions.none()) + + /** @see [create] */ fun create( params: ProjectInferencePipelineCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** List the inference pipelines in a project. */ - @JvmOverloads + fun list( + params: ProjectInferencePipelineListParams + ): CompletableFuture = list(params, RequestOptions.none()) + + /** @see [list] */ fun list( params: ProjectInferencePipelineListParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [InferencePipelineServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /projects/{projectId}/inference-pipelines`, but is + * otherwise the same as [InferencePipelineServiceAsync.create]. + */ + @MustBeClosed + fun create( + params: ProjectInferencePipelineCreateParams + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see [create] */ + @MustBeClosed + fun create( + params: ProjectInferencePipelineCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /projects/{projectId}/inference-pipelines`, but is + * otherwise the same as [InferencePipelineServiceAsync.list]. + */ + @MustBeClosed + fun list( + params: ProjectInferencePipelineListParams + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + params: ProjectInferencePipelineListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt index 969cdfd4..58a76cdc 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt @@ -10,7 +10,9 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.core.json +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.ProjectInferencePipelineCreateParams @@ -22,62 +24,90 @@ import java.util.concurrent.CompletableFuture class InferencePipelineServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : InferencePipelineServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: InferencePipelineServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): InferencePipelineServiceAsync.WithRawResponse = withRawResponse - /** Create an inference pipeline in a project. */ override fun create( params: ProjectInferencePipelineCreateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } - } - } - } + ): CompletableFuture = + // post /projects/{projectId}/inference-pipelines + withRawResponse().create(params, requestOptions).thenApply { it.parse() } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** List the inference pipelines in a project. */ override fun list( params: ProjectInferencePipelineListParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") - .build() - .prepareAsync(clientOptions, params) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } + ): CompletableFuture = + // get /projects/{projectId}/inference-pipelines + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + InferencePipelineServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: ProjectInferencePipelineCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: ProjectInferencePipelineListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt index ddccb4c5..85cc8c5a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt @@ -1,20 +1,53 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.async.storage +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.StoragePresignedUrlCreateParams import com.openlayer.api.models.StoragePresignedUrlCreateResponse import java.util.concurrent.CompletableFuture interface PresignedUrlServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Retrieve a presigned url to post storage artifacts. */ - @JvmOverloads + fun create( + params: StoragePresignedUrlCreateParams + ): CompletableFuture = create(params, RequestOptions.none()) + + /** @see [create] */ fun create( params: StoragePresignedUrlCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [PresignedUrlServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /storage/presigned-url`, but is otherwise the same + * as [PresignedUrlServiceAsync.create]. + */ + @MustBeClosed + fun create( + params: StoragePresignedUrlCreateParams + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see [create] */ + @MustBeClosed + fun create( + params: StoragePresignedUrlCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt index ff4e02fa..339c1ea8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt @@ -10,7 +10,9 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.core.json +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.StoragePresignedUrlCreateParams @@ -20,34 +22,53 @@ import java.util.concurrent.CompletableFuture class PresignedUrlServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : PresignedUrlServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: PresignedUrlServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): PresignedUrlServiceAsync.WithRawResponse = withRawResponse - /** Retrieve a presigned url to post storage artifacts. */ override fun create( params: StoragePresignedUrlCreateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("storage", "presigned-url") - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepareAsync(clientOptions, params) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } + ): CompletableFuture = + // post /storage/presigned-url + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + PresignedUrlServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: StoragePresignedUrlCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("storage", "presigned-url") + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt index c026c86b..3fcd3241 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt @@ -1,22 +1,51 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.blocking +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.CommitRetrieveParams import com.openlayer.api.models.CommitRetrieveResponse import com.openlayer.api.services.blocking.commits.TestResultService interface CommitService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun testResults(): TestResultService /** Retrieve a project version (commit) by its id. */ - @JvmOverloads + fun retrieve(params: CommitRetrieveParams): CommitRetrieveResponse = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ fun retrieve( params: CommitRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CommitRetrieveResponse + + /** A view of [CommitService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + fun testResults(): TestResultService.WithRawResponse + + /** + * Returns a raw HTTP response for `get /versions/{projectVersionId}`, but is otherwise the + * same as [CommitService.retrieve]. + */ + @MustBeClosed + fun retrieve(params: CommitRetrieveParams): HttpResponseFor = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + params: CommitRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt index 2c944d89..fefdf9dd 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt @@ -10,6 +10,8 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.CommitRetrieveParams @@ -20,33 +22,59 @@ import com.openlayer.api.services.blocking.commits.TestResultServiceImpl class CommitServiceImpl internal constructor(private val clientOptions: ClientOptions) : CommitService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: CommitService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } private val testResults: TestResultService by lazy { TestResultServiceImpl(clientOptions) } - override fun testResults(): TestResultService = testResults + override fun withRawResponse(): CommitService.WithRawResponse = withRawResponse - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun testResults(): TestResultService = testResults - /** Retrieve a project version (commit) by its id. */ override fun retrieve( params: CommitRetrieveParams, requestOptions: RequestOptions, - ): CommitRetrieveResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("versions", params.getPathParam(0)) - .build() - .prepare(clientOptions, params) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } + ): CommitRetrieveResponse = + // get /versions/{projectVersionId} + withRawResponse().retrieve(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + CommitService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val testResults: TestResultService.WithRawResponse by lazy { + TestResultServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun testResults(): TestResultService.WithRawResponse = testResults + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieve( + params: CommitRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("versions", params.getPathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt index 26c2ade2..413f7a6f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt @@ -1,10 +1,11 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.blocking +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.InferencePipelineDeleteParams import com.openlayer.api.models.InferencePipelineRetrieveParams import com.openlayer.api.models.InferencePipelineRetrieveResponse @@ -16,6 +17,11 @@ import com.openlayer.api.services.blocking.inferencePipelines.TestResultService interface InferencePipelineService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun data(): DataService fun rows(): RowService @@ -23,23 +29,92 @@ interface InferencePipelineService { fun testResults(): TestResultService /** Retrieve inference pipeline. */ - @JvmOverloads + fun retrieve(params: InferencePipelineRetrieveParams): InferencePipelineRetrieveResponse = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ fun retrieve( params: InferencePipelineRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): InferencePipelineRetrieveResponse /** Update inference pipeline. */ - @JvmOverloads + fun update(params: InferencePipelineUpdateParams): InferencePipelineUpdateResponse = + update(params, RequestOptions.none()) + + /** @see [update] */ fun update( params: InferencePipelineUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): InferencePipelineUpdateResponse /** Delete inference pipeline. */ - @JvmOverloads + fun delete(params: InferencePipelineDeleteParams) = delete(params, RequestOptions.none()) + + /** @see [delete] */ fun delete( params: InferencePipelineDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), ) + + /** + * A view of [InferencePipelineService] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + fun data(): DataService.WithRawResponse + + fun rows(): RowService.WithRawResponse + + fun testResults(): TestResultService.WithRawResponse + + /** + * Returns a raw HTTP response for `get /inference-pipelines/{inferencePipelineId}`, but is + * otherwise the same as [InferencePipelineService.retrieve]. + */ + @MustBeClosed + fun retrieve( + params: InferencePipelineRetrieveParams + ): HttpResponseFor = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + params: InferencePipelineRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `put /inference-pipelines/{inferencePipelineId}`, but is + * otherwise the same as [InferencePipelineService.update]. + */ + @MustBeClosed + fun update( + params: InferencePipelineUpdateParams + ): HttpResponseFor = update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + params: InferencePipelineUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `delete /inference-pipelines/{inferencePipelineId}`, but + * is otherwise the same as [InferencePipelineService.delete]. + */ + @MustBeClosed + fun delete(params: InferencePipelineDeleteParams): HttpResponse = + delete(params, RequestOptions.none()) + + /** @see [delete] */ + @MustBeClosed + fun delete( + params: InferencePipelineDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponse + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt index 6200c0a1..70ad7670 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt @@ -10,8 +10,11 @@ import com.openlayer.api.core.handlers.jsonHandler import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.core.json +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineDeleteParams @@ -29,7 +32,9 @@ import com.openlayer.api.services.blocking.inferencePipelines.TestResultServiceI class InferencePipelineServiceImpl internal constructor(private val clientOptions: ClientOptions) : InferencePipelineService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: InferencePipelineService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } private val data: DataService by lazy { DataServiceImpl(clientOptions) } @@ -37,75 +42,127 @@ class InferencePipelineServiceImpl internal constructor(private val clientOption private val testResults: TestResultService by lazy { TestResultServiceImpl(clientOptions) } + override fun withRawResponse(): InferencePipelineService.WithRawResponse = withRawResponse + override fun data(): DataService = data override fun rows(): RowService = rows override fun testResults(): TestResultService = testResults - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Retrieve inference pipeline. */ override fun retrieve( params: InferencePipelineRetrieveParams, requestOptions: RequestOptions, - ): InferencePipelineRetrieveResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("inference-pipelines", params.getPathParam(0)) - .build() - .prepare(clientOptions, params) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } - } - } - - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + ): InferencePipelineRetrieveResponse = + // get /inference-pipelines/{inferencePipelineId} + withRawResponse().retrieve(params, requestOptions).parse() - /** Update inference pipeline. */ override fun update( params: InferencePipelineUpdateParams, requestOptions: RequestOptions, - ): InferencePipelineUpdateResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.PUT) - .addPathSegments("inference-pipelines", params.getPathParam(0)) - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } - } - } - - private val deleteHandler: Handler = emptyHandler().withErrorHandler(errorHandler) + ): InferencePipelineUpdateResponse = + // put /inference-pipelines/{inferencePipelineId} + withRawResponse().update(params, requestOptions).parse() - /** Delete inference pipeline. */ override fun delete(params: InferencePipelineDeleteParams, requestOptions: RequestOptions) { - val request = - HttpRequest.builder() - .method(HttpMethod.DELETE) - .addPathSegments("inference-pipelines", params.getPathParam(0)) - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepare(clientOptions, params) - val response = clientOptions.httpClient.execute(request, requestOptions) - response.use { deleteHandler.handle(it) } + // delete /inference-pipelines/{inferencePipelineId} + withRawResponse().delete(params, requestOptions) + } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + InferencePipelineService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val data: DataService.WithRawResponse by lazy { + DataServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val rows: RowService.WithRawResponse by lazy { + RowServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val testResults: TestResultService.WithRawResponse by lazy { + TestResultServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun data(): DataService.WithRawResponse = data + + override fun rows(): RowService.WithRawResponse = rows + + override fun testResults(): TestResultService.WithRawResponse = testResults + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieve( + params: InferencePipelineRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("inference-pipelines", params.getPathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun update( + params: InferencePipelineUpdateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("inference-pipelines", params.getPathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val deleteHandler: Handler = emptyHandler().withErrorHandler(errorHandler) + + override fun delete( + params: InferencePipelineDeleteParams, + requestOptions: RequestOptions, + ): HttpResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .addPathSegments("inference-pipelines", params.getPathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { response.use { deleteHandler.handle(it) } } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt index 459032be..ec5f4e27 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.blocking +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.ProjectCreateParams import com.openlayer.api.models.ProjectCreateResponse import com.openlayer.api.models.ProjectListParams @@ -14,25 +14,87 @@ import com.openlayer.api.services.blocking.projects.InferencePipelineService interface ProjectService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun commits(): CommitService fun inferencePipelines(): InferencePipelineService /** Create a project in your workspace. */ - @JvmOverloads + fun create(params: ProjectCreateParams): ProjectCreateResponse = + create(params, RequestOptions.none()) + + /** @see [create] */ fun create( params: ProjectCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): ProjectCreateResponse /** List your workspace's projects. */ - @JvmOverloads + fun list(): ProjectListResponse = list(ProjectListParams.none()) + + /** @see [list] */ fun list( params: ProjectListParams = ProjectListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): ProjectListResponse - /** List your workspace's projects. */ + /** @see [list] */ + fun list(params: ProjectListParams = ProjectListParams.none()): ProjectListResponse = + list(params, RequestOptions.none()) + + /** @see [list] */ fun list(requestOptions: RequestOptions): ProjectListResponse = list(ProjectListParams.none(), requestOptions) + + /** A view of [ProjectService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + fun commits(): CommitService.WithRawResponse + + fun inferencePipelines(): InferencePipelineService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /projects`, but is otherwise the same as + * [ProjectService.create]. + */ + @MustBeClosed + fun create(params: ProjectCreateParams): HttpResponseFor = + create(params, RequestOptions.none()) + + /** @see [create] */ + @MustBeClosed + fun create( + params: ProjectCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /projects`, but is otherwise the same as + * [ProjectService.list]. + */ + @MustBeClosed + fun list(): HttpResponseFor = list(ProjectListParams.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + params: ProjectListParams = ProjectListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see [list] */ + @MustBeClosed + fun list( + params: ProjectListParams = ProjectListParams.none() + ): HttpResponseFor = list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list(requestOptions: RequestOptions): HttpResponseFor = + list(ProjectListParams.none(), requestOptions) + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt index 8b0d5a68..8aec3e77 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt @@ -10,7 +10,9 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.core.json +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.ProjectCreateParams @@ -25,7 +27,9 @@ import com.openlayer.api.services.blocking.projects.InferencePipelineServiceImpl class ProjectServiceImpl internal constructor(private val clientOptions: ClientOptions) : ProjectService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: ProjectService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } private val commits: CommitService by lazy { CommitServiceImpl(clientOptions) } @@ -33,56 +37,97 @@ class ProjectServiceImpl internal constructor(private val clientOptions: ClientO InferencePipelineServiceImpl(clientOptions) } + override fun withRawResponse(): ProjectService.WithRawResponse = withRawResponse + override fun commits(): CommitService = commits override fun inferencePipelines(): InferencePipelineService = inferencePipelines - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** Create a project in your workspace. */ override fun create( params: ProjectCreateParams, requestOptions: RequestOptions, - ): ProjectCreateResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("projects") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } - } - } + ): ProjectCreateResponse = + // post /projects + withRawResponse().create(params, requestOptions).parse() - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** List your workspace's projects. */ override fun list( params: ProjectListParams, requestOptions: RequestOptions, - ): ProjectListResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("projects") - .build() - .prepare(clientOptions, params) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } + ): ProjectListResponse = + // get /projects + withRawResponse().list(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + ProjectService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val commits: CommitService.WithRawResponse by lazy { + CommitServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val inferencePipelines: InferencePipelineService.WithRawResponse by lazy { + InferencePipelineServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun commits(): CommitService.WithRawResponse = commits + + override fun inferencePipelines(): InferencePipelineService.WithRawResponse = + inferencePipelines + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: ProjectCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: ProjectListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageService.kt index 20ae29ab..2302938e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageService.kt @@ -6,5 +6,16 @@ import com.openlayer.api.services.blocking.storage.PresignedUrlService interface StorageService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun presignedUrl(): PresignedUrlService + + /** A view of [StorageService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + fun presignedUrl(): PresignedUrlService.WithRawResponse + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageServiceImpl.kt index 39351c7a..f9a80210 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageServiceImpl.kt @@ -9,7 +9,23 @@ import com.openlayer.api.services.blocking.storage.PresignedUrlServiceImpl class StorageServiceImpl internal constructor(private val clientOptions: ClientOptions) : StorageService { + private val withRawResponse: StorageService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + private val presignedUrl: PresignedUrlService by lazy { PresignedUrlServiceImpl(clientOptions) } + override fun withRawResponse(): StorageService.WithRawResponse = withRawResponse + override fun presignedUrl(): PresignedUrlService = presignedUrl + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + StorageService.WithRawResponse { + + private val presignedUrl: PresignedUrlService.WithRawResponse by lazy { + PresignedUrlServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun presignedUrl(): PresignedUrlService.WithRawResponse = presignedUrl + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt index 035f8805..e5bf6089 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt @@ -1,19 +1,47 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.blocking.commits +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.CommitTestResultListParams import com.openlayer.api.models.CommitTestResultListResponse interface TestResultService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** List the test results for a project commit (project version). */ - @JvmOverloads + fun list(params: CommitTestResultListParams): CommitTestResultListResponse = + list(params, RequestOptions.none()) + + /** @see [list] */ fun list( params: CommitTestResultListParams, requestOptions: RequestOptions = RequestOptions.none(), ): CommitTestResultListResponse + + /** A view of [TestResultService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /versions/{projectVersionId}/results`, but is + * otherwise the same as [TestResultService.list]. + */ + @MustBeClosed + fun list( + params: CommitTestResultListParams + ): HttpResponseFor = list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + params: CommitTestResultListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt index e1b27853..3e5f241e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt @@ -10,6 +10,8 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.CommitTestResultListParams @@ -18,30 +20,49 @@ import com.openlayer.api.models.CommitTestResultListResponse class TestResultServiceImpl internal constructor(private val clientOptions: ClientOptions) : TestResultService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: TestResultService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): TestResultService.WithRawResponse = withRawResponse - /** List the test results for a project commit (project version). */ override fun list( params: CommitTestResultListParams, requestOptions: RequestOptions, - ): CommitTestResultListResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("versions", params.getPathParam(0), "results") - .build() - .prepare(clientOptions, params) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } + ): CommitTestResultListResponse = + // get /versions/{projectVersionId}/results + withRawResponse().list(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + TestResultService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: CommitTestResultListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("versions", params.getPathParam(0), "results") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataService.kt index 71e6109f..f04db58b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataService.kt @@ -1,19 +1,49 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.blocking.inferencePipelines +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.InferencePipelineDataStreamParams import com.openlayer.api.models.InferencePipelineDataStreamResponse interface DataService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Publish an inference data point to an inference pipeline. */ - @JvmOverloads + fun stream(params: InferencePipelineDataStreamParams): InferencePipelineDataStreamResponse = + stream(params, RequestOptions.none()) + + /** @see [stream] */ fun stream( params: InferencePipelineDataStreamParams, requestOptions: RequestOptions = RequestOptions.none(), ): InferencePipelineDataStreamResponse + + /** A view of [DataService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post + * /inference-pipelines/{inferencePipelineId}/data-stream`, but is otherwise the same as + * [DataService.stream]. + */ + @MustBeClosed + fun stream( + params: InferencePipelineDataStreamParams + ): HttpResponseFor = + stream(params, RequestOptions.none()) + + /** @see [stream] */ + @MustBeClosed + fun stream( + params: InferencePipelineDataStreamParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt index 8f7fc24f..4355c798 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt @@ -10,7 +10,9 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.core.json +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineDataStreamParams @@ -18,31 +20,50 @@ import com.openlayer.api.models.InferencePipelineDataStreamResponse class DataServiceImpl internal constructor(private val clientOptions: ClientOptions) : DataService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: DataService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val streamHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): DataService.WithRawResponse = withRawResponse - /** Publish an inference data point to an inference pipeline. */ override fun stream( params: InferencePipelineDataStreamParams, requestOptions: RequestOptions, - ): InferencePipelineDataStreamResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("inference-pipelines", params.getPathParam(0), "data-stream") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { streamHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } + ): InferencePipelineDataStreamResponse = + // post /inference-pipelines/{inferencePipelineId}/data-stream + withRawResponse().stream(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + DataService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val streamHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun stream( + params: InferencePipelineDataStreamParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("inference-pipelines", params.getPathParam(0), "data-stream") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { streamHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowService.kt index c1e0cd4d..62b63076 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowService.kt @@ -1,19 +1,48 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.blocking.inferencePipelines +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.InferencePipelineRowUpdateParams import com.openlayer.api.models.InferencePipelineRowUpdateResponse interface RowService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Update an inference data point in an inference pipeline. */ - @JvmOverloads + fun update(params: InferencePipelineRowUpdateParams): InferencePipelineRowUpdateResponse = + update(params, RequestOptions.none()) + + /** @see [update] */ fun update( params: InferencePipelineRowUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): InferencePipelineRowUpdateResponse + + /** A view of [RowService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `put /inference-pipelines/{inferencePipelineId}/rows`, + * but is otherwise the same as [RowService.update]. + */ + @MustBeClosed + fun update( + params: InferencePipelineRowUpdateParams + ): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + params: InferencePipelineRowUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt index 4d2eb2f3..6411ff54 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt @@ -10,7 +10,9 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.core.json +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineRowUpdateParams @@ -18,31 +20,50 @@ import com.openlayer.api.models.InferencePipelineRowUpdateResponse class RowServiceImpl internal constructor(private val clientOptions: ClientOptions) : RowService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: RowService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): RowService.WithRawResponse = withRawResponse - /** Update an inference data point in an inference pipeline. */ override fun update( params: InferencePipelineRowUpdateParams, requestOptions: RequestOptions, - ): InferencePipelineRowUpdateResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.PUT) - .addPathSegments("inference-pipelines", params.getPathParam(0), "rows") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } + ): InferencePipelineRowUpdateResponse = + // put /inference-pipelines/{inferencePipelineId}/rows + withRawResponse().update(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + RowService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun update( + params: InferencePipelineRowUpdateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("inference-pipelines", params.getPathParam(0), "rows") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultService.kt index 90669188..6a77a380 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultService.kt @@ -1,19 +1,49 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.blocking.inferencePipelines +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.InferencePipelineTestResultListParams import com.openlayer.api.models.InferencePipelineTestResultListResponse interface TestResultService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** List the latest test results for an inference pipeline. */ - @JvmOverloads + fun list( + params: InferencePipelineTestResultListParams + ): InferencePipelineTestResultListResponse = list(params, RequestOptions.none()) + + /** @see [list] */ fun list( params: InferencePipelineTestResultListParams, requestOptions: RequestOptions = RequestOptions.none(), ): InferencePipelineTestResultListResponse + + /** A view of [TestResultService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /inference-pipelines/{inferencePipelineId}/results`, + * but is otherwise the same as [TestResultService.list]. + */ + @MustBeClosed + fun list( + params: InferencePipelineTestResultListParams + ): HttpResponseFor = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + params: InferencePipelineTestResultListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt index c5e2874c..8ccc73b5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt @@ -10,6 +10,8 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineTestResultListParams @@ -18,30 +20,49 @@ import com.openlayer.api.models.InferencePipelineTestResultListResponse class TestResultServiceImpl internal constructor(private val clientOptions: ClientOptions) : TestResultService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: TestResultService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): TestResultService.WithRawResponse = withRawResponse - /** List the latest test results for an inference pipeline. */ override fun list( params: InferencePipelineTestResultListParams, requestOptions: RequestOptions, - ): InferencePipelineTestResultListResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("inference-pipelines", params.getPathParam(0), "results") - .build() - .prepare(clientOptions, params) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } + ): InferencePipelineTestResultListResponse = + // get /inference-pipelines/{inferencePipelineId}/results + withRawResponse().list(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + TestResultService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: InferencePipelineTestResultListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("inference-pipelines", params.getPathParam(0), "results") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt index 88de23ef..f5eb85a7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.blocking.projects +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.ProjectCommitCreateParams import com.openlayer.api.models.ProjectCommitCreateResponse import com.openlayer.api.models.ProjectCommitListParams @@ -12,17 +12,63 @@ import com.openlayer.api.models.ProjectCommitListResponse interface CommitService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Create a new commit (project version) in a project. */ - @JvmOverloads + fun create(params: ProjectCommitCreateParams): ProjectCommitCreateResponse = + create(params, RequestOptions.none()) + + /** @see [create] */ fun create( params: ProjectCommitCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): ProjectCommitCreateResponse /** List the commits (project versions) in a project. */ - @JvmOverloads + fun list(params: ProjectCommitListParams): ProjectCommitListResponse = + list(params, RequestOptions.none()) + + /** @see [list] */ fun list( params: ProjectCommitListParams, requestOptions: RequestOptions = RequestOptions.none(), ): ProjectCommitListResponse + + /** A view of [CommitService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /projects/{projectId}/versions`, but is otherwise + * the same as [CommitService.create]. + */ + @MustBeClosed + fun create( + params: ProjectCommitCreateParams + ): HttpResponseFor = create(params, RequestOptions.none()) + + /** @see [create] */ + @MustBeClosed + fun create( + params: ProjectCommitCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /projects/{projectId}/versions`, but is otherwise + * the same as [CommitService.list]. + */ + @MustBeClosed + fun list(params: ProjectCommitListParams): HttpResponseFor = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + params: ProjectCommitListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt index 54624f0b..a4852eba 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt @@ -10,7 +10,9 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.core.json +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.ProjectCommitCreateParams @@ -21,56 +23,84 @@ import com.openlayer.api.models.ProjectCommitListResponse class CommitServiceImpl internal constructor(private val clientOptions: ClientOptions) : CommitService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: CommitService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): CommitService.WithRawResponse = withRawResponse - /** Create a new commit (project version) in a project. */ override fun create( params: ProjectCommitCreateParams, requestOptions: RequestOptions, - ): ProjectCommitCreateResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("projects", params.getPathParam(0), "versions") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } - } - } + ): ProjectCommitCreateResponse = + // post /projects/{projectId}/versions + withRawResponse().create(params, requestOptions).parse() - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** List the commits (project versions) in a project. */ override fun list( params: ProjectCommitListParams, requestOptions: RequestOptions, - ): ProjectCommitListResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("projects", params.getPathParam(0), "versions") - .build() - .prepare(clientOptions, params) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } + ): ProjectCommitListResponse = + // get /projects/{projectId}/versions + withRawResponse().list(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + CommitService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: ProjectCommitCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects", params.getPathParam(0), "versions") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: ProjectCommitListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects", params.getPathParam(0), "versions") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineService.kt index 572dad82..416c9640 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineService.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.blocking.projects +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.ProjectInferencePipelineCreateParams import com.openlayer.api.models.ProjectInferencePipelineCreateResponse import com.openlayer.api.models.ProjectInferencePipelineListParams @@ -12,17 +12,70 @@ import com.openlayer.api.models.ProjectInferencePipelineListResponse interface InferencePipelineService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Create an inference pipeline in a project. */ - @JvmOverloads + fun create( + params: ProjectInferencePipelineCreateParams + ): ProjectInferencePipelineCreateResponse = create(params, RequestOptions.none()) + + /** @see [create] */ fun create( params: ProjectInferencePipelineCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): ProjectInferencePipelineCreateResponse /** List the inference pipelines in a project. */ - @JvmOverloads + fun list(params: ProjectInferencePipelineListParams): ProjectInferencePipelineListResponse = + list(params, RequestOptions.none()) + + /** @see [list] */ fun list( params: ProjectInferencePipelineListParams, requestOptions: RequestOptions = RequestOptions.none(), ): ProjectInferencePipelineListResponse + + /** + * A view of [InferencePipelineService] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /projects/{projectId}/inference-pipelines`, but is + * otherwise the same as [InferencePipelineService.create]. + */ + @MustBeClosed + fun create( + params: ProjectInferencePipelineCreateParams + ): HttpResponseFor = + create(params, RequestOptions.none()) + + /** @see [create] */ + @MustBeClosed + fun create( + params: ProjectInferencePipelineCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /projects/{projectId}/inference-pipelines`, but is + * otherwise the same as [InferencePipelineService.list]. + */ + @MustBeClosed + fun list( + params: ProjectInferencePipelineListParams + ): HttpResponseFor = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + params: ProjectInferencePipelineListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt index 552a3afe..b2fd53aa 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt @@ -10,7 +10,9 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.core.json +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.ProjectInferencePipelineCreateParams @@ -21,56 +23,84 @@ import com.openlayer.api.models.ProjectInferencePipelineListResponse class InferencePipelineServiceImpl internal constructor(private val clientOptions: ClientOptions) : InferencePipelineService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: InferencePipelineService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): InferencePipelineService.WithRawResponse = withRawResponse - /** Create an inference pipeline in a project. */ override fun create( params: ProjectInferencePipelineCreateParams, requestOptions: RequestOptions, - ): ProjectInferencePipelineCreateResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } - } - } + ): ProjectInferencePipelineCreateResponse = + // post /projects/{projectId}/inference-pipelines + withRawResponse().create(params, requestOptions).parse() - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** List the inference pipelines in a project. */ override fun list( params: ProjectInferencePipelineListParams, requestOptions: RequestOptions, - ): ProjectInferencePipelineListResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") - .build() - .prepare(clientOptions, params) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } + ): ProjectInferencePipelineListResponse = + // get /projects/{projectId}/inference-pipelines + withRawResponse().list(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + InferencePipelineService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: ProjectInferencePipelineCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: ProjectInferencePipelineListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt index 04882081..a59456b3 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt @@ -1,19 +1,50 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.blocking.storage +import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.StoragePresignedUrlCreateParams import com.openlayer.api.models.StoragePresignedUrlCreateResponse interface PresignedUrlService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Retrieve a presigned url to post storage artifacts. */ - @JvmOverloads + fun create(params: StoragePresignedUrlCreateParams): StoragePresignedUrlCreateResponse = + create(params, RequestOptions.none()) + + /** @see [create] */ fun create( params: StoragePresignedUrlCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): StoragePresignedUrlCreateResponse + + /** + * A view of [PresignedUrlService] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /storage/presigned-url`, but is otherwise the same + * as [PresignedUrlService.create]. + */ + @MustBeClosed + fun create( + params: StoragePresignedUrlCreateParams + ): HttpResponseFor = + create(params, RequestOptions.none()) + + /** @see [create] */ + @MustBeClosed + fun create( + params: StoragePresignedUrlCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt index d49d38ce..5f86890e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt @@ -10,7 +10,9 @@ import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.core.json +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.StoragePresignedUrlCreateParams @@ -19,31 +21,50 @@ import com.openlayer.api.models.StoragePresignedUrlCreateResponse class PresignedUrlServiceImpl internal constructor(private val clientOptions: ClientOptions) : PresignedUrlService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: PresignedUrlService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): PresignedUrlService.WithRawResponse = withRawResponse - /** Retrieve a presigned url to post storage artifacts. */ override fun create( params: StoragePresignedUrlCreateParams, requestOptions: RequestOptions, - ): StoragePresignedUrlCreateResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("storage", "presigned-url") - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepare(clientOptions, params) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - it.validate() - } + ): StoragePresignedUrlCreateResponse = + // post /storage/presigned-url + withRawResponse().create(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + PresignedUrlService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: StoragePresignedUrlCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("storage", "presigned-url") + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/openlayer-java/build.gradle.kts b/openlayer-java/build.gradle.kts index a4d8ebbd..9fd76f1f 100644 --- a/openlayer-java/build.gradle.kts +++ b/openlayer-java/build.gradle.kts @@ -6,3 +6,24 @@ plugins { dependencies { api(project(":openlayer-java-client-okhttp")) } + +// Redefine `dokkaJavadoc` to: +// - Depend on the root project's task for merging the docs of all the projects +// - Forward that task's output to this task's output +tasks.named("dokkaJavadoc").configure { + actions.clear() + + val dokkaJavadocCollector = rootProject.tasks["dokkaJavadocCollector"] + dependsOn(dokkaJavadocCollector) + + val outputDirectory = project.layout.buildDirectory.dir("dokka/javadoc") + doLast { + copy { + from(dokkaJavadocCollector.outputs.files) + into(outputDirectory) + duplicatesStrategy = DuplicatesStrategy.INCLUDE + } + } + + outputs.dir(outputDirectory) +} From 6e35cbf67eab70e90be376b4835a9b000f265cf9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 14 Mar 2025 05:17:00 +0000 Subject: [PATCH 15/74] chore(client)!: move classes into subpackages and shorten names (#80) --- README.md | 86 +++++++++--------- .../{ => commits}/CommitRetrieveParams.kt | 2 +- .../{ => commits}/CommitRetrieveResponse.kt | 2 +- .../testresults/TestResultListParams.kt} | 34 +++---- .../testresults/TestResultListResponse.kt} | 24 ++--- .../InferencePipelineDeleteParams.kt | 2 +- .../InferencePipelineRetrieveParams.kt | 2 +- .../InferencePipelineRetrieveResponse.kt | 2 +- .../InferencePipelineUpdateParams.kt | 2 +- .../InferencePipelineUpdateResponse.kt | 2 +- .../data/DataStreamParams.kt} | 31 +++---- .../data/DataStreamResponse.kt} | 28 +++--- .../rows/RowUpdateParams.kt} | 33 ++++--- .../rows/RowUpdateResponse.kt} | 32 +++---- .../testresults/TestResultListParams.kt} | 36 ++++---- .../testresults/TestResultListResponse.kt} | 28 +++--- .../{ => projects}/ProjectCreateParams.kt | 2 +- .../{ => projects}/ProjectCreateResponse.kt | 2 +- .../{ => projects}/ProjectListParams.kt | 2 +- .../{ => projects}/ProjectListResponse.kt | 2 +- .../commits/CommitCreateParams.kt} | 26 +++--- .../commits/CommitCreateResponse.kt} | 56 ++++++------ .../commits/CommitListParams.kt} | 28 +++--- .../commits/CommitListResponse.kt} | 24 ++--- .../InferencePipelineCreateParams.kt} | 29 +++--- .../InferencePipelineCreateResponse.kt} | 65 +++++++------- .../InferencePipelineListParams.kt} | 35 ++++---- .../InferencePipelineListResponse.kt} | 27 +++--- .../presignedurl/PresignedUrlCreateParams.kt} | 33 ++++--- .../PresignedUrlCreateResponse.kt} | 33 ++++--- .../api/services/async/CommitServiceAsync.kt | 4 +- .../services/async/CommitServiceAsyncImpl.kt | 4 +- .../async/InferencePipelineServiceAsync.kt | 16 ++-- .../InferencePipelineServiceAsyncImpl.kt | 22 ++--- .../api/services/async/ProjectServiceAsync.kt | 8 +- .../services/async/ProjectServiceAsyncImpl.kt | 8 +- .../async/commits/TestResultServiceAsync.kt | 18 ++-- .../commits/TestResultServiceAsyncImpl.kt | 16 ++-- .../DataServiceAsync.kt | 22 +++-- .../DataServiceAsyncImpl.kt | 19 ++-- .../RowServiceAsync.kt | 23 +++-- .../RowServiceAsyncImpl.kt | 19 ++-- .../TestResultServiceAsync.kt | 22 +++-- .../TestResultServiceAsyncImpl.kt | 18 ++-- .../async/projects/CommitServiceAsync.kt | 36 ++++---- .../async/projects/CommitServiceAsyncImpl.kt | 33 ++++--- .../projects/InferencePipelineServiceAsync.kt | 41 +++++---- .../InferencePipelineServiceAsyncImpl.kt | 32 +++---- .../async/storage/PresignedUrlServiceAsync.kt | 21 +++-- .../storage/PresignedUrlServiceAsyncImpl.kt | 16 ++-- .../api/services/blocking/CommitService.kt | 4 +- .../services/blocking/CommitServiceImpl.kt | 4 +- .../blocking/InferencePipelineService.kt | 16 ++-- .../blocking/InferencePipelineServiceImpl.kt | 22 ++--- .../api/services/blocking/ProjectService.kt | 8 +- .../services/blocking/ProjectServiceImpl.kt | 8 +- .../blocking/commits/TestResultService.kt | 19 ++-- .../blocking/commits/TestResultServiceImpl.kt | 16 ++-- .../DataService.kt | 21 ++--- .../DataServiceImpl.kt | 19 ++-- .../RowService.kt | 21 ++--- .../RowServiceImpl.kt | 19 ++-- .../TestResultService.kt | 23 +++-- .../TestResultServiceImpl.kt | 18 ++-- .../blocking/projects/CommitService.kt | 36 ++++---- .../blocking/projects/CommitServiceImpl.kt | 33 ++++--- .../projects/InferencePipelineService.kt | 41 ++++----- .../projects/InferencePipelineServiceImpl.kt | 32 +++---- .../blocking/storage/PresignedUrlService.kt | 18 ++-- .../storage/PresignedUrlServiceImpl.kt | 16 ++-- ...InferencePipelineDataStreamResponseTest.kt | 20 ----- .../InferencePipelineRowUpdateResponseTest.kt | 20 ----- .../StoragePresignedUrlCreateResponseTest.kt | 25 ------ .../{ => commits}/CommitRetrieveParamsTest.kt | 2 +- .../CommitRetrieveResponseTest.kt | 2 +- .../testresults/TestResultListParamsTest.kt} | 24 ++--- .../TestResultListResponseTest.kt} | 30 +++---- .../InferencePipelineDeleteParamsTest.kt | 2 +- .../InferencePipelineRetrieveParamsTest.kt | 2 +- .../InferencePipelineRetrieveResponseTest.kt | 2 +- .../InferencePipelineUpdateParamsTest.kt | 2 +- .../InferencePipelineUpdateResponseTest.kt | 2 +- .../data/DataStreamParamsTest.kt} | 52 +++++------ .../data/DataStreamResponseTest.kt | 17 ++++ .../rows/RowUpdateParamsTest.kt} | 24 ++--- .../rows/RowUpdateResponseTest.kt | 17 ++++ .../testresults/TestResultListParamsTest.kt} | 24 ++--- .../TestResultListResponseTest.kt} | 32 ++++--- .../{ => projects}/ProjectCreateParamsTest.kt | 2 +- .../ProjectCreateResponseTest.kt | 2 +- .../{ => projects}/ProjectListParamsTest.kt | 2 +- .../{ => projects}/ProjectListResponseTest.kt | 2 +- .../commits/CommitCreateParamsTest.kt} | 42 ++++----- .../commits/CommitCreateResponseTest.kt} | 57 ++++++------ .../commits/CommitListParamsTest.kt} | 16 ++-- .../commits/CommitListResponseTest.kt} | 30 +++---- .../InferencePipelineCreateParamsTest.kt} | 84 +++++++++--------- .../InferencePipelineCreateResponseTest.kt} | 88 +++++++++---------- .../InferencePipelineListParamsTest.kt} | 12 +-- .../InferencePipelineListResponseTest.kt} | 71 ++++++--------- .../PresignedUrlCreateParamsTest.kt} | 10 +-- .../PresignedUrlCreateResponseTest.kt | 25 ++++++ .../api/services/ErrorHandlingTest.kt | 83 ++++++++--------- .../api/services/ServiceParamsTest.kt | 10 +-- .../services/async/CommitServiceAsyncTest.kt | 2 +- .../InferencePipelineServiceAsyncTest.kt | 6 +- .../services/async/ProjectServiceAsyncTest.kt | 4 +- .../commits/TestResultServiceAsyncTest.kt | 8 +- .../DataServiceAsyncTest.kt | 12 +-- .../RowServiceAsyncTest.kt | 8 +- .../TestResultServiceAsyncTest.kt | 10 +-- .../async/projects/CommitServiceAsyncTest.kt | 14 +-- .../InferencePipelineServiceAsyncTest.kt | 31 +++---- .../storage/PresignedUrlServiceAsyncTest.kt | 4 +- .../services/blocking/CommitServiceTest.kt | 2 +- .../blocking/InferencePipelineServiceTest.kt | 6 +- .../services/blocking/ProjectServiceTest.kt | 4 +- .../blocking/commits/TestResultServiceTest.kt | 8 +- .../DataServiceTest.kt | 12 +-- .../RowServiceTest.kt | 8 +- .../TestResultServiceTest.kt | 10 +-- .../blocking/projects/CommitServiceTest.kt | 14 +-- .../projects/InferencePipelineServiceTest.kt | 31 +++---- .../storage/PresignedUrlServiceTest.kt | 4 +- 124 files changed, 1206 insertions(+), 1329 deletions(-) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ => commits}/CommitRetrieveParams.kt (99%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ => commits}/CommitRetrieveResponse.kt (99%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{CommitTestResultListParams.kt => commits/testresults/TestResultListParams.kt} (92%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{CommitTestResultListResponse.kt => commits/testresults/TestResultListResponse.kt} (98%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ => inferencepipelines}/InferencePipelineDeleteParams.kt (99%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ => inferencepipelines}/InferencePipelineRetrieveParams.kt (99%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ => inferencepipelines}/InferencePipelineRetrieveResponse.kt (99%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ => inferencepipelines}/InferencePipelineUpdateParams.kt (99%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ => inferencepipelines}/InferencePipelineUpdateResponse.kt (99%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{InferencePipelineDataStreamParams.kt => inferencepipelines/data/DataStreamParams.kt} (98%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{InferencePipelineDataStreamResponse.kt => inferencepipelines/data/DataStreamResponse.kt} (87%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{InferencePipelineRowUpdateParams.kt => inferencepipelines/rows/RowUpdateParams.kt} (94%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{InferencePipelineRowUpdateResponse.kt => inferencepipelines/rows/RowUpdateResponse.kt} (85%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{InferencePipelineTestResultListParams.kt => inferencepipelines/testresults/TestResultListParams.kt} (91%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{InferencePipelineTestResultListResponse.kt => inferencepipelines/testresults/TestResultListResponse.kt} (98%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ => projects}/ProjectCreateParams.kt (99%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ => projects}/ProjectCreateResponse.kt (99%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ => projects}/ProjectListParams.kt (99%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ => projects}/ProjectListResponse.kt (99%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ProjectCommitCreateParams.kt => projects/commits/CommitCreateParams.kt} (98%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ProjectCommitCreateResponse.kt => projects/commits/CommitCreateResponse.kt} (93%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ProjectCommitListParams.kt => projects/commits/CommitListParams.kt} (87%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ProjectCommitListResponse.kt => projects/commits/CommitListResponse.kt} (98%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ProjectInferencePipelineCreateParams.kt => projects/inferencepipelines/InferencePipelineCreateParams.kt} (99%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ProjectInferencePipelineCreateResponse.kt => projects/inferencepipelines/InferencePipelineCreateResponse.kt} (96%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ProjectInferencePipelineListParams.kt => projects/inferencepipelines/InferencePipelineListParams.kt} (84%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{ProjectInferencePipelineListResponse.kt => projects/inferencepipelines/InferencePipelineListResponse.kt} (99%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{StoragePresignedUrlCreateParams.kt => storage/presignedurl/PresignedUrlCreateParams.kt} (84%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/models/{StoragePresignedUrlCreateResponse.kt => storage/presignedurl/PresignedUrlCreateResponse.kt} (79%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/{inferencePipelines => inferencepipelines}/DataServiceAsync.kt (63%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/{inferencePipelines => inferencepipelines}/DataServiceAsyncImpl.kt (79%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/{inferencePipelines => inferencepipelines}/RowServiceAsync.kt (60%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/{inferencePipelines => inferencepipelines}/RowServiceAsyncImpl.kt (79%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/{inferencePipelines => inferencepipelines}/TestResultServiceAsync.kt (62%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/{inferencePipelines => inferencepipelines}/TestResultServiceAsyncImpl.kt (79%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/{inferencePipelines => inferencepipelines}/DataService.kt (61%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/{inferencePipelines => inferencepipelines}/DataServiceImpl.kt (78%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/{inferencePipelines => inferencepipelines}/RowService.kt (61%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/{inferencePipelines => inferencepipelines}/RowServiceImpl.kt (79%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/{inferencePipelines => inferencepipelines}/TestResultService.kt (60%) rename openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/{inferencePipelines => inferencepipelines}/TestResultServiceImpl.kt (79%) delete mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponseTest.kt delete mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponseTest.kt delete mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponseTest.kt rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ => commits}/CommitRetrieveParamsTest.kt (95%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ => commits}/CommitRetrieveResponseTest.kt (99%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{CommitTestResultListParamsTest.kt => commits/testresults/TestResultListParamsTest.kt} (70%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{CommitTestResultListResponseTest.kt => commits/testresults/TestResultListResponseTest.kt} (85%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ => inferencepipelines}/InferencePipelineDeleteParamsTest.kt (94%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ => inferencepipelines}/InferencePipelineRetrieveParamsTest.kt (97%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ => inferencepipelines}/InferencePipelineRetrieveResponseTest.kt (99%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ => inferencepipelines}/InferencePipelineUpdateParamsTest.kt (97%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ => inferencepipelines}/InferencePipelineUpdateResponseTest.kt (99%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{InferencePipelineDataStreamParamsTest.kt => inferencepipelines/data/DataStreamParamsTest.kt} (79%) create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponseTest.kt rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{InferencePipelineRowUpdateParamsTest.kt => inferencepipelines/rows/RowUpdateParamsTest.kt} (85%) create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponseTest.kt rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{InferencePipelineTestResultListParamsTest.kt => inferencepipelines/testresults/TestResultListParamsTest.kt} (65%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{InferencePipelineTestResultListResponseTest.kt => inferencepipelines/testresults/TestResultListResponseTest.kt} (82%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ => projects}/ProjectCreateParamsTest.kt (99%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ => projects}/ProjectCreateResponseTest.kt (99%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ => projects}/ProjectListParamsTest.kt (96%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ => projects}/ProjectListResponseTest.kt (99%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ProjectCommitCreateParamsTest.kt => projects/commits/CommitCreateParamsTest.kt} (90%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ProjectCommitCreateResponseTest.kt => projects/commits/CommitCreateResponseTest.kt} (65%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ProjectCommitListParamsTest.kt => projects/commits/CommitListParamsTest.kt} (74%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ProjectCommitListResponseTest.kt => projects/commits/CommitListResponseTest.kt} (83%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ProjectInferencePipelineCreateParamsTest.kt => projects/inferencepipelines/InferencePipelineCreateParamsTest.kt} (84%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ProjectInferencePipelineCreateResponseTest.kt => projects/inferencepipelines/InferencePipelineCreateResponseTest.kt} (71%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ProjectInferencePipelineListParamsTest.kt => projects/inferencepipelines/InferencePipelineListParamsTest.kt} (83%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{ProjectInferencePipelineListResponseTest.kt => projects/inferencepipelines/InferencePipelineListResponseTest.kt} (77%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/models/{StoragePresignedUrlCreateParamsTest.kt => storage/presignedurl/PresignedUrlCreateParamsTest.kt} (65%) create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponseTest.kt rename openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/{inferencePipelines => inferencepipelines}/DataServiceAsyncTest.kt (84%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/{inferencePipelines => inferencepipelines}/RowServiceAsyncTest.kt (83%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/{inferencePipelines => inferencepipelines}/TestResultServiceAsyncTest.kt (73%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/{inferencePipelines => inferencepipelines}/DataServiceTest.kt (84%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/{inferencePipelines => inferencepipelines}/RowServiceTest.kt (83%) rename openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/{inferencePipelines => inferencepipelines}/TestResultServiceTest.kt (71%) diff --git a/README.md b/README.md index fb01744f..779cf2f5 100644 --- a/README.md +++ b/README.md @@ -45,22 +45,22 @@ This library requires Java 8 or later. import com.openlayer.api.client.OpenlayerClient; import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient; import com.openlayer.api.core.JsonValue; -import com.openlayer.api.models.InferencePipelineDataStreamParams; -import com.openlayer.api.models.InferencePipelineDataStreamResponse; +import com.openlayer.api.models.inferencepipelines.data.DataStreamParams; +import com.openlayer.api.models.inferencepipelines.data.DataStreamResponse; // Configures using the `OPENLAYER_API_KEY` environment variable OpenlayerClient client = OpenlayerOkHttpClient.fromEnv(); -InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() +DataStreamParams params = DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config(InferencePipelineDataStreamParams.Config.LlmData.builder() + .config(DataStreamParams.Config.LlmData.builder() .addInputVariableName("user_query") .outputColumnName("output") .numOfTokenColumnName("tokens") .costColumnName("cost") .timestampColumnName("timestamp") .build()) - .addRow(InferencePipelineDataStreamParams.Row.builder() + .addRow(DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("what is the meaning of life?")) .putAdditionalProperty("output", JsonValue.from("42")) .putAdditionalProperty("tokens", JsonValue.from(7)) @@ -68,7 +68,7 @@ InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.bui .putAdditionalProperty("timestamp", JsonValue.from(1610000000)) .build()) .build(); -InferencePipelineDataStreamResponse response = client.inferencePipelines().data().stream(params); +DataStreamResponse response = client.inferencePipelines().data().stream(params); ``` ## Client configuration @@ -121,7 +121,7 @@ See this table for the available options: To send a request to the Openlayer API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class. -For example, `client.inferencePipelines().data().stream(...)` should be called with an instance of `InferencePipelineDataStreamParams`, and it will return an instance of `InferencePipelineDataStreamResponse`. +For example, `client.inferencePipelines().data().stream(...)` should be called with an instance of `DataStreamParams`, and it will return an instance of `DataStreamResponse`. ## Immutability @@ -139,23 +139,23 @@ The default client is synchronous. To switch to asynchronous execution, call the import com.openlayer.api.client.OpenlayerClient; import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient; import com.openlayer.api.core.JsonValue; -import com.openlayer.api.models.InferencePipelineDataStreamParams; -import com.openlayer.api.models.InferencePipelineDataStreamResponse; +import com.openlayer.api.models.inferencepipelines.data.DataStreamParams; +import com.openlayer.api.models.inferencepipelines.data.DataStreamResponse; import java.util.concurrent.CompletableFuture; // Configures using the `OPENLAYER_API_KEY` environment variable OpenlayerClient client = OpenlayerOkHttpClient.fromEnv(); -InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() +DataStreamParams params = DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config(InferencePipelineDataStreamParams.Config.LlmData.builder() + .config(DataStreamParams.Config.LlmData.builder() .addInputVariableName("user_query") .outputColumnName("output") .numOfTokenColumnName("tokens") .costColumnName("cost") .timestampColumnName("timestamp") .build()) - .addRow(InferencePipelineDataStreamParams.Row.builder() + .addRow(DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("what is the meaning of life?")) .putAdditionalProperty("output", JsonValue.from("42")) .putAdditionalProperty("tokens", JsonValue.from(7)) @@ -163,7 +163,7 @@ InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.bui .putAdditionalProperty("timestamp", JsonValue.from(1610000000)) .build()) .build(); -CompletableFuture response = client.async().inferencePipelines().data().stream(params); +CompletableFuture response = client.async().inferencePipelines().data().stream(params); ``` Or create an asynchronous client from the beginning: @@ -172,23 +172,23 @@ Or create an asynchronous client from the beginning: import com.openlayer.api.client.OpenlayerClientAsync; import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync; import com.openlayer.api.core.JsonValue; -import com.openlayer.api.models.InferencePipelineDataStreamParams; -import com.openlayer.api.models.InferencePipelineDataStreamResponse; +import com.openlayer.api.models.inferencepipelines.data.DataStreamParams; +import com.openlayer.api.models.inferencepipelines.data.DataStreamResponse; import java.util.concurrent.CompletableFuture; // Configures using the `OPENLAYER_API_KEY` environment variable OpenlayerClientAsync client = OpenlayerOkHttpClientAsync.fromEnv(); -InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() +DataStreamParams params = DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config(InferencePipelineDataStreamParams.Config.LlmData.builder() + .config(DataStreamParams.Config.LlmData.builder() .addInputVariableName("user_query") .outputColumnName("output") .numOfTokenColumnName("tokens") .costColumnName("cost") .timestampColumnName("timestamp") .build()) - .addRow(InferencePipelineDataStreamParams.Row.builder() + .addRow(DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("what is the meaning of life?")) .putAdditionalProperty("output", JsonValue.from("42")) .putAdditionalProperty("tokens", JsonValue.from(7)) @@ -196,7 +196,7 @@ InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.bui .putAdditionalProperty("timestamp", JsonValue.from(1610000000)) .build()) .build(); -CompletableFuture response = client.inferencePipelines().data().stream(params); +CompletableFuture response = client.inferencePipelines().data().stream(params); ``` The asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s. @@ -211,19 +211,19 @@ To access this data, prefix any HTTP method call on a client or service with `wi import com.openlayer.api.core.JsonValue; import com.openlayer.api.core.http.Headers; import com.openlayer.api.core.http.HttpResponseFor; -import com.openlayer.api.models.InferencePipelineDataStreamParams; -import com.openlayer.api.models.InferencePipelineDataStreamResponse; +import com.openlayer.api.models.inferencepipelines.data.DataStreamParams; +import com.openlayer.api.models.inferencepipelines.data.DataStreamResponse; -InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() +DataStreamParams params = DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config(InferencePipelineDataStreamParams.Config.LlmData.builder() + .config(DataStreamParams.Config.LlmData.builder() .addInputVariableName("user_query") .outputColumnName("output") .numOfTokenColumnName("tokens") .costColumnName("cost") .timestampColumnName("timestamp") .build()) - .addRow(InferencePipelineDataStreamParams.Row.builder() + .addRow(DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("what is the meaning of life?")) .putAdditionalProperty("output", JsonValue.from("42")) .putAdditionalProperty("tokens", JsonValue.from(7)) @@ -231,7 +231,7 @@ InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.bui .putAdditionalProperty("timestamp", JsonValue.from(1610000000)) .build()) .build(); -HttpResponseFor response = client.inferencePipelines().data().withRawResponse().stream(params); +HttpResponseFor response = client.inferencePipelines().data().withRawResponse().stream(params); int statusCode = response.statusCode(); Headers headers = response.headers(); @@ -240,9 +240,9 @@ Headers headers = response.headers(); You can still deserialize the response into an instance of a Java class if needed: ```java -import com.openlayer.api.models.InferencePipelineDataStreamResponse; +import com.openlayer.api.models.inferencepipelines.data.DataStreamResponse; -InferencePipelineDataStreamResponse parsedResponse = response.parse(); +DataStreamResponse parsedResponse = response.parse(); ``` ## Error handling @@ -320,10 +320,10 @@ To set a custom timeout, configure the method call using the `timeout` method: ```java import com.openlayer.api.core.JsonValue; -import com.openlayer.api.models.InferencePipelineDataStreamParams; -import com.openlayer.api.models.InferencePipelineDataStreamResponse; +import com.openlayer.api.models.inferencepipelines.data.DataStreamParams; +import com.openlayer.api.models.inferencepipelines.data.DataStreamResponse; -InferencePipelineDataStreamResponse response = client.inferencePipelines().data().stream( +DataStreamResponse response = client.inferencePipelines().data().stream( params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build() ); ``` @@ -371,9 +371,9 @@ To set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQu ```java import com.openlayer.api.core.JsonValue; -import com.openlayer.api.models.InferencePipelineDataStreamParams; +import com.openlayer.api.models.inferencepipelines.data.DataStreamParams; -InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() +DataStreamParams params = DataStreamParams.builder() .putAdditionalHeader("Secret-Header", "42") .putAdditionalQueryParam("secret_query_param", "42") .putAdditionalBodyProperty("secretProperty", JsonValue.from("42")) @@ -386,7 +386,7 @@ To set undocumented parameters on _nested_ headers, query params, or body classe ```java import com.openlayer.api.core.JsonValue; -import com.openlayer.api.models.ProjectCreateParams; +import com.openlayer.api.models.projects.ProjectCreateParams; ProjectCreateParams params = ProjectCreateParams.builder() .links(ProjectCreateParams.Links.builder() @@ -401,11 +401,11 @@ To set a documented parameter or property to an undocumented or not yet supporte ```java import com.openlayer.api.core.JsonValue; -import com.openlayer.api.models.InferencePipelineDataStreamParams; +import com.openlayer.api.models.inferencepipelines.data.DataStreamParams; -InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() +DataStreamParams params = DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config(InferencePipelineDataStreamParams.Config.LlmData.builder() + .config(DataStreamParams.Config.LlmData.builder() .addInputVariableName("user_query") .outputColumnName("output") .numOfTokenColumnName("tokens") @@ -491,10 +491,10 @@ To access a property's raw JSON value, which may be undocumented, call its `_` p ```java import com.openlayer.api.core.JsonField; -import com.openlayer.api.models.InferencePipelineDataStreamParams; +import com.openlayer.api.models.inferencepipelines.data.DataStreamParams; import java.util.Optional; -JsonField config = client.inferencePipelines().data().stream(params)._config(); +JsonField config = client.inferencePipelines().data().stream(params)._config(); if (config.isMissing()) { // The property is absent from the JSON response @@ -519,19 +519,19 @@ By default, the SDK will not throw an exception in this case. It will throw [`Op If you would prefer to check that the response is completely well-typed upfront, then either call `validate()`: ```java -import com.openlayer.api.models.InferencePipelineDataStreamResponse; +import com.openlayer.api.models.inferencepipelines.data.DataStreamResponse; -InferencePipelineDataStreamResponse response = client.inferencePipelines().data().stream(params).validate(); +DataStreamResponse response = client.inferencePipelines().data().stream(params).validate(); ``` Or configure the method call to validate the response using the `responseValidation` method: ```java import com.openlayer.api.core.JsonValue; -import com.openlayer.api.models.InferencePipelineDataStreamParams; -import com.openlayer.api.models.InferencePipelineDataStreamResponse; +import com.openlayer.api.models.inferencepipelines.data.DataStreamParams; +import com.openlayer.api.models.inferencepipelines.data.DataStreamResponse; -InferencePipelineDataStreamResponse response = client.inferencePipelines().data().stream( +DataStreamResponse response = client.inferencePipelines().data().stream( params, RequestOptions.builder().responseValidation(true).build() ); ``` diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveParams.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveParams.kt index e529617c..ea0ddb37 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.commits import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt index ce103110..5ec6e533 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.commits import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt similarity index 92% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt index 99bd7a37..5a490932 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.commits.testresults import com.fasterxml.jackson.annotation.JsonCreator import com.openlayer.api.core.Enum @@ -16,7 +16,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** List the test results for a project commit (project version). */ -class CommitTestResultListParams +class TestResultListParams private constructor( private val projectVersionId: String, private val includeArchived: Boolean?, @@ -80,7 +80,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [CommitTestResultListParams]. + * Returns a mutable builder for constructing an instance of [TestResultListParams]. * * The following fields are required: * ```java @@ -90,7 +90,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [CommitTestResultListParams]. */ + /** A builder for [TestResultListParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -104,15 +104,15 @@ private constructor( private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic - internal fun from(commitTestResultListParams: CommitTestResultListParams) = apply { - projectVersionId = commitTestResultListParams.projectVersionId - includeArchived = commitTestResultListParams.includeArchived - page = commitTestResultListParams.page - perPage = commitTestResultListParams.perPage - status = commitTestResultListParams.status - type = commitTestResultListParams.type - additionalHeaders = commitTestResultListParams.additionalHeaders.toBuilder() - additionalQueryParams = commitTestResultListParams.additionalQueryParams.toBuilder() + internal fun from(testResultListParams: TestResultListParams) = apply { + projectVersionId = testResultListParams.projectVersionId + includeArchived = testResultListParams.includeArchived + page = testResultListParams.page + perPage = testResultListParams.perPage + status = testResultListParams.status + type = testResultListParams.type + additionalHeaders = testResultListParams.additionalHeaders.toBuilder() + additionalQueryParams = testResultListParams.additionalQueryParams.toBuilder() } fun projectVersionId(projectVersionId: String) = apply { @@ -271,8 +271,8 @@ private constructor( additionalQueryParams.removeAll(keys) } - fun build(): CommitTestResultListParams = - CommitTestResultListParams( + fun build(): TestResultListParams = + TestResultListParams( checkRequired("projectVersionId", projectVersionId), includeArchived, page, @@ -533,11 +533,11 @@ private constructor( return true } - return /* spotless:off */ other is CommitTestResultListParams && projectVersionId == other.projectVersionId && includeArchived == other.includeArchived && page == other.page && perPage == other.perPage && status == other.status && type == other.type && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + return /* spotless:off */ other is TestResultListParams && projectVersionId == other.projectVersionId && includeArchived == other.includeArchived && page == other.page && perPage == other.perPage && status == other.status && type == other.type && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int = /* spotless:off */ Objects.hash(projectVersionId, includeArchived, page, perPage, status, type, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "CommitTestResultListParams{projectVersionId=$projectVersionId, includeArchived=$includeArchived, page=$page, perPage=$perPage, status=$status, type=$type, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "TestResultListParams{projectVersionId=$projectVersionId, includeArchived=$includeArchived, page=$page, perPage=$perPage, status=$status, type=$type, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt similarity index 98% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt index 31b8a03e..0c196fbd 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.commits.testresults import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -33,7 +33,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull @NoAutoDetect -class CommitTestResultListResponse +class TestResultListResponse @JsonCreator private constructor( @JsonProperty("items") @@ -52,7 +52,7 @@ private constructor( private var validated: Boolean = false - fun validate(): CommitTestResultListResponse = apply { + fun validate(): TestResultListResponse = apply { if (validated) { return@apply } @@ -66,7 +66,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [CommitTestResultListResponse]. + * Returns a mutable builder for constructing an instance of [TestResultListResponse]. * * The following fields are required: * ```java @@ -76,16 +76,16 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [CommitTestResultListResponse]. */ + /** A builder for [TestResultListResponse]. */ class Builder internal constructor() { private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(commitTestResultListResponse: CommitTestResultListResponse) = apply { - items = commitTestResultListResponse.items.map { it.toMutableList() } - additionalProperties = commitTestResultListResponse.additionalProperties.toMutableMap() + internal fun from(testResultListResponse: TestResultListResponse) = apply { + items = testResultListResponse.items.map { it.toMutableList() } + additionalProperties = testResultListResponse.additionalProperties.toMutableMap() } fun items(items: List) = items(JsonField.of(items)) @@ -118,8 +118,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): CommitTestResultListResponse = - CommitTestResultListResponse( + fun build(): TestResultListResponse = + TestResultListResponse( checkRequired("items", items).map { it.toImmutable() }, additionalProperties.toImmutable(), ) @@ -1627,7 +1627,7 @@ private constructor( return true } - return /* spotless:off */ other is CommitTestResultListResponse && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TestResultListResponse && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -1637,5 +1637,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CommitTestResultListResponse{items=$items, additionalProperties=$additionalProperties}" + "TestResultListResponse{items=$items, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt index d2bb0594..26c08a75 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt index c8e70b84..9c76d388 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines import com.fasterxml.jackson.annotation.JsonCreator import com.openlayer.api.core.Enum diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt index 0a154fc1..7639e73e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt index f5193a7c..c7c52c80 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt index 815ec148..fdb63441 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt similarity index 98% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt index b01da61e..402bf8bc 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines.data import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -34,7 +34,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Publish an inference data point to an inference pipeline. */ -class InferencePipelineDataStreamParams +class DataStreamParams private constructor( private val inferencePipelineId: String, private val body: Body, @@ -244,8 +244,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [InferencePipelineDataStreamParams]. + * Returns a mutable builder for constructing an instance of [DataStreamParams]. * * The following fields are required: * ```java @@ -257,7 +256,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InferencePipelineDataStreamParams]. */ + /** A builder for [DataStreamParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -267,14 +266,12 @@ private constructor( private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic - internal fun from(inferencePipelineDataStreamParams: InferencePipelineDataStreamParams) = - apply { - inferencePipelineId = inferencePipelineDataStreamParams.inferencePipelineId - body = inferencePipelineDataStreamParams.body.toBuilder() - additionalHeaders = inferencePipelineDataStreamParams.additionalHeaders.toBuilder() - additionalQueryParams = - inferencePipelineDataStreamParams.additionalQueryParams.toBuilder() - } + internal fun from(dataStreamParams: DataStreamParams) = apply { + inferencePipelineId = dataStreamParams.inferencePipelineId + body = dataStreamParams.body.toBuilder() + additionalHeaders = dataStreamParams.additionalHeaders.toBuilder() + additionalQueryParams = dataStreamParams.additionalQueryParams.toBuilder() + } fun inferencePipelineId(inferencePipelineId: String) = apply { this.inferencePipelineId = inferencePipelineId @@ -430,8 +427,8 @@ private constructor( additionalQueryParams.removeAll(keys) } - fun build(): InferencePipelineDataStreamParams = - InferencePipelineDataStreamParams( + fun build(): DataStreamParams = + DataStreamParams( checkRequired("inferencePipelineId", inferencePipelineId), body.build(), additionalHeaders.build(), @@ -2456,11 +2453,11 @@ private constructor( return true } - return /* spotless:off */ other is InferencePipelineDataStreamParams && inferencePipelineId == other.inferencePipelineId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + return /* spotless:off */ other is DataStreamParams && inferencePipelineId == other.inferencePipelineId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int = /* spotless:off */ Objects.hash(inferencePipelineId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "InferencePipelineDataStreamParams{inferencePipelineId=$inferencePipelineId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "DataStreamParams{inferencePipelineId=$inferencePipelineId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt similarity index 87% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt index fce75b93..1f2bbb17 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines.data import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -19,7 +19,7 @@ import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects @NoAutoDetect -class InferencePipelineDataStreamResponse +class DataStreamResponse @JsonCreator private constructor( @JsonProperty("success") @@ -38,7 +38,7 @@ private constructor( private var validated: Boolean = false - fun validate(): InferencePipelineDataStreamResponse = apply { + fun validate(): DataStreamResponse = apply { if (validated) { return@apply } @@ -52,8 +52,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [InferencePipelineDataStreamResponse]. + * Returns a mutable builder for constructing an instance of [DataStreamResponse]. * * The following fields are required: * ```java @@ -63,19 +62,16 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InferencePipelineDataStreamResponse]. */ + /** A builder for [DataStreamResponse]. */ class Builder internal constructor() { private var success: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - inferencePipelineDataStreamResponse: InferencePipelineDataStreamResponse - ) = apply { - success = inferencePipelineDataStreamResponse.success - additionalProperties = - inferencePipelineDataStreamResponse.additionalProperties.toMutableMap() + internal fun from(dataStreamResponse: DataStreamResponse) = apply { + success = dataStreamResponse.success + additionalProperties = dataStreamResponse.additionalProperties.toMutableMap() } fun success(success: Success) = success(JsonField.of(success)) @@ -101,8 +97,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InferencePipelineDataStreamResponse = - InferencePipelineDataStreamResponse( + fun build(): DataStreamResponse = + DataStreamResponse( checkRequired("success", success), additionalProperties.toImmutable(), ) @@ -204,7 +200,7 @@ private constructor( return true } - return /* spotless:off */ other is InferencePipelineDataStreamResponse && success == other.success && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is DataStreamResponse && success == other.success && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -214,5 +210,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "InferencePipelineDataStreamResponse{success=$success, additionalProperties=$additionalProperties}" + "DataStreamResponse{success=$success, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt similarity index 94% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt index 72704fb6..efa8c5fb 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines.rows import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -22,7 +22,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Update an inference data point in an inference pipeline. */ -class InferencePipelineRowUpdateParams +class RowUpdateParams private constructor( private val inferencePipelineId: String, private val inferenceId: String, @@ -182,8 +182,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [InferencePipelineRowUpdateParams]. + * Returns a mutable builder for constructing an instance of [RowUpdateParams]. * * The following fields are required: * ```java @@ -195,7 +194,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InferencePipelineRowUpdateParams]. */ + /** A builder for [RowUpdateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -206,15 +205,13 @@ private constructor( private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic - internal fun from(inferencePipelineRowUpdateParams: InferencePipelineRowUpdateParams) = - apply { - inferencePipelineId = inferencePipelineRowUpdateParams.inferencePipelineId - inferenceId = inferencePipelineRowUpdateParams.inferenceId - body = inferencePipelineRowUpdateParams.body.toBuilder() - additionalHeaders = inferencePipelineRowUpdateParams.additionalHeaders.toBuilder() - additionalQueryParams = - inferencePipelineRowUpdateParams.additionalQueryParams.toBuilder() - } + internal fun from(rowUpdateParams: RowUpdateParams) = apply { + inferencePipelineId = rowUpdateParams.inferencePipelineId + inferenceId = rowUpdateParams.inferenceId + body = rowUpdateParams.body.toBuilder() + additionalHeaders = rowUpdateParams.additionalHeaders.toBuilder() + additionalQueryParams = rowUpdateParams.additionalQueryParams.toBuilder() + } fun inferencePipelineId(inferencePipelineId: String) = apply { this.inferencePipelineId = inferencePipelineId @@ -348,8 +345,8 @@ private constructor( additionalQueryParams.removeAll(keys) } - fun build(): InferencePipelineRowUpdateParams = - InferencePipelineRowUpdateParams( + fun build(): RowUpdateParams = + RowUpdateParams( checkRequired("inferencePipelineId", inferencePipelineId), checkRequired("inferenceId", inferenceId), body.build(), @@ -621,11 +618,11 @@ private constructor( return true } - return /* spotless:off */ other is InferencePipelineRowUpdateParams && inferencePipelineId == other.inferencePipelineId && inferenceId == other.inferenceId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + return /* spotless:off */ other is RowUpdateParams && inferencePipelineId == other.inferencePipelineId && inferenceId == other.inferenceId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int = /* spotless:off */ Objects.hash(inferencePipelineId, inferenceId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "InferencePipelineRowUpdateParams{inferencePipelineId=$inferencePipelineId, inferenceId=$inferenceId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "RowUpdateParams{inferencePipelineId=$inferencePipelineId, inferenceId=$inferenceId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt similarity index 85% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt index 93991f55..d3608e12 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines.rows import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -19,7 +19,7 @@ import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects @NoAutoDetect -class InferencePipelineRowUpdateResponse +class RowUpdateResponse @JsonCreator private constructor( @JsonProperty("success") @@ -38,7 +38,7 @@ private constructor( private var validated: Boolean = false - fun validate(): InferencePipelineRowUpdateResponse = apply { + fun validate(): RowUpdateResponse = apply { if (validated) { return@apply } @@ -52,8 +52,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [InferencePipelineRowUpdateResponse]. + * Returns a mutable builder for constructing an instance of [RowUpdateResponse]. * * The following fields are required: * ```java @@ -63,19 +62,17 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InferencePipelineRowUpdateResponse]. */ + /** A builder for [RowUpdateResponse]. */ class Builder internal constructor() { private var success: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineRowUpdateResponse: InferencePipelineRowUpdateResponse) = - apply { - success = inferencePipelineRowUpdateResponse.success - additionalProperties = - inferencePipelineRowUpdateResponse.additionalProperties.toMutableMap() - } + internal fun from(rowUpdateResponse: RowUpdateResponse) = apply { + success = rowUpdateResponse.success + additionalProperties = rowUpdateResponse.additionalProperties.toMutableMap() + } fun success(success: Success) = success(JsonField.of(success)) @@ -100,11 +97,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InferencePipelineRowUpdateResponse = - InferencePipelineRowUpdateResponse( - checkRequired("success", success), - additionalProperties.toImmutable(), - ) + fun build(): RowUpdateResponse = + RowUpdateResponse(checkRequired("success", success), additionalProperties.toImmutable()) } class Success @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -203,7 +197,7 @@ private constructor( return true } - return /* spotless:off */ other is InferencePipelineRowUpdateResponse && success == other.success && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is RowUpdateResponse && success == other.success && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -213,5 +207,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "InferencePipelineRowUpdateResponse{success=$success, additionalProperties=$additionalProperties}" + "RowUpdateResponse{success=$success, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt similarity index 91% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt index dfecb3d3..1347b00f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines.testresults import com.fasterxml.jackson.annotation.JsonCreator import com.openlayer.api.core.Enum @@ -16,7 +16,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** List the latest test results for an inference pipeline. */ -class InferencePipelineTestResultListParams +class TestResultListParams private constructor( private val inferencePipelineId: String, private val page: Long?, @@ -75,8 +75,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [InferencePipelineTestResultListParams]. + * Returns a mutable builder for constructing an instance of [TestResultListParams]. * * The following fields are required: * ```java @@ -86,7 +85,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InferencePipelineTestResultListParams]. */ + /** A builder for [TestResultListParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -99,17 +98,14 @@ private constructor( private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic - internal fun from( - inferencePipelineTestResultListParams: InferencePipelineTestResultListParams - ) = apply { - inferencePipelineId = inferencePipelineTestResultListParams.inferencePipelineId - page = inferencePipelineTestResultListParams.page - perPage = inferencePipelineTestResultListParams.perPage - status = inferencePipelineTestResultListParams.status - type = inferencePipelineTestResultListParams.type - additionalHeaders = inferencePipelineTestResultListParams.additionalHeaders.toBuilder() - additionalQueryParams = - inferencePipelineTestResultListParams.additionalQueryParams.toBuilder() + internal fun from(testResultListParams: TestResultListParams) = apply { + inferencePipelineId = testResultListParams.inferencePipelineId + page = testResultListParams.page + perPage = testResultListParams.perPage + status = testResultListParams.status + type = testResultListParams.type + additionalHeaders = testResultListParams.additionalHeaders.toBuilder() + additionalQueryParams = testResultListParams.additionalQueryParams.toBuilder() } fun inferencePipelineId(inferencePipelineId: String) = apply { @@ -256,8 +252,8 @@ private constructor( additionalQueryParams.removeAll(keys) } - fun build(): InferencePipelineTestResultListParams = - InferencePipelineTestResultListParams( + fun build(): TestResultListParams = + TestResultListParams( checkRequired("inferencePipelineId", inferencePipelineId), page, perPage, @@ -517,11 +513,11 @@ private constructor( return true } - return /* spotless:off */ other is InferencePipelineTestResultListParams && inferencePipelineId == other.inferencePipelineId && page == other.page && perPage == other.perPage && status == other.status && type == other.type && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + return /* spotless:off */ other is TestResultListParams && inferencePipelineId == other.inferencePipelineId && page == other.page && perPage == other.perPage && status == other.status && type == other.type && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int = /* spotless:off */ Objects.hash(inferencePipelineId, page, perPage, status, type, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "InferencePipelineTestResultListParams{inferencePipelineId=$inferencePipelineId, page=$page, perPage=$perPage, status=$status, type=$type, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "TestResultListParams{inferencePipelineId=$inferencePipelineId, page=$page, perPage=$perPage, status=$status, type=$type, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt similarity index 98% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt index d9de48fc..5dc49bee 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines.testresults import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -33,7 +33,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull @NoAutoDetect -class InferencePipelineTestResultListResponse +class TestResultListResponse @JsonCreator private constructor( @JsonProperty("items") @@ -52,7 +52,7 @@ private constructor( private var validated: Boolean = false - fun validate(): InferencePipelineTestResultListResponse = apply { + fun validate(): TestResultListResponse = apply { if (validated) { return@apply } @@ -66,8 +66,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [InferencePipelineTestResultListResponse]. + * Returns a mutable builder for constructing an instance of [TestResultListResponse]. * * The following fields are required: * ```java @@ -77,19 +76,16 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InferencePipelineTestResultListResponse]. */ + /** A builder for [TestResultListResponse]. */ class Builder internal constructor() { private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - inferencePipelineTestResultListResponse: InferencePipelineTestResultListResponse - ) = apply { - items = inferencePipelineTestResultListResponse.items.map { it.toMutableList() } - additionalProperties = - inferencePipelineTestResultListResponse.additionalProperties.toMutableMap() + internal fun from(testResultListResponse: TestResultListResponse) = apply { + items = testResultListResponse.items.map { it.toMutableList() } + additionalProperties = testResultListResponse.additionalProperties.toMutableMap() } fun items(items: List) = items(JsonField.of(items)) @@ -122,8 +118,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InferencePipelineTestResultListResponse = - InferencePipelineTestResultListResponse( + fun build(): TestResultListResponse = + TestResultListResponse( checkRequired("items", items).map { it.toImmutable() }, additionalProperties.toImmutable(), ) @@ -1631,7 +1627,7 @@ private constructor( return true } - return /* spotless:off */ other is InferencePipelineTestResultListResponse && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TestResultListResponse && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -1641,5 +1637,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "InferencePipelineTestResultListResponse{items=$items, additionalProperties=$additionalProperties}" + "TestResultListResponse{items=$items, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt index 3a35b840..67a74d7a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt index f9de023d..20e763dc 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt index a1bb13bd..321c813f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects import com.fasterxml.jackson.annotation.JsonCreator import com.openlayer.api.core.Enum diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt index 06754244..b22668ba 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt similarity index 98% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt index cf3ed57a..50df3663 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects.commits import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -25,7 +25,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Create a new commit (project version) in a project. */ -class ProjectCommitCreateParams +class CommitCreateParams private constructor( private val projectId: String, private val body: Body, @@ -672,7 +672,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [ProjectCommitCreateParams]. + * Returns a mutable builder for constructing an instance of [CommitCreateParams]. * * The following fields are required: * ```java @@ -696,7 +696,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ProjectCommitCreateParams]. */ + /** A builder for [CommitCreateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -706,11 +706,11 @@ private constructor( private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic - internal fun from(projectCommitCreateParams: ProjectCommitCreateParams) = apply { - projectId = projectCommitCreateParams.projectId - body = projectCommitCreateParams.body.toBuilder() - additionalHeaders = projectCommitCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = projectCommitCreateParams.additionalQueryParams.toBuilder() + internal fun from(commitCreateParams: CommitCreateParams) = apply { + projectId = commitCreateParams.projectId + body = commitCreateParams.body.toBuilder() + additionalHeaders = commitCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = commitCreateParams.additionalQueryParams.toBuilder() } fun projectId(projectId: String) = apply { this.projectId = projectId } @@ -991,8 +991,8 @@ private constructor( additionalQueryParams.removeAll(keys) } - fun build(): ProjectCommitCreateParams = - ProjectCommitCreateParams( + fun build(): CommitCreateParams = + CommitCreateParams( checkRequired("projectId", projectId), body.build(), additionalHeaders.build(), @@ -1607,11 +1607,11 @@ private constructor( return true } - return /* spotless:off */ other is ProjectCommitCreateParams && projectId == other.projectId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + return /* spotless:off */ other is CommitCreateParams && projectId == other.projectId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int = /* spotless:off */ Objects.hash(projectId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "ProjectCommitCreateParams{projectId=$projectId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "CommitCreateParams{projectId=$projectId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt similarity index 93% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt index 64e04dd8..5ea76e58 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects.commits import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -22,7 +22,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull @NoAutoDetect -class ProjectCommitCreateResponse +class CommitCreateResponse @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), @@ -210,7 +210,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ProjectCommitCreateResponse = apply { + fun validate(): CommitCreateResponse = apply { if (validated) { return@apply } @@ -240,7 +240,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [ProjectCommitCreateResponse]. + * Returns a mutable builder for constructing an instance of [CommitCreateResponse]. * * The following fields are required: * ```java @@ -263,7 +263,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ProjectCommitCreateResponse]. */ + /** A builder for [CommitCreateResponse]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -286,25 +286,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(projectCommitCreateResponse: ProjectCommitCreateResponse) = apply { - id = projectCommitCreateResponse.id - commit = projectCommitCreateResponse.commit - dateArchived = projectCommitCreateResponse.dateArchived - dateCreated = projectCommitCreateResponse.dateCreated - failingGoalCount = projectCommitCreateResponse.failingGoalCount - mlModelId = projectCommitCreateResponse.mlModelId - passingGoalCount = projectCommitCreateResponse.passingGoalCount - projectId = projectCommitCreateResponse.projectId - status = projectCommitCreateResponse.status - statusMessage = projectCommitCreateResponse.statusMessage - storageUri = projectCommitCreateResponse.storageUri - totalGoalCount = projectCommitCreateResponse.totalGoalCount - trainingDatasetId = projectCommitCreateResponse.trainingDatasetId - validationDatasetId = projectCommitCreateResponse.validationDatasetId - archived = projectCommitCreateResponse.archived - deploymentStatus = projectCommitCreateResponse.deploymentStatus - links = projectCommitCreateResponse.links - additionalProperties = projectCommitCreateResponse.additionalProperties.toMutableMap() + internal fun from(commitCreateResponse: CommitCreateResponse) = apply { + id = commitCreateResponse.id + commit = commitCreateResponse.commit + dateArchived = commitCreateResponse.dateArchived + dateCreated = commitCreateResponse.dateCreated + failingGoalCount = commitCreateResponse.failingGoalCount + mlModelId = commitCreateResponse.mlModelId + passingGoalCount = commitCreateResponse.passingGoalCount + projectId = commitCreateResponse.projectId + status = commitCreateResponse.status + statusMessage = commitCreateResponse.statusMessage + storageUri = commitCreateResponse.storageUri + totalGoalCount = commitCreateResponse.totalGoalCount + trainingDatasetId = commitCreateResponse.trainingDatasetId + validationDatasetId = commitCreateResponse.validationDatasetId + archived = commitCreateResponse.archived + deploymentStatus = commitCreateResponse.deploymentStatus + links = commitCreateResponse.links + additionalProperties = commitCreateResponse.additionalProperties.toMutableMap() } /** The project version (commit) id. */ @@ -482,8 +482,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): ProjectCommitCreateResponse = - ProjectCommitCreateResponse( + fun build(): CommitCreateResponse = + CommitCreateResponse( checkRequired("id", id), checkRequired("commit", commit), checkRequired("dateArchived", dateArchived), @@ -1112,7 +1112,7 @@ private constructor( return true } - return /* spotless:off */ other is ProjectCommitCreateResponse && id == other.id && commit == other.commit && dateArchived == other.dateArchived && dateCreated == other.dateCreated && failingGoalCount == other.failingGoalCount && mlModelId == other.mlModelId && passingGoalCount == other.passingGoalCount && projectId == other.projectId && status == other.status && statusMessage == other.statusMessage && storageUri == other.storageUri && totalGoalCount == other.totalGoalCount && trainingDatasetId == other.trainingDatasetId && validationDatasetId == other.validationDatasetId && archived == other.archived && deploymentStatus == other.deploymentStatus && links == other.links && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CommitCreateResponse && id == other.id && commit == other.commit && dateArchived == other.dateArchived && dateCreated == other.dateCreated && failingGoalCount == other.failingGoalCount && mlModelId == other.mlModelId && passingGoalCount == other.passingGoalCount && projectId == other.projectId && status == other.status && statusMessage == other.statusMessage && storageUri == other.storageUri && totalGoalCount == other.totalGoalCount && trainingDatasetId == other.trainingDatasetId && validationDatasetId == other.validationDatasetId && archived == other.archived && deploymentStatus == other.deploymentStatus && links == other.links && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -1122,5 +1122,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ProjectCommitCreateResponse{id=$id, commit=$commit, dateArchived=$dateArchived, dateCreated=$dateCreated, failingGoalCount=$failingGoalCount, mlModelId=$mlModelId, passingGoalCount=$passingGoalCount, projectId=$projectId, status=$status, statusMessage=$statusMessage, storageUri=$storageUri, totalGoalCount=$totalGoalCount, trainingDatasetId=$trainingDatasetId, validationDatasetId=$validationDatasetId, archived=$archived, deploymentStatus=$deploymentStatus, links=$links, additionalProperties=$additionalProperties}" + "CommitCreateResponse{id=$id, commit=$commit, dateArchived=$dateArchived, dateCreated=$dateCreated, failingGoalCount=$failingGoalCount, mlModelId=$mlModelId, passingGoalCount=$passingGoalCount, projectId=$projectId, status=$status, statusMessage=$statusMessage, storageUri=$storageUri, totalGoalCount=$totalGoalCount, trainingDatasetId=$trainingDatasetId, validationDatasetId=$validationDatasetId, archived=$archived, deploymentStatus=$deploymentStatus, links=$links, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt similarity index 87% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt index a643acd2..0c2fd117 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects.commits import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params @@ -12,7 +12,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** List the commits (project versions) in a project. */ -class ProjectCommitListParams +class CommitListParams private constructor( private val projectId: String, private val page: Long?, @@ -55,7 +55,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [ProjectCommitListParams]. + * Returns a mutable builder for constructing an instance of [CommitListParams]. * * The following fields are required: * ```java @@ -65,7 +65,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ProjectCommitListParams]. */ + /** A builder for [CommitListParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -76,12 +76,12 @@ private constructor( private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic - internal fun from(projectCommitListParams: ProjectCommitListParams) = apply { - projectId = projectCommitListParams.projectId - page = projectCommitListParams.page - perPage = projectCommitListParams.perPage - additionalHeaders = projectCommitListParams.additionalHeaders.toBuilder() - additionalQueryParams = projectCommitListParams.additionalQueryParams.toBuilder() + internal fun from(commitListParams: CommitListParams) = apply { + projectId = commitListParams.projectId + page = commitListParams.page + perPage = commitListParams.perPage + additionalHeaders = commitListParams.additionalHeaders.toBuilder() + additionalQueryParams = commitListParams.additionalQueryParams.toBuilder() } fun projectId(projectId: String) = apply { this.projectId = projectId } @@ -202,8 +202,8 @@ private constructor( additionalQueryParams.removeAll(keys) } - fun build(): ProjectCommitListParams = - ProjectCommitListParams( + fun build(): CommitListParams = + CommitListParams( checkRequired("projectId", projectId), page, perPage, @@ -217,11 +217,11 @@ private constructor( return true } - return /* spotless:off */ other is ProjectCommitListParams && projectId == other.projectId && page == other.page && perPage == other.perPage && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + return /* spotless:off */ other is CommitListParams && projectId == other.projectId && page == other.page && perPage == other.perPage && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int = /* spotless:off */ Objects.hash(projectId, page, perPage, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "ProjectCommitListParams{projectId=$projectId, page=$page, perPage=$perPage, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "CommitListParams{projectId=$projectId, page=$page, perPage=$perPage, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt similarity index 98% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt index a63057d3..9b440605 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects.commits import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -23,7 +23,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull @NoAutoDetect -class ProjectCommitListResponse +class CommitListResponse @JsonCreator private constructor( @JsonProperty("items") @@ -42,7 +42,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ProjectCommitListResponse = apply { + fun validate(): CommitListResponse = apply { if (validated) { return@apply } @@ -56,7 +56,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [ProjectCommitListResponse]. + * Returns a mutable builder for constructing an instance of [CommitListResponse]. * * The following fields are required: * ```java @@ -66,16 +66,16 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ProjectCommitListResponse]. */ + /** A builder for [CommitListResponse]. */ class Builder internal constructor() { private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(projectCommitListResponse: ProjectCommitListResponse) = apply { - items = projectCommitListResponse.items.map { it.toMutableList() } - additionalProperties = projectCommitListResponse.additionalProperties.toMutableMap() + internal fun from(commitListResponse: CommitListResponse) = apply { + items = commitListResponse.items.map { it.toMutableList() } + additionalProperties = commitListResponse.additionalProperties.toMutableMap() } fun items(items: List) = items(JsonField.of(items)) @@ -108,8 +108,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): ProjectCommitListResponse = - ProjectCommitListResponse( + fun build(): CommitListResponse = + CommitListResponse( checkRequired("items", items).map { it.toImmutable() }, additionalProperties.toImmutable(), ) @@ -1247,7 +1247,7 @@ private constructor( return true } - return /* spotless:off */ other is ProjectCommitListResponse && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CommitListResponse && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -1257,5 +1257,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ProjectCommitListResponse{items=$items, additionalProperties=$additionalProperties}" + "CommitListResponse{items=$items, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt index 563f2f33..611eb28c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects.inferencepipelines import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -27,7 +27,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Create an inference pipeline in a project. */ -class ProjectInferencePipelineCreateParams +class InferencePipelineCreateParams private constructor( private val projectId: String, private val body: Body, @@ -678,7 +678,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [ProjectInferencePipelineCreateParams]. + * [InferencePipelineCreateParams]. * * The following fields are required: * ```java @@ -703,7 +703,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ProjectInferencePipelineCreateParams]. */ + /** A builder for [InferencePipelineCreateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -713,14 +713,11 @@ private constructor( private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic - internal fun from( - projectInferencePipelineCreateParams: ProjectInferencePipelineCreateParams - ) = apply { - projectId = projectInferencePipelineCreateParams.projectId - body = projectInferencePipelineCreateParams.body.toBuilder() - additionalHeaders = projectInferencePipelineCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = - projectInferencePipelineCreateParams.additionalQueryParams.toBuilder() + internal fun from(inferencePipelineCreateParams: InferencePipelineCreateParams) = apply { + projectId = inferencePipelineCreateParams.projectId + body = inferencePipelineCreateParams.body.toBuilder() + additionalHeaders = inferencePipelineCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = inferencePipelineCreateParams.additionalQueryParams.toBuilder() } fun projectId(projectId: String) = apply { this.projectId = projectId } @@ -995,8 +992,8 @@ private constructor( additionalQueryParams.removeAll(keys) } - fun build(): ProjectInferencePipelineCreateParams = - ProjectInferencePipelineCreateParams( + fun build(): InferencePipelineCreateParams = + InferencePipelineCreateParams( checkRequired("projectId", projectId), body.build(), additionalHeaders.build(), @@ -3071,11 +3068,11 @@ private constructor( return true } - return /* spotless:off */ other is ProjectInferencePipelineCreateParams && projectId == other.projectId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + return /* spotless:off */ other is InferencePipelineCreateParams && projectId == other.projectId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int = /* spotless:off */ Objects.hash(projectId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "ProjectInferencePipelineCreateParams{projectId=$projectId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "InferencePipelineCreateParams{projectId=$projectId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt similarity index 96% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt index 4875275a..5200f704 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects.inferencepipelines import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -24,7 +24,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull @NoAutoDetect -class ProjectInferencePipelineCreateResponse +class InferencePipelineCreateResponse @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), @@ -210,7 +210,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ProjectInferencePipelineCreateResponse = apply { + fun validate(): InferencePipelineCreateResponse = apply { if (validated) { return@apply } @@ -242,7 +242,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [ProjectInferencePipelineCreateResponse]. + * [InferencePipelineCreateResponse]. * * The following fields are required: * ```java @@ -266,7 +266,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ProjectInferencePipelineCreateResponse]. */ + /** A builder for [InferencePipelineCreateResponse]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -290,30 +290,29 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - projectInferencePipelineCreateResponse: ProjectInferencePipelineCreateResponse - ) = apply { - id = projectInferencePipelineCreateResponse.id - dateCreated = projectInferencePipelineCreateResponse.dateCreated - dateLastEvaluated = projectInferencePipelineCreateResponse.dateLastEvaluated - dateLastSampleReceived = projectInferencePipelineCreateResponse.dateLastSampleReceived - dateOfNextEvaluation = projectInferencePipelineCreateResponse.dateOfNextEvaluation - dateUpdated = projectInferencePipelineCreateResponse.dateUpdated - description = projectInferencePipelineCreateResponse.description - failingGoalCount = projectInferencePipelineCreateResponse.failingGoalCount - links = projectInferencePipelineCreateResponse.links - name = projectInferencePipelineCreateResponse.name - passingGoalCount = projectInferencePipelineCreateResponse.passingGoalCount - projectId = projectInferencePipelineCreateResponse.projectId - status = projectInferencePipelineCreateResponse.status - statusMessage = projectInferencePipelineCreateResponse.statusMessage - totalGoalCount = projectInferencePipelineCreateResponse.totalGoalCount - project = projectInferencePipelineCreateResponse.project - workspace = projectInferencePipelineCreateResponse.workspace - workspaceId = projectInferencePipelineCreateResponse.workspaceId - additionalProperties = - projectInferencePipelineCreateResponse.additionalProperties.toMutableMap() - } + internal fun from(inferencePipelineCreateResponse: InferencePipelineCreateResponse) = + apply { + id = inferencePipelineCreateResponse.id + dateCreated = inferencePipelineCreateResponse.dateCreated + dateLastEvaluated = inferencePipelineCreateResponse.dateLastEvaluated + dateLastSampleReceived = inferencePipelineCreateResponse.dateLastSampleReceived + dateOfNextEvaluation = inferencePipelineCreateResponse.dateOfNextEvaluation + dateUpdated = inferencePipelineCreateResponse.dateUpdated + description = inferencePipelineCreateResponse.description + failingGoalCount = inferencePipelineCreateResponse.failingGoalCount + links = inferencePipelineCreateResponse.links + name = inferencePipelineCreateResponse.name + passingGoalCount = inferencePipelineCreateResponse.passingGoalCount + projectId = inferencePipelineCreateResponse.projectId + status = inferencePipelineCreateResponse.status + statusMessage = inferencePipelineCreateResponse.statusMessage + totalGoalCount = inferencePipelineCreateResponse.totalGoalCount + project = inferencePipelineCreateResponse.project + workspace = inferencePipelineCreateResponse.workspace + workspaceId = inferencePipelineCreateResponse.workspaceId + additionalProperties = + inferencePipelineCreateResponse.additionalProperties.toMutableMap() + } /** The inference pipeline id. */ fun id(id: String) = id(JsonField.of(id)) @@ -483,8 +482,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): ProjectInferencePipelineCreateResponse = - ProjectInferencePipelineCreateResponse( + fun build(): InferencePipelineCreateResponse = + InferencePipelineCreateResponse( checkRequired("id", id), checkRequired("dateCreated", dateCreated), checkRequired("dateLastEvaluated", dateLastEvaluated), @@ -2574,7 +2573,7 @@ private constructor( return true } - return /* spotless:off */ other is ProjectInferencePipelineCreateResponse && id == other.id && dateCreated == other.dateCreated && dateLastEvaluated == other.dateLastEvaluated && dateLastSampleReceived == other.dateLastSampleReceived && dateOfNextEvaluation == other.dateOfNextEvaluation && dateUpdated == other.dateUpdated && description == other.description && failingGoalCount == other.failingGoalCount && links == other.links && name == other.name && passingGoalCount == other.passingGoalCount && projectId == other.projectId && status == other.status && statusMessage == other.statusMessage && totalGoalCount == other.totalGoalCount && project == other.project && workspace == other.workspace && workspaceId == other.workspaceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is InferencePipelineCreateResponse && id == other.id && dateCreated == other.dateCreated && dateLastEvaluated == other.dateLastEvaluated && dateLastSampleReceived == other.dateLastSampleReceived && dateOfNextEvaluation == other.dateOfNextEvaluation && dateUpdated == other.dateUpdated && description == other.description && failingGoalCount == other.failingGoalCount && links == other.links && name == other.name && passingGoalCount == other.passingGoalCount && projectId == other.projectId && status == other.status && statusMessage == other.statusMessage && totalGoalCount == other.totalGoalCount && project == other.project && workspace == other.workspace && workspaceId == other.workspaceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -2584,5 +2583,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ProjectInferencePipelineCreateResponse{id=$id, dateCreated=$dateCreated, dateLastEvaluated=$dateLastEvaluated, dateLastSampleReceived=$dateLastSampleReceived, dateOfNextEvaluation=$dateOfNextEvaluation, dateUpdated=$dateUpdated, description=$description, failingGoalCount=$failingGoalCount, links=$links, name=$name, passingGoalCount=$passingGoalCount, projectId=$projectId, status=$status, statusMessage=$statusMessage, totalGoalCount=$totalGoalCount, project=$project, workspace=$workspace, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" + "InferencePipelineCreateResponse{id=$id, dateCreated=$dateCreated, dateLastEvaluated=$dateLastEvaluated, dateLastSampleReceived=$dateLastSampleReceived, dateOfNextEvaluation=$dateOfNextEvaluation, dateUpdated=$dateUpdated, description=$description, failingGoalCount=$failingGoalCount, links=$links, name=$name, passingGoalCount=$passingGoalCount, projectId=$projectId, status=$status, statusMessage=$statusMessage, totalGoalCount=$totalGoalCount, project=$project, workspace=$workspace, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt similarity index 84% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt index 83b35ad8..2401d780 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects.inferencepipelines import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params @@ -12,7 +12,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** List the inference pipelines in a project. */ -class ProjectInferencePipelineListParams +class InferencePipelineListParams private constructor( private val projectId: String, private val name: String?, @@ -60,8 +60,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [ProjectInferencePipelineListParams]. + * Returns a mutable builder for constructing an instance of [InferencePipelineListParams]. * * The following fields are required: * ```java @@ -71,7 +70,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ProjectInferencePipelineListParams]. */ + /** A builder for [InferencePipelineListParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -83,16 +82,14 @@ private constructor( private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic - internal fun from(projectInferencePipelineListParams: ProjectInferencePipelineListParams) = - apply { - projectId = projectInferencePipelineListParams.projectId - name = projectInferencePipelineListParams.name - page = projectInferencePipelineListParams.page - perPage = projectInferencePipelineListParams.perPage - additionalHeaders = projectInferencePipelineListParams.additionalHeaders.toBuilder() - additionalQueryParams = - projectInferencePipelineListParams.additionalQueryParams.toBuilder() - } + internal fun from(inferencePipelineListParams: InferencePipelineListParams) = apply { + projectId = inferencePipelineListParams.projectId + name = inferencePipelineListParams.name + page = inferencePipelineListParams.page + perPage = inferencePipelineListParams.perPage + additionalHeaders = inferencePipelineListParams.additionalHeaders.toBuilder() + additionalQueryParams = inferencePipelineListParams.additionalQueryParams.toBuilder() + } fun projectId(projectId: String) = apply { this.projectId = projectId } @@ -218,8 +215,8 @@ private constructor( additionalQueryParams.removeAll(keys) } - fun build(): ProjectInferencePipelineListParams = - ProjectInferencePipelineListParams( + fun build(): InferencePipelineListParams = + InferencePipelineListParams( checkRequired("projectId", projectId), name, page, @@ -234,11 +231,11 @@ private constructor( return true } - return /* spotless:off */ other is ProjectInferencePipelineListParams && projectId == other.projectId && name == other.name && page == other.page && perPage == other.perPage && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + return /* spotless:off */ other is InferencePipelineListParams && projectId == other.projectId && name == other.name && page == other.page && perPage == other.perPage && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int = /* spotless:off */ Objects.hash(projectId, name, page, perPage, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "ProjectInferencePipelineListParams{projectId=$projectId, name=$name, page=$page, perPage=$perPage, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "InferencePipelineListParams{projectId=$projectId, name=$name, page=$page, perPage=$perPage, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt similarity index 99% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt index b3eec966..bfc0b0d8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects.inferencepipelines import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -24,7 +24,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull @NoAutoDetect -class ProjectInferencePipelineListResponse +class InferencePipelineListResponse @JsonCreator private constructor( @JsonProperty("items") @@ -43,7 +43,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ProjectInferencePipelineListResponse = apply { + fun validate(): InferencePipelineListResponse = apply { if (validated) { return@apply } @@ -58,7 +58,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [ProjectInferencePipelineListResponse]. + * [InferencePipelineListResponse]. * * The following fields are required: * ```java @@ -68,19 +68,16 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ProjectInferencePipelineListResponse]. */ + /** A builder for [InferencePipelineListResponse]. */ class Builder internal constructor() { private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - projectInferencePipelineListResponse: ProjectInferencePipelineListResponse - ) = apply { - items = projectInferencePipelineListResponse.items.map { it.toMutableList() } - additionalProperties = - projectInferencePipelineListResponse.additionalProperties.toMutableMap() + internal fun from(inferencePipelineListResponse: InferencePipelineListResponse) = apply { + items = inferencePipelineListResponse.items.map { it.toMutableList() } + additionalProperties = inferencePipelineListResponse.additionalProperties.toMutableMap() } fun items(items: List) = items(JsonField.of(items)) @@ -113,8 +110,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): ProjectInferencePipelineListResponse = - ProjectInferencePipelineListResponse( + fun build(): InferencePipelineListResponse = + InferencePipelineListResponse( checkRequired("items", items).map { it.toImmutable() }, additionalProperties.toImmutable(), ) @@ -2753,7 +2750,7 @@ private constructor( return true } - return /* spotless:off */ other is ProjectInferencePipelineListResponse && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is InferencePipelineListResponse && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -2763,5 +2760,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ProjectInferencePipelineListResponse{items=$items, additionalProperties=$additionalProperties}" + "InferencePipelineListResponse{items=$items, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt similarity index 84% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt index 30267079..57edf541 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.storage.presignedurl import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect @@ -13,7 +13,7 @@ import java.util.Objects import java.util.Optional /** Retrieve a presigned url to post storage artifacts. */ -class StoragePresignedUrlCreateParams +class PresignedUrlCreateParams private constructor( private val objectName: String, private val additionalHeaders: Headers, @@ -48,8 +48,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [StoragePresignedUrlCreateParams]. + * Returns a mutable builder for constructing an instance of [PresignedUrlCreateParams]. * * The following fields are required: * ```java @@ -59,7 +58,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [StoragePresignedUrlCreateParams]. */ + /** A builder for [PresignedUrlCreateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -69,15 +68,13 @@ private constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(storagePresignedUrlCreateParams: StoragePresignedUrlCreateParams) = - apply { - objectName = storagePresignedUrlCreateParams.objectName - additionalHeaders = storagePresignedUrlCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = - storagePresignedUrlCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - storagePresignedUrlCreateParams.additionalBodyProperties.toMutableMap() - } + internal fun from(presignedUrlCreateParams: PresignedUrlCreateParams) = apply { + objectName = presignedUrlCreateParams.objectName + additionalHeaders = presignedUrlCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = presignedUrlCreateParams.additionalQueryParams.toBuilder() + additionalBodyProperties = + presignedUrlCreateParams.additionalBodyProperties.toMutableMap() + } /** The name of the object. */ fun objectName(objectName: String) = apply { this.objectName = objectName } @@ -202,8 +199,8 @@ private constructor( keys.forEach(::removeAdditionalBodyProperty) } - fun build(): StoragePresignedUrlCreateParams = - StoragePresignedUrlCreateParams( + fun build(): PresignedUrlCreateParams = + PresignedUrlCreateParams( checkRequired("objectName", objectName), additionalHeaders.build(), additionalQueryParams.build(), @@ -216,11 +213,11 @@ private constructor( return true } - return /* spotless:off */ other is StoragePresignedUrlCreateParams && objectName == other.objectName && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is PresignedUrlCreateParams && objectName == other.objectName && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int = /* spotless:off */ Objects.hash(objectName, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ override fun toString() = - "StoragePresignedUrlCreateParams{objectName=$objectName, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "PresignedUrlCreateParams{objectName=$objectName, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt similarity index 79% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt index 1f4a027c..76a1a3b5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.storage.presignedurl import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -17,7 +17,7 @@ import com.openlayer.api.core.toImmutable import java.util.Objects @NoAutoDetect -class StoragePresignedUrlCreateResponse +class PresignedUrlCreateResponse @JsonCreator private constructor( @JsonProperty("storageUri") @@ -49,7 +49,7 @@ private constructor( private var validated: Boolean = false - fun validate(): StoragePresignedUrlCreateResponse = apply { + fun validate(): PresignedUrlCreateResponse = apply { if (validated) { return@apply } @@ -64,8 +64,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [StoragePresignedUrlCreateResponse]. + * Returns a mutable builder for constructing an instance of [PresignedUrlCreateResponse]. * * The following fields are required: * ```java @@ -76,7 +75,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [StoragePresignedUrlCreateResponse]. */ + /** A builder for [PresignedUrlCreateResponse]. */ class Builder internal constructor() { private var storageUri: JsonField? = null @@ -85,14 +84,12 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(storagePresignedUrlCreateResponse: StoragePresignedUrlCreateResponse) = - apply { - storageUri = storagePresignedUrlCreateResponse.storageUri - url = storagePresignedUrlCreateResponse.url - fields = storagePresignedUrlCreateResponse.fields - additionalProperties = - storagePresignedUrlCreateResponse.additionalProperties.toMutableMap() - } + internal fun from(presignedUrlCreateResponse: PresignedUrlCreateResponse) = apply { + storageUri = presignedUrlCreateResponse.storageUri + url = presignedUrlCreateResponse.url + fields = presignedUrlCreateResponse.fields + additionalProperties = presignedUrlCreateResponse.additionalProperties.toMutableMap() + } /** The storage URI to send back to the backend after the upload was completed. */ fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) @@ -128,8 +125,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): StoragePresignedUrlCreateResponse = - StoragePresignedUrlCreateResponse( + fun build(): PresignedUrlCreateResponse = + PresignedUrlCreateResponse( checkRequired("storageUri", storageUri), checkRequired("url", url), fields, @@ -142,7 +139,7 @@ private constructor( return true } - return /* spotless:off */ other is StoragePresignedUrlCreateResponse && storageUri == other.storageUri && url == other.url && fields == other.fields && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PresignedUrlCreateResponse && storageUri == other.storageUri && url == other.url && fields == other.fields && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -152,5 +149,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "StoragePresignedUrlCreateResponse{storageUri=$storageUri, url=$url, fields=$fields, additionalProperties=$additionalProperties}" + "PresignedUrlCreateResponse{storageUri=$storageUri, url=$url, fields=$fields, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt index f195887a..e60e7d2f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt @@ -5,8 +5,8 @@ package com.openlayer.api.services.async import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.CommitRetrieveParams -import com.openlayer.api.models.CommitRetrieveResponse +import com.openlayer.api.models.commits.CommitRetrieveParams +import com.openlayer.api.models.commits.CommitRetrieveResponse import com.openlayer.api.services.async.commits.TestResultServiceAsync import java.util.concurrent.CompletableFuture diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt index 9af60bfb..0322f214 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt @@ -14,8 +14,8 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.CommitRetrieveParams -import com.openlayer.api.models.CommitRetrieveResponse +import com.openlayer.api.models.commits.CommitRetrieveParams +import com.openlayer.api.models.commits.CommitRetrieveResponse import com.openlayer.api.services.async.commits.TestResultServiceAsync import com.openlayer.api.services.async.commits.TestResultServiceAsyncImpl import java.util.concurrent.CompletableFuture diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt index 3beedfa9..8b8bbd4e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt @@ -6,14 +6,14 @@ import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponse import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.InferencePipelineDeleteParams -import com.openlayer.api.models.InferencePipelineRetrieveParams -import com.openlayer.api.models.InferencePipelineRetrieveResponse -import com.openlayer.api.models.InferencePipelineUpdateParams -import com.openlayer.api.models.InferencePipelineUpdateResponse -import com.openlayer.api.services.async.inferencePipelines.DataServiceAsync -import com.openlayer.api.services.async.inferencePipelines.RowServiceAsync -import com.openlayer.api.services.async.inferencePipelines.TestResultServiceAsync +import com.openlayer.api.models.inferencepipelines.InferencePipelineDeleteParams +import com.openlayer.api.models.inferencepipelines.InferencePipelineRetrieveParams +import com.openlayer.api.models.inferencepipelines.InferencePipelineRetrieveResponse +import com.openlayer.api.models.inferencepipelines.InferencePipelineUpdateParams +import com.openlayer.api.models.inferencepipelines.InferencePipelineUpdateResponse +import com.openlayer.api.services.async.inferencepipelines.DataServiceAsync +import com.openlayer.api.services.async.inferencepipelines.RowServiceAsync +import com.openlayer.api.services.async.inferencepipelines.TestResultServiceAsync import java.util.concurrent.CompletableFuture interface InferencePipelineServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt index 1bffa027..90667d64 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt @@ -17,17 +17,17 @@ import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineDeleteParams -import com.openlayer.api.models.InferencePipelineRetrieveParams -import com.openlayer.api.models.InferencePipelineRetrieveResponse -import com.openlayer.api.models.InferencePipelineUpdateParams -import com.openlayer.api.models.InferencePipelineUpdateResponse -import com.openlayer.api.services.async.inferencePipelines.DataServiceAsync -import com.openlayer.api.services.async.inferencePipelines.DataServiceAsyncImpl -import com.openlayer.api.services.async.inferencePipelines.RowServiceAsync -import com.openlayer.api.services.async.inferencePipelines.RowServiceAsyncImpl -import com.openlayer.api.services.async.inferencePipelines.TestResultServiceAsync -import com.openlayer.api.services.async.inferencePipelines.TestResultServiceAsyncImpl +import com.openlayer.api.models.inferencepipelines.InferencePipelineDeleteParams +import com.openlayer.api.models.inferencepipelines.InferencePipelineRetrieveParams +import com.openlayer.api.models.inferencepipelines.InferencePipelineRetrieveResponse +import com.openlayer.api.models.inferencepipelines.InferencePipelineUpdateParams +import com.openlayer.api.models.inferencepipelines.InferencePipelineUpdateResponse +import com.openlayer.api.services.async.inferencepipelines.DataServiceAsync +import com.openlayer.api.services.async.inferencepipelines.DataServiceAsyncImpl +import com.openlayer.api.services.async.inferencepipelines.RowServiceAsync +import com.openlayer.api.services.async.inferencepipelines.RowServiceAsyncImpl +import com.openlayer.api.services.async.inferencepipelines.TestResultServiceAsync +import com.openlayer.api.services.async.inferencepipelines.TestResultServiceAsyncImpl import java.util.concurrent.CompletableFuture class InferencePipelineServiceAsyncImpl diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt index 5cd45434..8c47db0d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt @@ -5,10 +5,10 @@ package com.openlayer.api.services.async import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.ProjectCreateParams -import com.openlayer.api.models.ProjectCreateResponse -import com.openlayer.api.models.ProjectListParams -import com.openlayer.api.models.ProjectListResponse +import com.openlayer.api.models.projects.ProjectCreateParams +import com.openlayer.api.models.projects.ProjectCreateResponse +import com.openlayer.api.models.projects.ProjectListParams +import com.openlayer.api.models.projects.ProjectListResponse import com.openlayer.api.services.async.projects.CommitServiceAsync import com.openlayer.api.services.async.projects.InferencePipelineServiceAsync import java.util.concurrent.CompletableFuture diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt index 7f9ce474..14f66c6c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt @@ -15,10 +15,10 @@ import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.ProjectCreateParams -import com.openlayer.api.models.ProjectCreateResponse -import com.openlayer.api.models.ProjectListParams -import com.openlayer.api.models.ProjectListResponse +import com.openlayer.api.models.projects.ProjectCreateParams +import com.openlayer.api.models.projects.ProjectCreateResponse +import com.openlayer.api.models.projects.ProjectListParams +import com.openlayer.api.models.projects.ProjectListResponse import com.openlayer.api.services.async.projects.CommitServiceAsync import com.openlayer.api.services.async.projects.CommitServiceAsyncImpl import com.openlayer.api.services.async.projects.InferencePipelineServiceAsync diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt index 0e79fe81..40c54d7b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt @@ -5,8 +5,8 @@ package com.openlayer.api.services.async.commits import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.CommitTestResultListParams -import com.openlayer.api.models.CommitTestResultListResponse +import com.openlayer.api.models.commits.testresults.TestResultListParams +import com.openlayer.api.models.commits.testresults.TestResultListResponse import java.util.concurrent.CompletableFuture interface TestResultServiceAsync { @@ -17,14 +17,14 @@ interface TestResultServiceAsync { fun withRawResponse(): WithRawResponse /** List the test results for a project commit (project version). */ - fun list(params: CommitTestResultListParams): CompletableFuture = + fun list(params: TestResultListParams): CompletableFuture = list(params, RequestOptions.none()) /** @see [list] */ fun list( - params: CommitTestResultListParams, + params: TestResultListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** * A view of [TestResultServiceAsync] that provides access to raw HTTP responses for each @@ -38,15 +38,15 @@ interface TestResultServiceAsync { */ @MustBeClosed fun list( - params: CommitTestResultListParams - ): CompletableFuture> = + params: TestResultListParams + ): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ @MustBeClosed fun list( - params: CommitTestResultListParams, + params: TestResultListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt index c029761c..836081ee 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt @@ -14,8 +14,8 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.CommitTestResultListParams -import com.openlayer.api.models.CommitTestResultListResponse +import com.openlayer.api.models.commits.testresults.TestResultListParams +import com.openlayer.api.models.commits.testresults.TestResultListResponse import java.util.concurrent.CompletableFuture class TestResultServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -28,9 +28,9 @@ class TestResultServiceAsyncImpl internal constructor(private val clientOptions: override fun withRawResponse(): TestResultServiceAsync.WithRawResponse = withRawResponse override fun list( - params: CommitTestResultListParams, + params: TestResultListParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // get /versions/{projectVersionId}/results withRawResponse().list(params, requestOptions).thenApply { it.parse() } @@ -39,14 +39,14 @@ class TestResultServiceAsyncImpl internal constructor(private val clientOptions: private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) override fun list( - params: CommitTestResultListParams, + params: TestResultListParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsync.kt similarity index 63% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsync.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsync.kt index 1793b25d..6e1b9d85 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsync.kt @@ -1,12 +1,12 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.services.async.inferencePipelines +package com.openlayer.api.services.async.inferencepipelines import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.InferencePipelineDataStreamParams -import com.openlayer.api.models.InferencePipelineDataStreamResponse +import com.openlayer.api.models.inferencepipelines.data.DataStreamParams +import com.openlayer.api.models.inferencepipelines.data.DataStreamResponse import java.util.concurrent.CompletableFuture interface DataServiceAsync { @@ -17,16 +17,14 @@ interface DataServiceAsync { fun withRawResponse(): WithRawResponse /** Publish an inference data point to an inference pipeline. */ - fun stream( - params: InferencePipelineDataStreamParams - ): CompletableFuture = + fun stream(params: DataStreamParams): CompletableFuture = stream(params, RequestOptions.none()) /** @see [stream] */ fun stream( - params: InferencePipelineDataStreamParams, + params: DataStreamParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** A view of [DataServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -38,15 +36,15 @@ interface DataServiceAsync { */ @MustBeClosed fun stream( - params: InferencePipelineDataStreamParams - ): CompletableFuture> = + params: DataStreamParams + ): CompletableFuture> = stream(params, RequestOptions.none()) /** @see [stream] */ @MustBeClosed fun stream( - params: InferencePipelineDataStreamParams, + params: DataStreamParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsyncImpl.kt similarity index 79% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsyncImpl.kt index 84782001..50bb6d73 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsyncImpl.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.services.async.inferencePipelines +package com.openlayer.api.services.async.inferencepipelines import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions @@ -15,8 +15,8 @@ import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineDataStreamParams -import com.openlayer.api.models.InferencePipelineDataStreamResponse +import com.openlayer.api.models.inferencepipelines.data.DataStreamParams +import com.openlayer.api.models.inferencepipelines.data.DataStreamResponse import java.util.concurrent.CompletableFuture class DataServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -29,9 +29,9 @@ class DataServiceAsyncImpl internal constructor(private val clientOptions: Clien override fun withRawResponse(): DataServiceAsync.WithRawResponse = withRawResponse override fun stream( - params: InferencePipelineDataStreamParams, + params: DataStreamParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // post /inference-pipelines/{inferencePipelineId}/data-stream withRawResponse().stream(params, requestOptions).thenApply { it.parse() } @@ -40,14 +40,13 @@ class DataServiceAsyncImpl internal constructor(private val clientOptions: Clien private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val streamHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + private val streamHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) override fun stream( - params: InferencePipelineDataStreamParams, + params: DataStreamParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { val request = HttpRequest.builder() .method(HttpMethod.POST) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsync.kt similarity index 60% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsync.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsync.kt index d92a5677..80de582d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsync.kt @@ -1,12 +1,12 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.services.async.inferencePipelines +package com.openlayer.api.services.async.inferencepipelines import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.InferencePipelineRowUpdateParams -import com.openlayer.api.models.InferencePipelineRowUpdateResponse +import com.openlayer.api.models.inferencepipelines.rows.RowUpdateParams +import com.openlayer.api.models.inferencepipelines.rows.RowUpdateResponse import java.util.concurrent.CompletableFuture interface RowServiceAsync { @@ -17,15 +17,14 @@ interface RowServiceAsync { fun withRawResponse(): WithRawResponse /** Update an inference data point in an inference pipeline. */ - fun update( - params: InferencePipelineRowUpdateParams - ): CompletableFuture = update(params, RequestOptions.none()) + fun update(params: RowUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) /** @see [update] */ fun update( - params: InferencePipelineRowUpdateParams, + params: RowUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** A view of [RowServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -35,16 +34,14 @@ interface RowServiceAsync { * but is otherwise the same as [RowServiceAsync.update]. */ @MustBeClosed - fun update( - params: InferencePipelineRowUpdateParams - ): CompletableFuture> = + fun update(params: RowUpdateParams): CompletableFuture> = update(params, RequestOptions.none()) /** @see [update] */ @MustBeClosed fun update( - params: InferencePipelineRowUpdateParams, + params: RowUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsyncImpl.kt similarity index 79% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsyncImpl.kt index 041c1fd1..96d8c857 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsyncImpl.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.services.async.inferencePipelines +package com.openlayer.api.services.async.inferencepipelines import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions @@ -15,8 +15,8 @@ import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineRowUpdateParams -import com.openlayer.api.models.InferencePipelineRowUpdateResponse +import com.openlayer.api.models.inferencepipelines.rows.RowUpdateParams +import com.openlayer.api.models.inferencepipelines.rows.RowUpdateResponse import java.util.concurrent.CompletableFuture class RowServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -29,9 +29,9 @@ class RowServiceAsyncImpl internal constructor(private val clientOptions: Client override fun withRawResponse(): RowServiceAsync.WithRawResponse = withRawResponse override fun update( - params: InferencePipelineRowUpdateParams, + params: RowUpdateParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // put /inference-pipelines/{inferencePipelineId}/rows withRawResponse().update(params, requestOptions).thenApply { it.parse() } @@ -40,14 +40,13 @@ class RowServiceAsyncImpl internal constructor(private val clientOptions: Client private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) override fun update( - params: InferencePipelineRowUpdateParams, + params: RowUpdateParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { val request = HttpRequest.builder() .method(HttpMethod.PUT) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsync.kt similarity index 62% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsync.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsync.kt index 96e82ac6..dcb258fc 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsync.kt @@ -1,12 +1,12 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.services.async.inferencePipelines +package com.openlayer.api.services.async.inferencepipelines import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.InferencePipelineTestResultListParams -import com.openlayer.api.models.InferencePipelineTestResultListResponse +import com.openlayer.api.models.inferencepipelines.testresults.TestResultListParams +import com.openlayer.api.models.inferencepipelines.testresults.TestResultListResponse import java.util.concurrent.CompletableFuture interface TestResultServiceAsync { @@ -17,16 +17,14 @@ interface TestResultServiceAsync { fun withRawResponse(): WithRawResponse /** List the latest test results for an inference pipeline. */ - fun list( - params: InferencePipelineTestResultListParams - ): CompletableFuture = + fun list(params: TestResultListParams): CompletableFuture = list(params, RequestOptions.none()) /** @see [list] */ fun list( - params: InferencePipelineTestResultListParams, + params: TestResultListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** * A view of [TestResultServiceAsync] that provides access to raw HTTP responses for each @@ -40,15 +38,15 @@ interface TestResultServiceAsync { */ @MustBeClosed fun list( - params: InferencePipelineTestResultListParams - ): CompletableFuture> = + params: TestResultListParams + ): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ @MustBeClosed fun list( - params: InferencePipelineTestResultListParams, + params: TestResultListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncImpl.kt similarity index 79% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncImpl.kt index 31b28206..bfb0cc2f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncImpl.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.services.async.inferencePipelines +package com.openlayer.api.services.async.inferencepipelines import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions @@ -14,8 +14,8 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineTestResultListParams -import com.openlayer.api.models.InferencePipelineTestResultListResponse +import com.openlayer.api.models.inferencepipelines.testresults.TestResultListParams +import com.openlayer.api.models.inferencepipelines.testresults.TestResultListResponse import java.util.concurrent.CompletableFuture class TestResultServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -28,9 +28,9 @@ class TestResultServiceAsyncImpl internal constructor(private val clientOptions: override fun withRawResponse(): TestResultServiceAsync.WithRawResponse = withRawResponse override fun list( - params: InferencePipelineTestResultListParams, + params: TestResultListParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // get /inference-pipelines/{inferencePipelineId}/results withRawResponse().list(params, requestOptions).thenApply { it.parse() } @@ -39,14 +39,14 @@ class TestResultServiceAsyncImpl internal constructor(private val clientOptions: private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) override fun list( - params: InferencePipelineTestResultListParams, + params: TestResultListParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt index da2e4989..93c8603b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt @@ -5,10 +5,10 @@ package com.openlayer.api.services.async.projects import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.ProjectCommitCreateParams -import com.openlayer.api.models.ProjectCommitCreateResponse -import com.openlayer.api.models.ProjectCommitListParams -import com.openlayer.api.models.ProjectCommitListResponse +import com.openlayer.api.models.projects.commits.CommitCreateParams +import com.openlayer.api.models.projects.commits.CommitCreateResponse +import com.openlayer.api.models.projects.commits.CommitListParams +import com.openlayer.api.models.projects.commits.CommitListResponse import java.util.concurrent.CompletableFuture interface CommitServiceAsync { @@ -19,24 +19,24 @@ interface CommitServiceAsync { fun withRawResponse(): WithRawResponse /** Create a new commit (project version) in a project. */ - fun create(params: ProjectCommitCreateParams): CompletableFuture = + fun create(params: CommitCreateParams): CompletableFuture = create(params, RequestOptions.none()) /** @see [create] */ fun create( - params: ProjectCommitCreateParams, + params: CommitCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** List the commits (project versions) in a project. */ - fun list(params: ProjectCommitListParams): CompletableFuture = + fun list(params: CommitListParams): CompletableFuture = list(params, RequestOptions.none()) /** @see [list] */ fun list( - params: ProjectCommitListParams, + params: CommitListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** * A view of [CommitServiceAsync] that provides access to raw HTTP responses for each method. @@ -49,32 +49,30 @@ interface CommitServiceAsync { */ @MustBeClosed fun create( - params: ProjectCommitCreateParams - ): CompletableFuture> = + params: CommitCreateParams + ): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ @MustBeClosed fun create( - params: ProjectCommitCreateParams, + params: CommitCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** * Returns a raw HTTP response for `get /projects/{projectId}/versions`, but is otherwise * the same as [CommitServiceAsync.list]. */ @MustBeClosed - fun list( - params: ProjectCommitListParams - ): CompletableFuture> = + fun list(params: CommitListParams): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ @MustBeClosed fun list( - params: ProjectCommitListParams, + params: CommitListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt index c4159be7..0f231527 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt @@ -15,10 +15,10 @@ import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.ProjectCommitCreateParams -import com.openlayer.api.models.ProjectCommitCreateResponse -import com.openlayer.api.models.ProjectCommitListParams -import com.openlayer.api.models.ProjectCommitListResponse +import com.openlayer.api.models.projects.commits.CommitCreateParams +import com.openlayer.api.models.projects.commits.CommitCreateResponse +import com.openlayer.api.models.projects.commits.CommitListParams +import com.openlayer.api.models.projects.commits.CommitListResponse import java.util.concurrent.CompletableFuture class CommitServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -31,16 +31,16 @@ class CommitServiceAsyncImpl internal constructor(private val clientOptions: Cli override fun withRawResponse(): CommitServiceAsync.WithRawResponse = withRawResponse override fun create( - params: ProjectCommitCreateParams, + params: CommitCreateParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // post /projects/{projectId}/versions withRawResponse().create(params, requestOptions).thenApply { it.parse() } override fun list( - params: ProjectCommitListParams, + params: CommitListParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // get /projects/{projectId}/versions withRawResponse().list(params, requestOptions).thenApply { it.parse() } @@ -49,14 +49,14 @@ class CommitServiceAsyncImpl internal constructor(private val clientOptions: Cli private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) override fun create( - params: ProjectCommitCreateParams, + params: CommitCreateParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -80,14 +80,13 @@ class CommitServiceAsyncImpl internal constructor(private val clientOptions: Cli } } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) override fun list( - params: ProjectCommitListParams, + params: CommitListParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsync.kt index 403015e1..b219a00c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsync.kt @@ -5,10 +5,10 @@ package com.openlayer.api.services.async.projects import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.ProjectInferencePipelineCreateParams -import com.openlayer.api.models.ProjectInferencePipelineCreateResponse -import com.openlayer.api.models.ProjectInferencePipelineListParams -import com.openlayer.api.models.ProjectInferencePipelineListResponse +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineCreateParams +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineCreateResponse +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineListParams +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineListResponse import java.util.concurrent.CompletableFuture interface InferencePipelineServiceAsync { @@ -20,26 +20,25 @@ interface InferencePipelineServiceAsync { /** Create an inference pipeline in a project. */ fun create( - params: ProjectInferencePipelineCreateParams - ): CompletableFuture = - create(params, RequestOptions.none()) + params: InferencePipelineCreateParams + ): CompletableFuture = create(params, RequestOptions.none()) /** @see [create] */ fun create( - params: ProjectInferencePipelineCreateParams, + params: InferencePipelineCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** List the inference pipelines in a project. */ fun list( - params: ProjectInferencePipelineListParams - ): CompletableFuture = list(params, RequestOptions.none()) + params: InferencePipelineListParams + ): CompletableFuture = list(params, RequestOptions.none()) /** @see [list] */ fun list( - params: ProjectInferencePipelineListParams, + params: InferencePipelineListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** * A view of [InferencePipelineServiceAsync] that provides access to raw HTTP responses for each @@ -53,16 +52,16 @@ interface InferencePipelineServiceAsync { */ @MustBeClosed fun create( - params: ProjectInferencePipelineCreateParams - ): CompletableFuture> = + params: InferencePipelineCreateParams + ): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ @MustBeClosed fun create( - params: ProjectInferencePipelineCreateParams, + params: InferencePipelineCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** * Returns a raw HTTP response for `get /projects/{projectId}/inference-pipelines`, but is @@ -70,15 +69,15 @@ interface InferencePipelineServiceAsync { */ @MustBeClosed fun list( - params: ProjectInferencePipelineListParams - ): CompletableFuture> = + params: InferencePipelineListParams + ): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ @MustBeClosed fun list( - params: ProjectInferencePipelineListParams, + params: InferencePipelineListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt index 58a76cdc..e2f137ae 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt @@ -15,10 +15,10 @@ import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.ProjectInferencePipelineCreateParams -import com.openlayer.api.models.ProjectInferencePipelineCreateResponse -import com.openlayer.api.models.ProjectInferencePipelineListParams -import com.openlayer.api.models.ProjectInferencePipelineListResponse +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineCreateParams +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineCreateResponse +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineListParams +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineListResponse import java.util.concurrent.CompletableFuture class InferencePipelineServiceAsyncImpl @@ -31,16 +31,16 @@ internal constructor(private val clientOptions: ClientOptions) : InferencePipeli override fun withRawResponse(): InferencePipelineServiceAsync.WithRawResponse = withRawResponse override fun create( - params: ProjectInferencePipelineCreateParams, + params: InferencePipelineCreateParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // post /projects/{projectId}/inference-pipelines withRawResponse().create(params, requestOptions).thenApply { it.parse() } override fun list( - params: ProjectInferencePipelineListParams, + params: InferencePipelineListParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // get /projects/{projectId}/inference-pipelines withRawResponse().list(params, requestOptions).thenApply { it.parse() } @@ -49,14 +49,14 @@ internal constructor(private val clientOptions: ClientOptions) : InferencePipeli private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) override fun create( - params: ProjectInferencePipelineCreateParams, + params: InferencePipelineCreateParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -80,14 +80,14 @@ internal constructor(private val clientOptions: ClientOptions) : InferencePipeli } } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) override fun list( - params: ProjectInferencePipelineListParams, + params: InferencePipelineListParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt index 85cc8c5a..d662d529 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt @@ -5,8 +5,8 @@ package com.openlayer.api.services.async.storage import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.StoragePresignedUrlCreateParams -import com.openlayer.api.models.StoragePresignedUrlCreateResponse +import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateParams +import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateResponse import java.util.concurrent.CompletableFuture interface PresignedUrlServiceAsync { @@ -17,15 +17,14 @@ interface PresignedUrlServiceAsync { fun withRawResponse(): WithRawResponse /** Retrieve a presigned url to post storage artifacts. */ - fun create( - params: StoragePresignedUrlCreateParams - ): CompletableFuture = create(params, RequestOptions.none()) + fun create(params: PresignedUrlCreateParams): CompletableFuture = + create(params, RequestOptions.none()) /** @see [create] */ fun create( - params: StoragePresignedUrlCreateParams, + params: PresignedUrlCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** * A view of [PresignedUrlServiceAsync] that provides access to raw HTTP responses for each @@ -39,15 +38,15 @@ interface PresignedUrlServiceAsync { */ @MustBeClosed fun create( - params: StoragePresignedUrlCreateParams - ): CompletableFuture> = + params: PresignedUrlCreateParams + ): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ @MustBeClosed fun create( - params: StoragePresignedUrlCreateParams, + params: PresignedUrlCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt index 339c1ea8..2a0390f5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt @@ -15,8 +15,8 @@ import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.StoragePresignedUrlCreateParams -import com.openlayer.api.models.StoragePresignedUrlCreateResponse +import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateParams +import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateResponse import java.util.concurrent.CompletableFuture class PresignedUrlServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -29,9 +29,9 @@ class PresignedUrlServiceAsyncImpl internal constructor(private val clientOption override fun withRawResponse(): PresignedUrlServiceAsync.WithRawResponse = withRawResponse override fun create( - params: StoragePresignedUrlCreateParams, + params: PresignedUrlCreateParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // post /storage/presigned-url withRawResponse().create(params, requestOptions).thenApply { it.parse() } @@ -40,14 +40,14 @@ class PresignedUrlServiceAsyncImpl internal constructor(private val clientOption private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) override fun create( - params: StoragePresignedUrlCreateParams, + params: PresignedUrlCreateParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { val request = HttpRequest.builder() .method(HttpMethod.POST) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt index 3fcd3241..704d2114 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt @@ -5,8 +5,8 @@ package com.openlayer.api.services.blocking import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.CommitRetrieveParams -import com.openlayer.api.models.CommitRetrieveResponse +import com.openlayer.api.models.commits.CommitRetrieveParams +import com.openlayer.api.models.commits.CommitRetrieveResponse import com.openlayer.api.services.blocking.commits.TestResultService interface CommitService { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt index fefdf9dd..d9e25e1b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt @@ -14,8 +14,8 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.CommitRetrieveParams -import com.openlayer.api.models.CommitRetrieveResponse +import com.openlayer.api.models.commits.CommitRetrieveParams +import com.openlayer.api.models.commits.CommitRetrieveResponse import com.openlayer.api.services.blocking.commits.TestResultService import com.openlayer.api.services.blocking.commits.TestResultServiceImpl diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt index 413f7a6f..bf82c1f1 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt @@ -6,14 +6,14 @@ import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponse import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.InferencePipelineDeleteParams -import com.openlayer.api.models.InferencePipelineRetrieveParams -import com.openlayer.api.models.InferencePipelineRetrieveResponse -import com.openlayer.api.models.InferencePipelineUpdateParams -import com.openlayer.api.models.InferencePipelineUpdateResponse -import com.openlayer.api.services.blocking.inferencePipelines.DataService -import com.openlayer.api.services.blocking.inferencePipelines.RowService -import com.openlayer.api.services.blocking.inferencePipelines.TestResultService +import com.openlayer.api.models.inferencepipelines.InferencePipelineDeleteParams +import com.openlayer.api.models.inferencepipelines.InferencePipelineRetrieveParams +import com.openlayer.api.models.inferencepipelines.InferencePipelineRetrieveResponse +import com.openlayer.api.models.inferencepipelines.InferencePipelineUpdateParams +import com.openlayer.api.models.inferencepipelines.InferencePipelineUpdateResponse +import com.openlayer.api.services.blocking.inferencepipelines.DataService +import com.openlayer.api.services.blocking.inferencepipelines.RowService +import com.openlayer.api.services.blocking.inferencepipelines.TestResultService interface InferencePipelineService { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt index 70ad7670..6d85977a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt @@ -17,17 +17,17 @@ import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineDeleteParams -import com.openlayer.api.models.InferencePipelineRetrieveParams -import com.openlayer.api.models.InferencePipelineRetrieveResponse -import com.openlayer.api.models.InferencePipelineUpdateParams -import com.openlayer.api.models.InferencePipelineUpdateResponse -import com.openlayer.api.services.blocking.inferencePipelines.DataService -import com.openlayer.api.services.blocking.inferencePipelines.DataServiceImpl -import com.openlayer.api.services.blocking.inferencePipelines.RowService -import com.openlayer.api.services.blocking.inferencePipelines.RowServiceImpl -import com.openlayer.api.services.blocking.inferencePipelines.TestResultService -import com.openlayer.api.services.blocking.inferencePipelines.TestResultServiceImpl +import com.openlayer.api.models.inferencepipelines.InferencePipelineDeleteParams +import com.openlayer.api.models.inferencepipelines.InferencePipelineRetrieveParams +import com.openlayer.api.models.inferencepipelines.InferencePipelineRetrieveResponse +import com.openlayer.api.models.inferencepipelines.InferencePipelineUpdateParams +import com.openlayer.api.models.inferencepipelines.InferencePipelineUpdateResponse +import com.openlayer.api.services.blocking.inferencepipelines.DataService +import com.openlayer.api.services.blocking.inferencepipelines.DataServiceImpl +import com.openlayer.api.services.blocking.inferencepipelines.RowService +import com.openlayer.api.services.blocking.inferencepipelines.RowServiceImpl +import com.openlayer.api.services.blocking.inferencepipelines.TestResultService +import com.openlayer.api.services.blocking.inferencepipelines.TestResultServiceImpl class InferencePipelineServiceImpl internal constructor(private val clientOptions: ClientOptions) : InferencePipelineService { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt index ec5f4e27..e88bd15b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt @@ -5,10 +5,10 @@ package com.openlayer.api.services.blocking import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.ProjectCreateParams -import com.openlayer.api.models.ProjectCreateResponse -import com.openlayer.api.models.ProjectListParams -import com.openlayer.api.models.ProjectListResponse +import com.openlayer.api.models.projects.ProjectCreateParams +import com.openlayer.api.models.projects.ProjectCreateResponse +import com.openlayer.api.models.projects.ProjectListParams +import com.openlayer.api.models.projects.ProjectListResponse import com.openlayer.api.services.blocking.projects.CommitService import com.openlayer.api.services.blocking.projects.InferencePipelineService diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt index 8aec3e77..4de2f6c5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt @@ -15,10 +15,10 @@ import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.ProjectCreateParams -import com.openlayer.api.models.ProjectCreateResponse -import com.openlayer.api.models.ProjectListParams -import com.openlayer.api.models.ProjectListResponse +import com.openlayer.api.models.projects.ProjectCreateParams +import com.openlayer.api.models.projects.ProjectCreateResponse +import com.openlayer.api.models.projects.ProjectListParams +import com.openlayer.api.models.projects.ProjectListResponse import com.openlayer.api.services.blocking.projects.CommitService import com.openlayer.api.services.blocking.projects.CommitServiceImpl import com.openlayer.api.services.blocking.projects.InferencePipelineService diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt index e5bf6089..3119ffe4 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt @@ -5,8 +5,8 @@ package com.openlayer.api.services.blocking.commits import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.CommitTestResultListParams -import com.openlayer.api.models.CommitTestResultListResponse +import com.openlayer.api.models.commits.testresults.TestResultListParams +import com.openlayer.api.models.commits.testresults.TestResultListResponse interface TestResultService { @@ -16,14 +16,14 @@ interface TestResultService { fun withRawResponse(): WithRawResponse /** List the test results for a project commit (project version). */ - fun list(params: CommitTestResultListParams): CommitTestResultListResponse = + fun list(params: TestResultListParams): TestResultListResponse = list(params, RequestOptions.none()) /** @see [list] */ fun list( - params: CommitTestResultListParams, + params: TestResultListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CommitTestResultListResponse + ): TestResultListResponse /** A view of [TestResultService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -33,15 +33,14 @@ interface TestResultService { * otherwise the same as [TestResultService.list]. */ @MustBeClosed - fun list( - params: CommitTestResultListParams - ): HttpResponseFor = list(params, RequestOptions.none()) + fun list(params: TestResultListParams): HttpResponseFor = + list(params, RequestOptions.none()) /** @see [list] */ @MustBeClosed fun list( - params: CommitTestResultListParams, + params: TestResultListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt index 3e5f241e..366e8b68 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt @@ -14,8 +14,8 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.CommitTestResultListParams -import com.openlayer.api.models.CommitTestResultListResponse +import com.openlayer.api.models.commits.testresults.TestResultListParams +import com.openlayer.api.models.commits.testresults.TestResultListResponse class TestResultServiceImpl internal constructor(private val clientOptions: ClientOptions) : TestResultService { @@ -27,9 +27,9 @@ class TestResultServiceImpl internal constructor(private val clientOptions: Clie override fun withRawResponse(): TestResultService.WithRawResponse = withRawResponse override fun list( - params: CommitTestResultListParams, + params: TestResultListParams, requestOptions: RequestOptions, - ): CommitTestResultListResponse = + ): TestResultListResponse = // get /versions/{projectVersionId}/results withRawResponse().list(params, requestOptions).parse() @@ -38,14 +38,14 @@ class TestResultServiceImpl internal constructor(private val clientOptions: Clie private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) override fun list( - params: CommitTestResultListParams, + params: TestResultListParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataService.kt similarity index 61% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataService.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataService.kt index f04db58b..ba3abb66 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataService.kt @@ -1,12 +1,12 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.services.blocking.inferencePipelines +package com.openlayer.api.services.blocking.inferencepipelines import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.InferencePipelineDataStreamParams -import com.openlayer.api.models.InferencePipelineDataStreamResponse +import com.openlayer.api.models.inferencepipelines.data.DataStreamParams +import com.openlayer.api.models.inferencepipelines.data.DataStreamResponse interface DataService { @@ -16,14 +16,13 @@ interface DataService { fun withRawResponse(): WithRawResponse /** Publish an inference data point to an inference pipeline. */ - fun stream(params: InferencePipelineDataStreamParams): InferencePipelineDataStreamResponse = - stream(params, RequestOptions.none()) + fun stream(params: DataStreamParams): DataStreamResponse = stream(params, RequestOptions.none()) /** @see [stream] */ fun stream( - params: InferencePipelineDataStreamParams, + params: DataStreamParams, requestOptions: RequestOptions = RequestOptions.none(), - ): InferencePipelineDataStreamResponse + ): DataStreamResponse /** A view of [DataService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -34,16 +33,14 @@ interface DataService { * [DataService.stream]. */ @MustBeClosed - fun stream( - params: InferencePipelineDataStreamParams - ): HttpResponseFor = + fun stream(params: DataStreamParams): HttpResponseFor = stream(params, RequestOptions.none()) /** @see [stream] */ @MustBeClosed fun stream( - params: InferencePipelineDataStreamParams, + params: DataStreamParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataServiceImpl.kt similarity index 78% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataServiceImpl.kt index 4355c798..aca096fb 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataServiceImpl.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.services.blocking.inferencePipelines +package com.openlayer.api.services.blocking.inferencepipelines import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions @@ -15,8 +15,8 @@ import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineDataStreamParams -import com.openlayer.api.models.InferencePipelineDataStreamResponse +import com.openlayer.api.models.inferencepipelines.data.DataStreamParams +import com.openlayer.api.models.inferencepipelines.data.DataStreamResponse class DataServiceImpl internal constructor(private val clientOptions: ClientOptions) : DataService { @@ -27,9 +27,9 @@ class DataServiceImpl internal constructor(private val clientOptions: ClientOpti override fun withRawResponse(): DataService.WithRawResponse = withRawResponse override fun stream( - params: InferencePipelineDataStreamParams, + params: DataStreamParams, requestOptions: RequestOptions, - ): InferencePipelineDataStreamResponse = + ): DataStreamResponse = // post /inference-pipelines/{inferencePipelineId}/data-stream withRawResponse().stream(params, requestOptions).parse() @@ -38,14 +38,13 @@ class DataServiceImpl internal constructor(private val clientOptions: ClientOpti private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val streamHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + private val streamHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) override fun stream( - params: InferencePipelineDataStreamParams, + params: DataStreamParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { val request = HttpRequest.builder() .method(HttpMethod.POST) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowService.kt similarity index 61% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowService.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowService.kt index 62b63076..d77752c7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowService.kt @@ -1,12 +1,12 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.services.blocking.inferencePipelines +package com.openlayer.api.services.blocking.inferencepipelines import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.InferencePipelineRowUpdateParams -import com.openlayer.api.models.InferencePipelineRowUpdateResponse +import com.openlayer.api.models.inferencepipelines.rows.RowUpdateParams +import com.openlayer.api.models.inferencepipelines.rows.RowUpdateResponse interface RowService { @@ -16,14 +16,13 @@ interface RowService { fun withRawResponse(): WithRawResponse /** Update an inference data point in an inference pipeline. */ - fun update(params: InferencePipelineRowUpdateParams): InferencePipelineRowUpdateResponse = - update(params, RequestOptions.none()) + fun update(params: RowUpdateParams): RowUpdateResponse = update(params, RequestOptions.none()) /** @see [update] */ fun update( - params: InferencePipelineRowUpdateParams, + params: RowUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): InferencePipelineRowUpdateResponse + ): RowUpdateResponse /** A view of [RowService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -33,16 +32,14 @@ interface RowService { * but is otherwise the same as [RowService.update]. */ @MustBeClosed - fun update( - params: InferencePipelineRowUpdateParams - ): HttpResponseFor = + fun update(params: RowUpdateParams): HttpResponseFor = update(params, RequestOptions.none()) /** @see [update] */ @MustBeClosed fun update( - params: InferencePipelineRowUpdateParams, + params: RowUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowServiceImpl.kt similarity index 79% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowServiceImpl.kt index 6411ff54..19d65031 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowServiceImpl.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.services.blocking.inferencePipelines +package com.openlayer.api.services.blocking.inferencepipelines import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions @@ -15,8 +15,8 @@ import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineRowUpdateParams -import com.openlayer.api.models.InferencePipelineRowUpdateResponse +import com.openlayer.api.models.inferencepipelines.rows.RowUpdateParams +import com.openlayer.api.models.inferencepipelines.rows.RowUpdateResponse class RowServiceImpl internal constructor(private val clientOptions: ClientOptions) : RowService { @@ -27,9 +27,9 @@ class RowServiceImpl internal constructor(private val clientOptions: ClientOptio override fun withRawResponse(): RowService.WithRawResponse = withRawResponse override fun update( - params: InferencePipelineRowUpdateParams, + params: RowUpdateParams, requestOptions: RequestOptions, - ): InferencePipelineRowUpdateResponse = + ): RowUpdateResponse = // put /inference-pipelines/{inferencePipelineId}/rows withRawResponse().update(params, requestOptions).parse() @@ -38,14 +38,13 @@ class RowServiceImpl internal constructor(private val clientOptions: ClientOptio private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) override fun update( - params: InferencePipelineRowUpdateParams, + params: RowUpdateParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { val request = HttpRequest.builder() .method(HttpMethod.PUT) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultService.kt similarity index 60% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultService.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultService.kt index 6a77a380..45dae6c1 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultService.kt @@ -1,12 +1,12 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.services.blocking.inferencePipelines +package com.openlayer.api.services.blocking.inferencepipelines import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.InferencePipelineTestResultListParams -import com.openlayer.api.models.InferencePipelineTestResultListResponse +import com.openlayer.api.models.inferencepipelines.testresults.TestResultListParams +import com.openlayer.api.models.inferencepipelines.testresults.TestResultListResponse interface TestResultService { @@ -16,15 +16,14 @@ interface TestResultService { fun withRawResponse(): WithRawResponse /** List the latest test results for an inference pipeline. */ - fun list( - params: InferencePipelineTestResultListParams - ): InferencePipelineTestResultListResponse = list(params, RequestOptions.none()) + fun list(params: TestResultListParams): TestResultListResponse = + list(params, RequestOptions.none()) /** @see [list] */ fun list( - params: InferencePipelineTestResultListParams, + params: TestResultListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): InferencePipelineTestResultListResponse + ): TestResultListResponse /** A view of [TestResultService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -34,16 +33,14 @@ interface TestResultService { * but is otherwise the same as [TestResultService.list]. */ @MustBeClosed - fun list( - params: InferencePipelineTestResultListParams - ): HttpResponseFor = + fun list(params: TestResultListParams): HttpResponseFor = list(params, RequestOptions.none()) /** @see [list] */ @MustBeClosed fun list( - params: InferencePipelineTestResultListParams, + params: TestResultListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceImpl.kt similarity index 79% rename from openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt rename to openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceImpl.kt index 8ccc73b5..f618d3c0 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceImpl.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.services.blocking.inferencePipelines +package com.openlayer.api.services.blocking.inferencepipelines import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions @@ -14,8 +14,8 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.InferencePipelineTestResultListParams -import com.openlayer.api.models.InferencePipelineTestResultListResponse +import com.openlayer.api.models.inferencepipelines.testresults.TestResultListParams +import com.openlayer.api.models.inferencepipelines.testresults.TestResultListResponse class TestResultServiceImpl internal constructor(private val clientOptions: ClientOptions) : TestResultService { @@ -27,9 +27,9 @@ class TestResultServiceImpl internal constructor(private val clientOptions: Clie override fun withRawResponse(): TestResultService.WithRawResponse = withRawResponse override fun list( - params: InferencePipelineTestResultListParams, + params: TestResultListParams, requestOptions: RequestOptions, - ): InferencePipelineTestResultListResponse = + ): TestResultListResponse = // get /inference-pipelines/{inferencePipelineId}/results withRawResponse().list(params, requestOptions).parse() @@ -38,14 +38,14 @@ class TestResultServiceImpl internal constructor(private val clientOptions: Clie private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) override fun list( - params: InferencePipelineTestResultListParams, + params: TestResultListParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt index f5eb85a7..1e897572 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt @@ -5,10 +5,10 @@ package com.openlayer.api.services.blocking.projects import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.ProjectCommitCreateParams -import com.openlayer.api.models.ProjectCommitCreateResponse -import com.openlayer.api.models.ProjectCommitListParams -import com.openlayer.api.models.ProjectCommitListResponse +import com.openlayer.api.models.projects.commits.CommitCreateParams +import com.openlayer.api.models.projects.commits.CommitCreateResponse +import com.openlayer.api.models.projects.commits.CommitListParams +import com.openlayer.api.models.projects.commits.CommitListResponse interface CommitService { @@ -18,24 +18,23 @@ interface CommitService { fun withRawResponse(): WithRawResponse /** Create a new commit (project version) in a project. */ - fun create(params: ProjectCommitCreateParams): ProjectCommitCreateResponse = + fun create(params: CommitCreateParams): CommitCreateResponse = create(params, RequestOptions.none()) /** @see [create] */ fun create( - params: ProjectCommitCreateParams, + params: CommitCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): ProjectCommitCreateResponse + ): CommitCreateResponse /** List the commits (project versions) in a project. */ - fun list(params: ProjectCommitListParams): ProjectCommitListResponse = - list(params, RequestOptions.none()) + fun list(params: CommitListParams): CommitListResponse = list(params, RequestOptions.none()) /** @see [list] */ fun list( - params: ProjectCommitListParams, + params: CommitListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): ProjectCommitListResponse + ): CommitListResponse /** A view of [CommitService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -45,30 +44,29 @@ interface CommitService { * the same as [CommitService.create]. */ @MustBeClosed - fun create( - params: ProjectCommitCreateParams - ): HttpResponseFor = create(params, RequestOptions.none()) + fun create(params: CommitCreateParams): HttpResponseFor = + create(params, RequestOptions.none()) /** @see [create] */ @MustBeClosed fun create( - params: ProjectCommitCreateParams, + params: CommitCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor /** * Returns a raw HTTP response for `get /projects/{projectId}/versions`, but is otherwise * the same as [CommitService.list]. */ @MustBeClosed - fun list(params: ProjectCommitListParams): HttpResponseFor = + fun list(params: CommitListParams): HttpResponseFor = list(params, RequestOptions.none()) /** @see [list] */ @MustBeClosed fun list( - params: ProjectCommitListParams, + params: CommitListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt index a4852eba..73d6b428 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt @@ -15,10 +15,10 @@ import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.ProjectCommitCreateParams -import com.openlayer.api.models.ProjectCommitCreateResponse -import com.openlayer.api.models.ProjectCommitListParams -import com.openlayer.api.models.ProjectCommitListResponse +import com.openlayer.api.models.projects.commits.CommitCreateParams +import com.openlayer.api.models.projects.commits.CommitCreateResponse +import com.openlayer.api.models.projects.commits.CommitListParams +import com.openlayer.api.models.projects.commits.CommitListResponse class CommitServiceImpl internal constructor(private val clientOptions: ClientOptions) : CommitService { @@ -30,16 +30,16 @@ class CommitServiceImpl internal constructor(private val clientOptions: ClientOp override fun withRawResponse(): CommitService.WithRawResponse = withRawResponse override fun create( - params: ProjectCommitCreateParams, + params: CommitCreateParams, requestOptions: RequestOptions, - ): ProjectCommitCreateResponse = + ): CommitCreateResponse = // post /projects/{projectId}/versions withRawResponse().create(params, requestOptions).parse() override fun list( - params: ProjectCommitListParams, + params: CommitListParams, requestOptions: RequestOptions, - ): ProjectCommitListResponse = + ): CommitListResponse = // get /projects/{projectId}/versions withRawResponse().list(params, requestOptions).parse() @@ -48,14 +48,14 @@ class CommitServiceImpl internal constructor(private val clientOptions: ClientOp private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) override fun create( - params: ProjectCommitCreateParams, + params: CommitCreateParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -76,14 +76,13 @@ class CommitServiceImpl internal constructor(private val clientOptions: ClientOp } } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) override fun list( - params: ProjectCommitListParams, + params: CommitListParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineService.kt index 416c9640..e2654efa 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineService.kt @@ -5,10 +5,10 @@ package com.openlayer.api.services.blocking.projects import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.ProjectInferencePipelineCreateParams -import com.openlayer.api.models.ProjectInferencePipelineCreateResponse -import com.openlayer.api.models.ProjectInferencePipelineListParams -import com.openlayer.api.models.ProjectInferencePipelineListResponse +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineCreateParams +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineCreateResponse +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineListParams +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineListResponse interface InferencePipelineService { @@ -18,25 +18,24 @@ interface InferencePipelineService { fun withRawResponse(): WithRawResponse /** Create an inference pipeline in a project. */ - fun create( - params: ProjectInferencePipelineCreateParams - ): ProjectInferencePipelineCreateResponse = create(params, RequestOptions.none()) + fun create(params: InferencePipelineCreateParams): InferencePipelineCreateResponse = + create(params, RequestOptions.none()) /** @see [create] */ fun create( - params: ProjectInferencePipelineCreateParams, + params: InferencePipelineCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): ProjectInferencePipelineCreateResponse + ): InferencePipelineCreateResponse /** List the inference pipelines in a project. */ - fun list(params: ProjectInferencePipelineListParams): ProjectInferencePipelineListResponse = + fun list(params: InferencePipelineListParams): InferencePipelineListResponse = list(params, RequestOptions.none()) /** @see [list] */ fun list( - params: ProjectInferencePipelineListParams, + params: InferencePipelineListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): ProjectInferencePipelineListResponse + ): InferencePipelineListResponse /** * A view of [InferencePipelineService] that provides access to raw HTTP responses for each @@ -50,16 +49,15 @@ interface InferencePipelineService { */ @MustBeClosed fun create( - params: ProjectInferencePipelineCreateParams - ): HttpResponseFor = - create(params, RequestOptions.none()) + params: InferencePipelineCreateParams + ): HttpResponseFor = create(params, RequestOptions.none()) /** @see [create] */ @MustBeClosed fun create( - params: ProjectInferencePipelineCreateParams, + params: InferencePipelineCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor /** * Returns a raw HTTP response for `get /projects/{projectId}/inference-pipelines`, but is @@ -67,15 +65,14 @@ interface InferencePipelineService { */ @MustBeClosed fun list( - params: ProjectInferencePipelineListParams - ): HttpResponseFor = - list(params, RequestOptions.none()) + params: InferencePipelineListParams + ): HttpResponseFor = list(params, RequestOptions.none()) /** @see [list] */ @MustBeClosed fun list( - params: ProjectInferencePipelineListParams, + params: InferencePipelineListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt index b2fd53aa..5192cd12 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt @@ -15,10 +15,10 @@ import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.ProjectInferencePipelineCreateParams -import com.openlayer.api.models.ProjectInferencePipelineCreateResponse -import com.openlayer.api.models.ProjectInferencePipelineListParams -import com.openlayer.api.models.ProjectInferencePipelineListResponse +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineCreateParams +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineCreateResponse +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineListParams +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineListResponse class InferencePipelineServiceImpl internal constructor(private val clientOptions: ClientOptions) : InferencePipelineService { @@ -30,16 +30,16 @@ class InferencePipelineServiceImpl internal constructor(private val clientOption override fun withRawResponse(): InferencePipelineService.WithRawResponse = withRawResponse override fun create( - params: ProjectInferencePipelineCreateParams, + params: InferencePipelineCreateParams, requestOptions: RequestOptions, - ): ProjectInferencePipelineCreateResponse = + ): InferencePipelineCreateResponse = // post /projects/{projectId}/inference-pipelines withRawResponse().create(params, requestOptions).parse() override fun list( - params: ProjectInferencePipelineListParams, + params: InferencePipelineListParams, requestOptions: RequestOptions, - ): ProjectInferencePipelineListResponse = + ): InferencePipelineListResponse = // get /projects/{projectId}/inference-pipelines withRawResponse().list(params, requestOptions).parse() @@ -48,14 +48,14 @@ class InferencePipelineServiceImpl internal constructor(private val clientOption private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) override fun create( - params: ProjectInferencePipelineCreateParams, + params: InferencePipelineCreateParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -76,14 +76,14 @@ class InferencePipelineServiceImpl internal constructor(private val clientOption } } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) override fun list( - params: ProjectInferencePipelineListParams, + params: InferencePipelineListParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt index a59456b3..01a7867b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt @@ -5,8 +5,8 @@ package com.openlayer.api.services.blocking.storage import com.google.errorprone.annotations.MustBeClosed import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor -import com.openlayer.api.models.StoragePresignedUrlCreateParams -import com.openlayer.api.models.StoragePresignedUrlCreateResponse +import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateParams +import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateResponse interface PresignedUrlService { @@ -16,14 +16,14 @@ interface PresignedUrlService { fun withRawResponse(): WithRawResponse /** Retrieve a presigned url to post storage artifacts. */ - fun create(params: StoragePresignedUrlCreateParams): StoragePresignedUrlCreateResponse = + fun create(params: PresignedUrlCreateParams): PresignedUrlCreateResponse = create(params, RequestOptions.none()) /** @see [create] */ fun create( - params: StoragePresignedUrlCreateParams, + params: PresignedUrlCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): StoragePresignedUrlCreateResponse + ): PresignedUrlCreateResponse /** * A view of [PresignedUrlService] that provides access to raw HTTP responses for each method. @@ -35,16 +35,14 @@ interface PresignedUrlService { * as [PresignedUrlService.create]. */ @MustBeClosed - fun create( - params: StoragePresignedUrlCreateParams - ): HttpResponseFor = + fun create(params: PresignedUrlCreateParams): HttpResponseFor = create(params, RequestOptions.none()) /** @see [create] */ @MustBeClosed fun create( - params: StoragePresignedUrlCreateParams, + params: PresignedUrlCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt index 5f86890e..aff6f743 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt @@ -15,8 +15,8 @@ import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.models.StoragePresignedUrlCreateParams -import com.openlayer.api.models.StoragePresignedUrlCreateResponse +import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateParams +import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateResponse class PresignedUrlServiceImpl internal constructor(private val clientOptions: ClientOptions) : PresignedUrlService { @@ -28,9 +28,9 @@ class PresignedUrlServiceImpl internal constructor(private val clientOptions: Cl override fun withRawResponse(): PresignedUrlService.WithRawResponse = withRawResponse override fun create( - params: StoragePresignedUrlCreateParams, + params: PresignedUrlCreateParams, requestOptions: RequestOptions, - ): StoragePresignedUrlCreateResponse = + ): PresignedUrlCreateResponse = // post /storage/presigned-url withRawResponse().create(params, requestOptions).parse() @@ -39,14 +39,14 @@ class PresignedUrlServiceImpl internal constructor(private val clientOptions: Cl private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) override fun create( - params: StoragePresignedUrlCreateParams, + params: PresignedUrlCreateParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { val request = HttpRequest.builder() .method(HttpMethod.POST) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponseTest.kt deleted file mode 100644 index 5d5c07fc..00000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponseTest.kt +++ /dev/null @@ -1,20 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.models - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class InferencePipelineDataStreamResponseTest { - - @Test - fun createInferencePipelineDataStreamResponse() { - val inferencePipelineDataStreamResponse = - InferencePipelineDataStreamResponse.builder() - .success(InferencePipelineDataStreamResponse.Success.TRUE) - .build() - assertThat(inferencePipelineDataStreamResponse).isNotNull - assertThat(inferencePipelineDataStreamResponse.success()) - .isEqualTo(InferencePipelineDataStreamResponse.Success.TRUE) - } -} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponseTest.kt deleted file mode 100644 index 427675b7..00000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponseTest.kt +++ /dev/null @@ -1,20 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.models - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class InferencePipelineRowUpdateResponseTest { - - @Test - fun createInferencePipelineRowUpdateResponse() { - val inferencePipelineRowUpdateResponse = - InferencePipelineRowUpdateResponse.builder() - .success(InferencePipelineRowUpdateResponse.Success.TRUE) - .build() - assertThat(inferencePipelineRowUpdateResponse).isNotNull - assertThat(inferencePipelineRowUpdateResponse.success()) - .isEqualTo(InferencePipelineRowUpdateResponse.Success.TRUE) - } -} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponseTest.kt deleted file mode 100644 index c6dd2f5f..00000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponseTest.kt +++ /dev/null @@ -1,25 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.models - -import com.openlayer.api.core.JsonValue -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class StoragePresignedUrlCreateResponseTest { - - @Test - fun createStoragePresignedUrlCreateResponse() { - val storagePresignedUrlCreateResponse = - StoragePresignedUrlCreateResponse.builder() - .storageUri("storageUri") - .url("url") - .fields(JsonValue.from(mapOf())) - .build() - assertThat(storagePresignedUrlCreateResponse).isNotNull - assertThat(storagePresignedUrlCreateResponse.storageUri()).isEqualTo("storageUri") - assertThat(storagePresignedUrlCreateResponse.url()).isEqualTo("url") - assertThat(storagePresignedUrlCreateResponse._fields()) - .isEqualTo(JsonValue.from(mapOf())) - } -} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitRetrieveParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveParamsTest.kt similarity index 95% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitRetrieveParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveParamsTest.kt index 6ec60cd9..4ad5908b 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitRetrieveParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveParamsTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.commits import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt similarity index 99% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitRetrieveResponseTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt index 581ef8da..11f1b13d 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitRetrieveResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.commits import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt similarity index 70% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt index 962fcaea..75b13ea8 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt @@ -1,49 +1,49 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.commits.testresults import com.openlayer.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class CommitTestResultListParamsTest { +class TestResultListParamsTest { @Test fun create() { - CommitTestResultListParams.builder() + TestResultListParams.builder() .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .includeArchived(true) .page(1L) .perPage(1L) - .status(CommitTestResultListParams.Status.RUNNING) - .type(CommitTestResultListParams.Type.INTEGRITY) + .status(TestResultListParams.Status.RUNNING) + .type(TestResultListParams.Type.INTEGRITY) .build() } @Test fun queryParams() { val params = - CommitTestResultListParams.builder() + TestResultListParams.builder() .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .includeArchived(true) .page(1L) .perPage(1L) - .status(CommitTestResultListParams.Status.RUNNING) - .type(CommitTestResultListParams.Type.INTEGRITY) + .status(TestResultListParams.Status.RUNNING) + .type(TestResultListParams.Type.INTEGRITY) .build() val expected = QueryParams.builder() expected.put("includeArchived", "true") expected.put("page", "1") expected.put("perPage", "1") - expected.put("status", CommitTestResultListParams.Status.RUNNING.toString()) - expected.put("type", CommitTestResultListParams.Type.INTEGRITY.toString()) + expected.put("status", TestResultListParams.Status.RUNNING.toString()) + expected.put("type", TestResultListParams.Type.INTEGRITY.toString()) assertThat(params._queryParams()).isEqualTo(expected.build()) } @Test fun queryParamsWithoutOptionalFields() { val params = - CommitTestResultListParams.builder() + TestResultListParams.builder() .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() val expected = QueryParams.builder() @@ -53,7 +53,7 @@ class CommitTestResultListParamsTest { @Test fun getPathParam() { val params = - CommitTestResultListParams.builder() + TestResultListParams.builder() .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() assertThat(params).isNotNull diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt similarity index 85% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt index 7701f8bd..cfc41f76 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt @@ -1,20 +1,20 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.commits.testresults import com.openlayer.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class CommitTestResultListResponseTest { +class TestResultListResponseTest { @Test - fun createCommitTestResultListResponse() { - val commitTestResultListResponse = - CommitTestResultListResponse.builder() + fun createTestResultListResponse() { + val testResultListResponse = + TestResultListResponse.builder() .addItem( - CommitTestResultListResponse.Item.builder() + TestResultListResponse.Item.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateDataEnds(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -22,10 +22,10 @@ class CommitTestResultListResponseTest { .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(CommitTestResultListResponse.Item.Status.RUNNING) + .status(TestResultListResponse.Item.Status.RUNNING) .statusMessage("Test successfully processed.") .goal( - CommitTestResultListResponse.Item.Goal.builder() + TestResultListResponse.Item.Goal.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commentCount(0L) .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") @@ -39,7 +39,7 @@ class CommitTestResultListResponseTest { .subtype("duplicateRowCount") .suggested(false) .addThreshold( - CommitTestResultListResponse.Item.Goal.Threshold.builder() + TestResultListResponse.Item.Goal.Threshold.builder() .insightName("duplicateRowCount") .addInsightParameter(JsonValue.from(mapOf())) .measurement("duplicateRowCount") @@ -62,10 +62,10 @@ class CommitTestResultListResponseTest { .build() ) .build() - assertThat(commitTestResultListResponse).isNotNull - assertThat(commitTestResultListResponse.items()) + assertThat(testResultListResponse).isNotNull + assertThat(testResultListResponse.items()) .containsExactly( - CommitTestResultListResponse.Item.builder() + TestResultListResponse.Item.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateDataEnds(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -73,10 +73,10 @@ class CommitTestResultListResponseTest { .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(CommitTestResultListResponse.Item.Status.RUNNING) + .status(TestResultListResponse.Item.Status.RUNNING) .statusMessage("Test successfully processed.") .goal( - CommitTestResultListResponse.Item.Goal.builder() + TestResultListResponse.Item.Goal.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commentCount(0L) .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") @@ -90,7 +90,7 @@ class CommitTestResultListResponseTest { .subtype("duplicateRowCount") .suggested(false) .addThreshold( - CommitTestResultListResponse.Item.Goal.Threshold.builder() + TestResultListResponse.Item.Goal.Threshold.builder() .insightName("duplicateRowCount") .addInsightParameter(JsonValue.from(mapOf())) .measurement("duplicateRowCount") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDeleteParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParamsTest.kt similarity index 94% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDeleteParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParamsTest.kt index 44bfdcf1..7d1e1cfe 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDeleteParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParamsTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParamsTest.kt similarity index 97% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParamsTest.kt index da569fe6..a7d16114 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParamsTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines import com.openlayer.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt similarity index 99% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponseTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt index b3c43c88..a57ab209 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines import java.time.LocalDate import java.time.OffsetDateTime diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParamsTest.kt similarity index 97% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParamsTest.kt index bf3959eb..d58a401a 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParamsTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt similarity index 99% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponseTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt index a8fc62c9..8d35abbc 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines import java.time.LocalDate import java.time.OffsetDateTime diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParamsTest.kt similarity index 79% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParamsTest.kt index 379eb898..e36d69c5 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParamsTest.kt @@ -1,20 +1,20 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines.data import com.openlayer.api.core.JsonValue import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class InferencePipelineDataStreamParamsTest { +class DataStreamParamsTest { @Test fun create() { - InferencePipelineDataStreamParams.builder() + DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() + DataStreamParams.Config.LlmData.builder() .outputColumnName("output") .contextColumnName("context") .costColumnName("cost") @@ -25,7 +25,7 @@ class InferencePipelineDataStreamParamsTest { .metadata(JsonValue.from(mapOf())) .numOfTokenColumnName("tokens") .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + DataStreamParams.Config.LlmData.Prompt.builder() .content("{{ user_query }}") .role("user") .build() @@ -35,7 +35,7 @@ class InferencePipelineDataStreamParamsTest { .build() ) .addRow( - InferencePipelineDataStreamParams.Row.builder() + DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) .putAdditionalProperty("tokens", JsonValue.from("bar")) @@ -49,10 +49,10 @@ class InferencePipelineDataStreamParamsTest { @Test fun body() { val params = - InferencePipelineDataStreamParams.builder() + DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() + DataStreamParams.Config.LlmData.builder() .outputColumnName("output") .contextColumnName("context") .costColumnName("cost") @@ -63,7 +63,7 @@ class InferencePipelineDataStreamParamsTest { .metadata(JsonValue.from(mapOf())) .numOfTokenColumnName("tokens") .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + DataStreamParams.Config.LlmData.Prompt.builder() .content("{{ user_query }}") .role("user") .build() @@ -73,7 +73,7 @@ class InferencePipelineDataStreamParamsTest { .build() ) .addRow( - InferencePipelineDataStreamParams.Row.builder() + DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) .putAdditionalProperty("tokens", JsonValue.from("bar")) @@ -88,8 +88,8 @@ class InferencePipelineDataStreamParamsTest { assertNotNull(body) assertThat(body.config()) .isEqualTo( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() + DataStreamParams.Config.ofLlmData( + DataStreamParams.Config.LlmData.builder() .outputColumnName("output") .contextColumnName("context") .costColumnName("cost") @@ -100,7 +100,7 @@ class InferencePipelineDataStreamParamsTest { .metadata(JsonValue.from(mapOf())) .numOfTokenColumnName("tokens") .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + DataStreamParams.Config.LlmData.Prompt.builder() .content("{{ user_query }}") .role("user") .build() @@ -113,7 +113,7 @@ class InferencePipelineDataStreamParamsTest { assertThat(body.rows()) .isEqualTo( listOf( - InferencePipelineDataStreamParams.Row.builder() + DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) .putAdditionalProperty("tokens", JsonValue.from("bar")) @@ -127,15 +127,13 @@ class InferencePipelineDataStreamParamsTest { @Test fun bodyWithoutOptionalFields() { val params = - InferencePipelineDataStreamParams.builder() + DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .build() + DataStreamParams.Config.LlmData.builder().outputColumnName("output").build() ) .addRow( - InferencePipelineDataStreamParams.Row.builder() + DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) .putAdditionalProperty("tokens", JsonValue.from("bar")) @@ -150,16 +148,14 @@ class InferencePipelineDataStreamParamsTest { assertNotNull(body) assertThat(body.config()) .isEqualTo( - InferencePipelineDataStreamParams.Config.ofLlmData( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .build() + DataStreamParams.Config.ofLlmData( + DataStreamParams.Config.LlmData.builder().outputColumnName("output").build() ) ) assertThat(body.rows()) .isEqualTo( listOf( - InferencePipelineDataStreamParams.Row.builder() + DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) .putAdditionalProperty("tokens", JsonValue.from("bar")) @@ -173,15 +169,13 @@ class InferencePipelineDataStreamParamsTest { @Test fun getPathParam() { val params = - InferencePipelineDataStreamParams.builder() + DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() - .outputColumnName("output") - .build() + DataStreamParams.Config.LlmData.builder().outputColumnName("output").build() ) .addRow( - InferencePipelineDataStreamParams.Row.builder() + DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) .putAdditionalProperty("tokens", JsonValue.from("bar")) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponseTest.kt new file mode 100644 index 00000000..9cbd2386 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponseTest.kt @@ -0,0 +1,17 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.inferencepipelines.data + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class DataStreamResponseTest { + + @Test + fun createDataStreamResponse() { + val dataStreamResponse = + DataStreamResponse.builder().success(DataStreamResponse.Success.TRUE).build() + assertThat(dataStreamResponse).isNotNull + assertThat(dataStreamResponse.success()).isEqualTo(DataStreamResponse.Success.TRUE) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt similarity index 85% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt index c165a679..3013696d 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines.rows import com.openlayer.api.core.JsonValue import com.openlayer.api.core.http.QueryParams @@ -8,16 +8,16 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class InferencePipelineRowUpdateParamsTest { +class RowUpdateParamsTest { @Test fun create() { - InferencePipelineRowUpdateParams.builder() + RowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .inferenceId("inferenceId") .row(JsonValue.from(mapOf())) .config( - InferencePipelineRowUpdateParams.Config.builder() + RowUpdateParams.Config.builder() .groundTruthColumnName("ground_truth") .humanFeedbackColumnName("human_feedback") .latencyColumnName("latency") @@ -30,12 +30,12 @@ class InferencePipelineRowUpdateParamsTest { @Test fun queryParams() { val params = - InferencePipelineRowUpdateParams.builder() + RowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .inferenceId("inferenceId") .row(JsonValue.from(mapOf())) .config( - InferencePipelineRowUpdateParams.Config.builder() + RowUpdateParams.Config.builder() .groundTruthColumnName("ground_truth") .humanFeedbackColumnName("human_feedback") .latencyColumnName("latency") @@ -51,7 +51,7 @@ class InferencePipelineRowUpdateParamsTest { @Test fun queryParamsWithoutOptionalFields() { val params = - InferencePipelineRowUpdateParams.builder() + RowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .inferenceId("inferenceId") .row(JsonValue.from(mapOf())) @@ -64,12 +64,12 @@ class InferencePipelineRowUpdateParamsTest { @Test fun body() { val params = - InferencePipelineRowUpdateParams.builder() + RowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .inferenceId("inferenceId") .row(JsonValue.from(mapOf())) .config( - InferencePipelineRowUpdateParams.Config.builder() + RowUpdateParams.Config.builder() .groundTruthColumnName("ground_truth") .humanFeedbackColumnName("human_feedback") .latencyColumnName("latency") @@ -84,7 +84,7 @@ class InferencePipelineRowUpdateParamsTest { assertThat(body._row()).isEqualTo(JsonValue.from(mapOf())) assertThat(body.config()) .contains( - InferencePipelineRowUpdateParams.Config.builder() + RowUpdateParams.Config.builder() .groundTruthColumnName("ground_truth") .humanFeedbackColumnName("human_feedback") .latencyColumnName("latency") @@ -96,7 +96,7 @@ class InferencePipelineRowUpdateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = - InferencePipelineRowUpdateParams.builder() + RowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .inferenceId("inferenceId") .row(JsonValue.from(mapOf())) @@ -111,7 +111,7 @@ class InferencePipelineRowUpdateParamsTest { @Test fun getPathParam() { val params = - InferencePipelineRowUpdateParams.builder() + RowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .inferenceId("inferenceId") .row(JsonValue.from(mapOf())) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponseTest.kt new file mode 100644 index 00000000..a423a574 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponseTest.kt @@ -0,0 +1,17 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.inferencepipelines.rows + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class RowUpdateResponseTest { + + @Test + fun createRowUpdateResponse() { + val rowUpdateResponse = + RowUpdateResponse.builder().success(RowUpdateResponse.Success.TRUE).build() + assertThat(rowUpdateResponse).isNotNull + assertThat(rowUpdateResponse.success()).isEqualTo(RowUpdateResponse.Success.TRUE) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt similarity index 65% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt index ed330120..4e0fae12 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt @@ -1,46 +1,46 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines.testresults import com.openlayer.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class InferencePipelineTestResultListParamsTest { +class TestResultListParamsTest { @Test fun create() { - InferencePipelineTestResultListParams.builder() + TestResultListParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .page(1L) .perPage(1L) - .status(InferencePipelineTestResultListParams.Status.RUNNING) - .type(InferencePipelineTestResultListParams.Type.INTEGRITY) + .status(TestResultListParams.Status.RUNNING) + .type(TestResultListParams.Type.INTEGRITY) .build() } @Test fun queryParams() { val params = - InferencePipelineTestResultListParams.builder() + TestResultListParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .page(1L) .perPage(1L) - .status(InferencePipelineTestResultListParams.Status.RUNNING) - .type(InferencePipelineTestResultListParams.Type.INTEGRITY) + .status(TestResultListParams.Status.RUNNING) + .type(TestResultListParams.Type.INTEGRITY) .build() val expected = QueryParams.builder() expected.put("page", "1") expected.put("perPage", "1") - expected.put("status", InferencePipelineTestResultListParams.Status.RUNNING.toString()) - expected.put("type", InferencePipelineTestResultListParams.Type.INTEGRITY.toString()) + expected.put("status", TestResultListParams.Status.RUNNING.toString()) + expected.put("type", TestResultListParams.Type.INTEGRITY.toString()) assertThat(params._queryParams()).isEqualTo(expected.build()) } @Test fun queryParamsWithoutOptionalFields() { val params = - InferencePipelineTestResultListParams.builder() + TestResultListParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() val expected = QueryParams.builder() @@ -50,7 +50,7 @@ class InferencePipelineTestResultListParamsTest { @Test fun getPathParam() { val params = - InferencePipelineTestResultListParams.builder() + TestResultListParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() assertThat(params).isNotNull diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt similarity index 82% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt index 7869a1be..dcaa341d 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt @@ -1,20 +1,20 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.inferencepipelines.testresults import com.openlayer.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class InferencePipelineTestResultListResponseTest { +class TestResultListResponseTest { @Test - fun createInferencePipelineTestResultListResponse() { - val inferencePipelineTestResultListResponse = - InferencePipelineTestResultListResponse.builder() + fun createTestResultListResponse() { + val testResultListResponse = + TestResultListResponse.builder() .addItem( - InferencePipelineTestResultListResponse.Item.builder() + TestResultListResponse.Item.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateDataEnds(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -22,10 +22,10 @@ class InferencePipelineTestResultListResponseTest { .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineTestResultListResponse.Item.Status.RUNNING) + .status(TestResultListResponse.Item.Status.RUNNING) .statusMessage("Test successfully processed.") .goal( - InferencePipelineTestResultListResponse.Item.Goal.builder() + TestResultListResponse.Item.Goal.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commentCount(0L) .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") @@ -39,8 +39,7 @@ class InferencePipelineTestResultListResponseTest { .subtype("duplicateRowCount") .suggested(false) .addThreshold( - InferencePipelineTestResultListResponse.Item.Goal.Threshold - .builder() + TestResultListResponse.Item.Goal.Threshold.builder() .insightName("duplicateRowCount") .addInsightParameter(JsonValue.from(mapOf())) .measurement("duplicateRowCount") @@ -63,10 +62,10 @@ class InferencePipelineTestResultListResponseTest { .build() ) .build() - assertThat(inferencePipelineTestResultListResponse).isNotNull - assertThat(inferencePipelineTestResultListResponse.items()) + assertThat(testResultListResponse).isNotNull + assertThat(testResultListResponse.items()) .containsExactly( - InferencePipelineTestResultListResponse.Item.builder() + TestResultListResponse.Item.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateDataEnds(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -74,10 +73,10 @@ class InferencePipelineTestResultListResponseTest { .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineTestResultListResponse.Item.Status.RUNNING) + .status(TestResultListResponse.Item.Status.RUNNING) .statusMessage("Test successfully processed.") .goal( - InferencePipelineTestResultListResponse.Item.Goal.builder() + TestResultListResponse.Item.Goal.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commentCount(0L) .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") @@ -91,8 +90,7 @@ class InferencePipelineTestResultListResponseTest { .subtype("duplicateRowCount") .suggested(false) .addThreshold( - InferencePipelineTestResultListResponse.Item.Goal.Threshold - .builder() + TestResultListResponse.Item.Goal.Threshold.builder() .insightName("duplicateRowCount") .addInsightParameter(JsonValue.from(mapOf())) .measurement("duplicateRowCount") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateParamsTest.kt similarity index 99% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateParamsTest.kt index 95ea41fa..c40e6d21 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateParamsTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects import java.time.OffsetDateTime import kotlin.test.assertNotNull diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateResponseTest.kt similarity index 99% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateResponseTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateResponseTest.kt index 86144f76..a3b42157 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateResponseTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListParamsTest.kt similarity index 96% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListParamsTest.kt index 7b4ae1fd..15fe616b 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListParamsTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects import com.openlayer.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListResponseTest.kt similarity index 99% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListResponseTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListResponseTest.kt index 33801d22..dbc6829c 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListResponseTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt similarity index 90% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitCreateParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt index fcfd261a..3614d30b 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt @@ -1,21 +1,21 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects.commits import java.time.OffsetDateTime import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class ProjectCommitCreateParamsTest { +class CommitCreateParamsTest { @Test fun create() { - ProjectCommitCreateParams.builder() + CommitCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( - ProjectCommitCreateParams.Commit.builder() + CommitCreateParams.Commit.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") .fileSize(1024L) @@ -36,7 +36,7 @@ class ProjectCommitCreateParamsTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectCommitCreateParams.Status.QUEUED) + .status(CommitCreateParams.Status.QUEUED) .statusMessage("Commit successfully processed.") .storageUri("s3://...") .totalGoalCount(6L) @@ -45,7 +45,7 @@ class ProjectCommitCreateParamsTest { .archived(false) .deploymentStatus("Deployed") .links( - ProjectCommitCreateParams.Links.builder() + CommitCreateParams.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -57,11 +57,11 @@ class ProjectCommitCreateParamsTest { @Test fun body() { val params = - ProjectCommitCreateParams.builder() + CommitCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( - ProjectCommitCreateParams.Commit.builder() + CommitCreateParams.Commit.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") .fileSize(1024L) @@ -82,7 +82,7 @@ class ProjectCommitCreateParamsTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectCommitCreateParams.Status.QUEUED) + .status(CommitCreateParams.Status.QUEUED) .statusMessage("Commit successfully processed.") .storageUri("s3://...") .totalGoalCount(6L) @@ -91,7 +91,7 @@ class ProjectCommitCreateParamsTest { .archived(false) .deploymentStatus("Deployed") .links( - ProjectCommitCreateParams.Links.builder() + CommitCreateParams.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -105,7 +105,7 @@ class ProjectCommitCreateParamsTest { assertThat(body.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.commit()) .isEqualTo( - ProjectCommitCreateParams.Commit.builder() + CommitCreateParams.Commit.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") .fileSize(1024L) @@ -126,7 +126,7 @@ class ProjectCommitCreateParamsTest { assertThat(body.mlModelId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.passingGoalCount()).isEqualTo(5L) assertThat(body.projectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(body.status()).isEqualTo(ProjectCommitCreateParams.Status.QUEUED) + assertThat(body.status()).isEqualTo(CommitCreateParams.Status.QUEUED) assertThat(body.statusMessage()).contains("Commit successfully processed.") assertThat(body.storageUri()).isEqualTo("s3://...") assertThat(body.totalGoalCount()).isEqualTo(6L) @@ -136,7 +136,7 @@ class ProjectCommitCreateParamsTest { assertThat(body.deploymentStatus()).contains("Deployed") assertThat(body.links()) .contains( - ProjectCommitCreateParams.Links.builder() + CommitCreateParams.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -147,11 +147,11 @@ class ProjectCommitCreateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = - ProjectCommitCreateParams.builder() + CommitCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( - ProjectCommitCreateParams.Commit.builder() + CommitCreateParams.Commit.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") .fileSize(1024L) @@ -168,7 +168,7 @@ class ProjectCommitCreateParamsTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectCommitCreateParams.Status.QUEUED) + .status(CommitCreateParams.Status.QUEUED) .statusMessage("Commit successfully processed.") .storageUri("s3://...") .totalGoalCount(6L) @@ -182,7 +182,7 @@ class ProjectCommitCreateParamsTest { assertThat(body.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.commit()) .isEqualTo( - ProjectCommitCreateParams.Commit.builder() + CommitCreateParams.Commit.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") .fileSize(1024L) @@ -199,7 +199,7 @@ class ProjectCommitCreateParamsTest { assertThat(body.mlModelId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.passingGoalCount()).isEqualTo(5L) assertThat(body.projectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(body.status()).isEqualTo(ProjectCommitCreateParams.Status.QUEUED) + assertThat(body.status()).isEqualTo(CommitCreateParams.Status.QUEUED) assertThat(body.statusMessage()).contains("Commit successfully processed.") assertThat(body.storageUri()).isEqualTo("s3://...") assertThat(body.totalGoalCount()).isEqualTo(6L) @@ -210,11 +210,11 @@ class ProjectCommitCreateParamsTest { @Test fun getPathParam() { val params = - ProjectCommitCreateParams.builder() + CommitCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( - ProjectCommitCreateParams.Commit.builder() + CommitCreateParams.Commit.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") .fileSize(1024L) @@ -231,7 +231,7 @@ class ProjectCommitCreateParamsTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectCommitCreateParams.Status.QUEUED) + .status(CommitCreateParams.Status.QUEUED) .statusMessage("Commit successfully processed.") .storageUri("s3://...") .totalGoalCount(6L) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt similarity index 65% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitCreateResponseTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt index 9e3483bc..9e75a5be 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt @@ -1,20 +1,20 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects.commits import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class ProjectCommitCreateResponseTest { +class CommitCreateResponseTest { @Test - fun createProjectCommitCreateResponse() { - val projectCommitCreateResponse = - ProjectCommitCreateResponse.builder() + fun createCommitCreateResponse() { + val commitCreateResponse = + CommitCreateResponse.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( - ProjectCommitCreateResponse.Commit.builder() + CommitCreateResponse.Commit.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") .fileSize(1024L) @@ -35,7 +35,7 @@ class ProjectCommitCreateResponseTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectCommitCreateResponse.Status.QUEUED) + .status(CommitCreateResponse.Status.QUEUED) .statusMessage("Commit successfully processed.") .totalGoalCount(6L) .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -43,19 +43,18 @@ class ProjectCommitCreateResponseTest { .archived(false) .deploymentStatus("Deployed") .links( - ProjectCommitCreateResponse.Links.builder() + CommitCreateResponse.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) .build() ) .build() - assertThat(projectCommitCreateResponse).isNotNull - assertThat(projectCommitCreateResponse.id()) - .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(projectCommitCreateResponse.commit()) + assertThat(commitCreateResponse).isNotNull + assertThat(commitCreateResponse.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(commitCreateResponse.commit()) .isEqualTo( - ProjectCommitCreateResponse.Commit.builder() + CommitCreateResponse.Commit.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") .fileSize(1024L) @@ -70,30 +69,28 @@ class ProjectCommitCreateResponseTest { .gitCommitUrl("gitCommitUrl") .build() ) - assertThat(projectCommitCreateResponse.dateArchived()) + assertThat(commitCreateResponse.dateArchived()) .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectCommitCreateResponse.dateCreated()) + assertThat(commitCreateResponse.dateCreated()) .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectCommitCreateResponse.failingGoalCount()).isEqualTo(1L) - assertThat(projectCommitCreateResponse.mlModelId()) + assertThat(commitCreateResponse.failingGoalCount()).isEqualTo(1L) + assertThat(commitCreateResponse.mlModelId()) .contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(projectCommitCreateResponse.passingGoalCount()).isEqualTo(5L) - assertThat(projectCommitCreateResponse.projectId()) + assertThat(commitCreateResponse.passingGoalCount()).isEqualTo(5L) + assertThat(commitCreateResponse.projectId()) .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(projectCommitCreateResponse.status()) - .isEqualTo(ProjectCommitCreateResponse.Status.QUEUED) - assertThat(projectCommitCreateResponse.statusMessage()) - .contains("Commit successfully processed.") - assertThat(projectCommitCreateResponse.totalGoalCount()).isEqualTo(6L) - assertThat(projectCommitCreateResponse.trainingDatasetId()) + assertThat(commitCreateResponse.status()).isEqualTo(CommitCreateResponse.Status.QUEUED) + assertThat(commitCreateResponse.statusMessage()).contains("Commit successfully processed.") + assertThat(commitCreateResponse.totalGoalCount()).isEqualTo(6L) + assertThat(commitCreateResponse.trainingDatasetId()) .contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(projectCommitCreateResponse.validationDatasetId()) + assertThat(commitCreateResponse.validationDatasetId()) .contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(projectCommitCreateResponse.archived()).contains(false) - assertThat(projectCommitCreateResponse.deploymentStatus()).contains("Deployed") - assertThat(projectCommitCreateResponse.links()) + assertThat(commitCreateResponse.archived()).contains(false) + assertThat(commitCreateResponse.deploymentStatus()).contains("Deployed") + assertThat(commitCreateResponse.links()) .contains( - ProjectCommitCreateResponse.Links.builder() + CommitCreateResponse.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListParamsTest.kt similarity index 74% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListParamsTest.kt index 2f03497e..634d5133 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListParamsTest.kt @@ -1,16 +1,16 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects.commits import com.openlayer.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class ProjectCommitListParamsTest { +class CommitListParamsTest { @Test fun create() { - ProjectCommitListParams.builder() + CommitListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .page(1L) .perPage(1L) @@ -20,7 +20,7 @@ class ProjectCommitListParamsTest { @Test fun queryParams() { val params = - ProjectCommitListParams.builder() + CommitListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .page(1L) .perPage(1L) @@ -34,9 +34,7 @@ class ProjectCommitListParamsTest { @Test fun queryParamsWithoutOptionalFields() { val params = - ProjectCommitListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() + CommitListParams.builder().projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() val expected = QueryParams.builder() assertThat(params._queryParams()).isEqualTo(expected.build()) } @@ -44,9 +42,7 @@ class ProjectCommitListParamsTest { @Test fun getPathParam() { val params = - ProjectCommitListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() + CommitListParams.builder().projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() assertThat(params).isNotNull // path param "projectId" assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt similarity index 83% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt index 3a26c91d..8ba1ffeb 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt @@ -1,22 +1,22 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects.commits import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class ProjectCommitListResponseTest { +class CommitListResponseTest { @Test - fun createProjectCommitListResponse() { - val projectCommitListResponse = - ProjectCommitListResponse.builder() + fun createCommitListResponse() { + val commitListResponse = + CommitListResponse.builder() .addItem( - ProjectCommitListResponse.Item.builder() + CommitListResponse.Item.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( - ProjectCommitListResponse.Item.Commit.builder() + CommitListResponse.Item.Commit.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") .fileSize(1024L) @@ -37,7 +37,7 @@ class ProjectCommitListResponseTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectCommitListResponse.Item.Status.QUEUED) + .status(CommitListResponse.Item.Status.QUEUED) .statusMessage("Commit successfully processed.") .totalGoalCount(6L) .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -45,7 +45,7 @@ class ProjectCommitListResponseTest { .archived(false) .deploymentStatus("Deployed") .links( - ProjectCommitListResponse.Item.Links.builder() + CommitListResponse.Item.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -54,13 +54,13 @@ class ProjectCommitListResponseTest { .build() ) .build() - assertThat(projectCommitListResponse).isNotNull - assertThat(projectCommitListResponse.items()) + assertThat(commitListResponse).isNotNull + assertThat(commitListResponse.items()) .containsExactly( - ProjectCommitListResponse.Item.builder() + CommitListResponse.Item.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( - ProjectCommitListResponse.Item.Commit.builder() + CommitListResponse.Item.Commit.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") .fileSize(1024L) @@ -81,7 +81,7 @@ class ProjectCommitListResponseTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectCommitListResponse.Item.Status.QUEUED) + .status(CommitListResponse.Item.Status.QUEUED) .statusMessage("Commit successfully processed.") .totalGoalCount(6L) .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -89,7 +89,7 @@ class ProjectCommitListResponseTest { .archived(false) .deploymentStatus("Deployed") .links( - ProjectCommitListResponse.Item.Links.builder() + CommitListResponse.Item.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt similarity index 84% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt index 3821c7a5..7e7edb18 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects.inferencepipelines import java.time.LocalDate import java.time.OffsetDateTime @@ -8,11 +8,11 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class ProjectInferencePipelineCreateParamsTest { +class InferencePipelineCreateParamsTest { @Test fun create() { - ProjectInferencePipelineCreateParams.builder() + InferencePipelineCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -23,7 +23,7 @@ class ProjectInferencePipelineCreateParamsTest { .description("This pipeline is used for production.") .failingGoalCount(1L) .links( - ProjectInferencePipelineCreateParams.Links.builder() + InferencePipelineCreateParams.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -32,11 +32,11 @@ class ProjectInferencePipelineCreateParamsTest { .name("production") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineCreateParams.Status.QUEUED) + .status(InferencePipelineCreateParams.Status.QUEUED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( - ProjectInferencePipelineCreateParams.Project.builder() + InferencePipelineCreateParams.Project.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -45,7 +45,7 @@ class ProjectInferencePipelineCreateParamsTest { .goalCount(10L) .inferencePipelineCount(1L) .links( - ProjectInferencePipelineCreateParams.Project.Links.builder() + InferencePipelineCreateParams.Project.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -53,13 +53,13 @@ class ProjectInferencePipelineCreateParamsTest { ) .monitoringGoalCount(5L) .name("My Project") - .source(ProjectInferencePipelineCreateParams.Project.Source.WEB) - .taskType(ProjectInferencePipelineCreateParams.Project.TaskType.LLM_BASE) + .source(InferencePipelineCreateParams.Project.Source.WEB) + .taskType(InferencePipelineCreateParams.Project.TaskType.LLM_BASE) .versionCount(2L) .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") .gitRepo( - ProjectInferencePipelineCreateParams.Project.GitRepo.builder() + InferencePipelineCreateParams.Project.GitRepo.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -77,7 +77,7 @@ class ProjectInferencePipelineCreateParamsTest { .build() ) .workspace( - ProjectInferencePipelineCreateParams.Workspace.builder() + InferencePipelineCreateParams.Workspace.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -89,9 +89,9 @@ class ProjectInferencePipelineCreateParamsTest { .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .projectCount(0L) .slug("openlayer") - .status(ProjectInferencePipelineCreateParams.Workspace.Status.ACTIVE) + .status(InferencePipelineCreateParams.Workspace.Status.ACTIVE) .addMonthlyUsage( - ProjectInferencePipelineCreateParams.Workspace.MonthlyUsage.builder() + InferencePipelineCreateParams.Workspace.MonthlyUsage.builder() .executionTimeMs(0L) .monthYear(LocalDate.parse("2019-12-27")) .predictionCount(0L) @@ -108,7 +108,7 @@ class ProjectInferencePipelineCreateParamsTest { @Test fun body() { val params = - ProjectInferencePipelineCreateParams.builder() + InferencePipelineCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -119,7 +119,7 @@ class ProjectInferencePipelineCreateParamsTest { .description("This pipeline is used for production.") .failingGoalCount(1L) .links( - ProjectInferencePipelineCreateParams.Links.builder() + InferencePipelineCreateParams.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -128,11 +128,11 @@ class ProjectInferencePipelineCreateParamsTest { .name("production") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineCreateParams.Status.QUEUED) + .status(InferencePipelineCreateParams.Status.QUEUED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( - ProjectInferencePipelineCreateParams.Project.builder() + InferencePipelineCreateParams.Project.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -141,7 +141,7 @@ class ProjectInferencePipelineCreateParamsTest { .goalCount(10L) .inferencePipelineCount(1L) .links( - ProjectInferencePipelineCreateParams.Project.Links.builder() + InferencePipelineCreateParams.Project.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -149,13 +149,13 @@ class ProjectInferencePipelineCreateParamsTest { ) .monitoringGoalCount(5L) .name("My Project") - .source(ProjectInferencePipelineCreateParams.Project.Source.WEB) - .taskType(ProjectInferencePipelineCreateParams.Project.TaskType.LLM_BASE) + .source(InferencePipelineCreateParams.Project.Source.WEB) + .taskType(InferencePipelineCreateParams.Project.TaskType.LLM_BASE) .versionCount(2L) .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") .gitRepo( - ProjectInferencePipelineCreateParams.Project.GitRepo.builder() + InferencePipelineCreateParams.Project.GitRepo.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -173,7 +173,7 @@ class ProjectInferencePipelineCreateParamsTest { .build() ) .workspace( - ProjectInferencePipelineCreateParams.Workspace.builder() + InferencePipelineCreateParams.Workspace.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -185,9 +185,9 @@ class ProjectInferencePipelineCreateParamsTest { .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .projectCount(0L) .slug("openlayer") - .status(ProjectInferencePipelineCreateParams.Workspace.Status.ACTIVE) + .status(InferencePipelineCreateParams.Workspace.Status.ACTIVE) .addMonthlyUsage( - ProjectInferencePipelineCreateParams.Workspace.MonthlyUsage.builder() + InferencePipelineCreateParams.Workspace.MonthlyUsage.builder() .executionTimeMs(0L) .monthYear(LocalDate.parse("2019-12-27")) .predictionCount(0L) @@ -216,7 +216,7 @@ class ProjectInferencePipelineCreateParamsTest { assertThat(body.failingGoalCount()).isEqualTo(1L) assertThat(body.links()) .isEqualTo( - ProjectInferencePipelineCreateParams.Links.builder() + InferencePipelineCreateParams.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -225,12 +225,12 @@ class ProjectInferencePipelineCreateParamsTest { assertThat(body.name()).isEqualTo("production") assertThat(body.passingGoalCount()).isEqualTo(5L) assertThat(body.projectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(body.status()).isEqualTo(ProjectInferencePipelineCreateParams.Status.QUEUED) + assertThat(body.status()).isEqualTo(InferencePipelineCreateParams.Status.QUEUED) assertThat(body.statusMessage()).contains("Tests successfully evaluated") assertThat(body.totalGoalCount()).isEqualTo(6L) assertThat(body.project()) .contains( - ProjectInferencePipelineCreateParams.Project.builder() + InferencePipelineCreateParams.Project.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -239,7 +239,7 @@ class ProjectInferencePipelineCreateParamsTest { .goalCount(10L) .inferencePipelineCount(1L) .links( - ProjectInferencePipelineCreateParams.Project.Links.builder() + InferencePipelineCreateParams.Project.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -247,13 +247,13 @@ class ProjectInferencePipelineCreateParamsTest { ) .monitoringGoalCount(5L) .name("My Project") - .source(ProjectInferencePipelineCreateParams.Project.Source.WEB) - .taskType(ProjectInferencePipelineCreateParams.Project.TaskType.LLM_BASE) + .source(InferencePipelineCreateParams.Project.Source.WEB) + .taskType(InferencePipelineCreateParams.Project.TaskType.LLM_BASE) .versionCount(2L) .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") .gitRepo( - ProjectInferencePipelineCreateParams.Project.GitRepo.builder() + InferencePipelineCreateParams.Project.GitRepo.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -272,7 +272,7 @@ class ProjectInferencePipelineCreateParamsTest { ) assertThat(body.workspace()) .contains( - ProjectInferencePipelineCreateParams.Workspace.builder() + InferencePipelineCreateParams.Workspace.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -284,9 +284,9 @@ class ProjectInferencePipelineCreateParamsTest { .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .projectCount(0L) .slug("openlayer") - .status(ProjectInferencePipelineCreateParams.Workspace.Status.ACTIVE) + .status(InferencePipelineCreateParams.Workspace.Status.ACTIVE) .addMonthlyUsage( - ProjectInferencePipelineCreateParams.Workspace.MonthlyUsage.builder() + InferencePipelineCreateParams.Workspace.MonthlyUsage.builder() .executionTimeMs(0L) .monthYear(LocalDate.parse("2019-12-27")) .predictionCount(0L) @@ -302,7 +302,7 @@ class ProjectInferencePipelineCreateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = - ProjectInferencePipelineCreateParams.builder() + InferencePipelineCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -313,7 +313,7 @@ class ProjectInferencePipelineCreateParamsTest { .description("This pipeline is used for production.") .failingGoalCount(1L) .links( - ProjectInferencePipelineCreateParams.Links.builder() + InferencePipelineCreateParams.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -322,7 +322,7 @@ class ProjectInferencePipelineCreateParamsTest { .name("production") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineCreateParams.Status.QUEUED) + .status(InferencePipelineCreateParams.Status.QUEUED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .build() @@ -343,7 +343,7 @@ class ProjectInferencePipelineCreateParamsTest { assertThat(body.failingGoalCount()).isEqualTo(1L) assertThat(body.links()) .isEqualTo( - ProjectInferencePipelineCreateParams.Links.builder() + InferencePipelineCreateParams.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -352,7 +352,7 @@ class ProjectInferencePipelineCreateParamsTest { assertThat(body.name()).isEqualTo("production") assertThat(body.passingGoalCount()).isEqualTo(5L) assertThat(body.projectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(body.status()).isEqualTo(ProjectInferencePipelineCreateParams.Status.QUEUED) + assertThat(body.status()).isEqualTo(InferencePipelineCreateParams.Status.QUEUED) assertThat(body.statusMessage()).contains("Tests successfully evaluated") assertThat(body.totalGoalCount()).isEqualTo(6L) } @@ -360,7 +360,7 @@ class ProjectInferencePipelineCreateParamsTest { @Test fun getPathParam() { val params = - ProjectInferencePipelineCreateParams.builder() + InferencePipelineCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -371,7 +371,7 @@ class ProjectInferencePipelineCreateParamsTest { .description("This pipeline is used for production.") .failingGoalCount(1L) .links( - ProjectInferencePipelineCreateParams.Links.builder() + InferencePipelineCreateParams.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -380,7 +380,7 @@ class ProjectInferencePipelineCreateParamsTest { .name("production") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineCreateParams.Status.QUEUED) + .status(InferencePipelineCreateParams.Status.QUEUED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .build() diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt similarity index 71% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt index 309cd4ff..38e7509f 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt @@ -1,18 +1,18 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects.inferencepipelines import java.time.LocalDate import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class ProjectInferencePipelineCreateResponseTest { +class InferencePipelineCreateResponseTest { @Test - fun createProjectInferencePipelineCreateResponse() { - val projectInferencePipelineCreateResponse = - ProjectInferencePipelineCreateResponse.builder() + fun createInferencePipelineCreateResponse() { + val inferencePipelineCreateResponse = + InferencePipelineCreateResponse.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -22,7 +22,7 @@ class ProjectInferencePipelineCreateResponseTest { .description("This pipeline is used for production.") .failingGoalCount(1L) .links( - ProjectInferencePipelineCreateResponse.Links.builder() + InferencePipelineCreateResponse.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -31,11 +31,11 @@ class ProjectInferencePipelineCreateResponseTest { .name("production") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineCreateResponse.Status.QUEUED) + .status(InferencePipelineCreateResponse.Status.QUEUED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( - ProjectInferencePipelineCreateResponse.Project.builder() + InferencePipelineCreateResponse.Project.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -44,7 +44,7 @@ class ProjectInferencePipelineCreateResponseTest { .goalCount(10L) .inferencePipelineCount(1L) .links( - ProjectInferencePipelineCreateResponse.Project.Links.builder() + InferencePipelineCreateResponse.Project.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -52,13 +52,13 @@ class ProjectInferencePipelineCreateResponseTest { ) .monitoringGoalCount(5L) .name("My Project") - .source(ProjectInferencePipelineCreateResponse.Project.Source.WEB) - .taskType(ProjectInferencePipelineCreateResponse.Project.TaskType.LLM_BASE) + .source(InferencePipelineCreateResponse.Project.Source.WEB) + .taskType(InferencePipelineCreateResponse.Project.TaskType.LLM_BASE) .versionCount(2L) .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") .gitRepo( - ProjectInferencePipelineCreateResponse.Project.GitRepo.builder() + InferencePipelineCreateResponse.Project.GitRepo.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -76,7 +76,7 @@ class ProjectInferencePipelineCreateResponseTest { .build() ) .workspace( - ProjectInferencePipelineCreateResponse.Workspace.builder() + InferencePipelineCreateResponse.Workspace.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -88,9 +88,9 @@ class ProjectInferencePipelineCreateResponseTest { .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .projectCount(0L) .slug("openlayer") - .status(ProjectInferencePipelineCreateResponse.Workspace.Status.ACTIVE) + .status(InferencePipelineCreateResponse.Workspace.Status.ACTIVE) .addMonthlyUsage( - ProjectInferencePipelineCreateResponse.Workspace.MonthlyUsage.builder() + InferencePipelineCreateResponse.Workspace.MonthlyUsage.builder() .executionTimeMs(0L) .monthYear(LocalDate.parse("2019-12-27")) .predictionCount(0L) @@ -102,42 +102,42 @@ class ProjectInferencePipelineCreateResponseTest { ) .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .build() - assertThat(projectInferencePipelineCreateResponse).isNotNull - assertThat(projectInferencePipelineCreateResponse.id()) + assertThat(inferencePipelineCreateResponse).isNotNull + assertThat(inferencePipelineCreateResponse.id()) .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(projectInferencePipelineCreateResponse.dateCreated()) + assertThat(inferencePipelineCreateResponse.dateCreated()) .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.dateLastEvaluated()) + assertThat(inferencePipelineCreateResponse.dateLastEvaluated()) .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.dateLastSampleReceived()) + assertThat(inferencePipelineCreateResponse.dateLastSampleReceived()) .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.dateOfNextEvaluation()) + assertThat(inferencePipelineCreateResponse.dateOfNextEvaluation()) .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.dateUpdated()) + assertThat(inferencePipelineCreateResponse.dateUpdated()) .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectInferencePipelineCreateResponse.description()) + assertThat(inferencePipelineCreateResponse.description()) .contains("This pipeline is used for production.") - assertThat(projectInferencePipelineCreateResponse.failingGoalCount()).isEqualTo(1L) - assertThat(projectInferencePipelineCreateResponse.links()) + assertThat(inferencePipelineCreateResponse.failingGoalCount()).isEqualTo(1L) + assertThat(inferencePipelineCreateResponse.links()) .isEqualTo( - ProjectInferencePipelineCreateResponse.Links.builder() + InferencePipelineCreateResponse.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) .build() ) - assertThat(projectInferencePipelineCreateResponse.name()).isEqualTo("production") - assertThat(projectInferencePipelineCreateResponse.passingGoalCount()).isEqualTo(5L) - assertThat(projectInferencePipelineCreateResponse.projectId()) + assertThat(inferencePipelineCreateResponse.name()).isEqualTo("production") + assertThat(inferencePipelineCreateResponse.passingGoalCount()).isEqualTo(5L) + assertThat(inferencePipelineCreateResponse.projectId()) .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(projectInferencePipelineCreateResponse.status()) - .isEqualTo(ProjectInferencePipelineCreateResponse.Status.QUEUED) - assertThat(projectInferencePipelineCreateResponse.statusMessage()) + assertThat(inferencePipelineCreateResponse.status()) + .isEqualTo(InferencePipelineCreateResponse.Status.QUEUED) + assertThat(inferencePipelineCreateResponse.statusMessage()) .contains("Tests successfully evaluated") - assertThat(projectInferencePipelineCreateResponse.totalGoalCount()).isEqualTo(6L) - assertThat(projectInferencePipelineCreateResponse.project()) + assertThat(inferencePipelineCreateResponse.totalGoalCount()).isEqualTo(6L) + assertThat(inferencePipelineCreateResponse.project()) .contains( - ProjectInferencePipelineCreateResponse.Project.builder() + InferencePipelineCreateResponse.Project.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -146,7 +146,7 @@ class ProjectInferencePipelineCreateResponseTest { .goalCount(10L) .inferencePipelineCount(1L) .links( - ProjectInferencePipelineCreateResponse.Project.Links.builder() + InferencePipelineCreateResponse.Project.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -154,13 +154,13 @@ class ProjectInferencePipelineCreateResponseTest { ) .monitoringGoalCount(5L) .name("My Project") - .source(ProjectInferencePipelineCreateResponse.Project.Source.WEB) - .taskType(ProjectInferencePipelineCreateResponse.Project.TaskType.LLM_BASE) + .source(InferencePipelineCreateResponse.Project.Source.WEB) + .taskType(InferencePipelineCreateResponse.Project.TaskType.LLM_BASE) .versionCount(2L) .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") .gitRepo( - ProjectInferencePipelineCreateResponse.Project.GitRepo.builder() + InferencePipelineCreateResponse.Project.GitRepo.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -177,9 +177,9 @@ class ProjectInferencePipelineCreateResponseTest { ) .build() ) - assertThat(projectInferencePipelineCreateResponse.workspace()) + assertThat(inferencePipelineCreateResponse.workspace()) .contains( - ProjectInferencePipelineCreateResponse.Workspace.builder() + InferencePipelineCreateResponse.Workspace.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -191,9 +191,9 @@ class ProjectInferencePipelineCreateResponseTest { .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .projectCount(0L) .slug("openlayer") - .status(ProjectInferencePipelineCreateResponse.Workspace.Status.ACTIVE) + .status(InferencePipelineCreateResponse.Workspace.Status.ACTIVE) .addMonthlyUsage( - ProjectInferencePipelineCreateResponse.Workspace.MonthlyUsage.builder() + InferencePipelineCreateResponse.Workspace.MonthlyUsage.builder() .executionTimeMs(0L) .monthYear(LocalDate.parse("2019-12-27")) .predictionCount(0L) @@ -203,7 +203,7 @@ class ProjectInferencePipelineCreateResponseTest { .addWildcardDomain("string") .build() ) - assertThat(projectInferencePipelineCreateResponse.workspaceId()) + assertThat(inferencePipelineCreateResponse.workspaceId()) .contains("055fddb1-261f-4654-8598-f6347ee46a09") } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParamsTest.kt similarity index 83% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParamsTest.kt index 8a1b5d23..7f12713c 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParamsTest.kt @@ -1,16 +1,16 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects.inferencepipelines import com.openlayer.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class ProjectInferencePipelineListParamsTest { +class InferencePipelineListParamsTest { @Test fun create() { - ProjectInferencePipelineListParams.builder() + InferencePipelineListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .name("name") .page(1L) @@ -21,7 +21,7 @@ class ProjectInferencePipelineListParamsTest { @Test fun queryParams() { val params = - ProjectInferencePipelineListParams.builder() + InferencePipelineListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .name("name") .page(1L) @@ -37,7 +37,7 @@ class ProjectInferencePipelineListParamsTest { @Test fun queryParamsWithoutOptionalFields() { val params = - ProjectInferencePipelineListParams.builder() + InferencePipelineListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() val expected = QueryParams.builder() @@ -47,7 +47,7 @@ class ProjectInferencePipelineListParamsTest { @Test fun getPathParam() { val params = - ProjectInferencePipelineListParams.builder() + InferencePipelineListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() assertThat(params).isNotNull diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt similarity index 77% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt index bb24c8a7..8fa21074 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt @@ -1,20 +1,20 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.projects.inferencepipelines import java.time.LocalDate import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class ProjectInferencePipelineListResponseTest { +class InferencePipelineListResponseTest { @Test - fun createProjectInferencePipelineListResponse() { - val projectInferencePipelineListResponse = - ProjectInferencePipelineListResponse.builder() + fun createInferencePipelineListResponse() { + val inferencePipelineListResponse = + InferencePipelineListResponse.builder() .addItem( - ProjectInferencePipelineListResponse.Item.builder() + InferencePipelineListResponse.Item.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -24,7 +24,7 @@ class ProjectInferencePipelineListResponseTest { .description("This pipeline is used for production.") .failingGoalCount(1L) .links( - ProjectInferencePipelineListResponse.Item.Links.builder() + InferencePipelineListResponse.Item.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -33,11 +33,11 @@ class ProjectInferencePipelineListResponseTest { .name("production") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineListResponse.Item.Status.QUEUED) + .status(InferencePipelineListResponse.Item.Status.QUEUED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( - ProjectInferencePipelineListResponse.Item.Project.builder() + InferencePipelineListResponse.Item.Project.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -46,8 +46,7 @@ class ProjectInferencePipelineListResponseTest { .goalCount(10L) .inferencePipelineCount(1L) .links( - ProjectInferencePipelineListResponse.Item.Project.Links - .builder() + InferencePipelineListResponse.Item.Project.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -55,19 +54,15 @@ class ProjectInferencePipelineListResponseTest { ) .monitoringGoalCount(5L) .name("My Project") - .source( - ProjectInferencePipelineListResponse.Item.Project.Source.WEB - ) + .source(InferencePipelineListResponse.Item.Project.Source.WEB) .taskType( - ProjectInferencePipelineListResponse.Item.Project.TaskType - .LLM_BASE + InferencePipelineListResponse.Item.Project.TaskType.LLM_BASE ) .versionCount(2L) .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") .gitRepo( - ProjectInferencePipelineListResponse.Item.Project.GitRepo - .builder() + InferencePipelineListResponse.Item.Project.GitRepo.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dateConnected( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") @@ -89,7 +84,7 @@ class ProjectInferencePipelineListResponseTest { .build() ) .workspace( - ProjectInferencePipelineListResponse.Item.Workspace.builder() + InferencePipelineListResponse.Item.Workspace.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -101,12 +96,9 @@ class ProjectInferencePipelineListResponseTest { .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .projectCount(0L) .slug("openlayer") - .status( - ProjectInferencePipelineListResponse.Item.Workspace.Status - .ACTIVE - ) + .status(InferencePipelineListResponse.Item.Workspace.Status.ACTIVE) .addMonthlyUsage( - ProjectInferencePipelineListResponse.Item.Workspace.MonthlyUsage + InferencePipelineListResponse.Item.Workspace.MonthlyUsage .builder() .executionTimeMs(0L) .monthYear(LocalDate.parse("2019-12-27")) @@ -121,10 +113,10 @@ class ProjectInferencePipelineListResponseTest { .build() ) .build() - assertThat(projectInferencePipelineListResponse).isNotNull - assertThat(projectInferencePipelineListResponse.items()) + assertThat(inferencePipelineListResponse).isNotNull + assertThat(inferencePipelineListResponse.items()) .containsExactly( - ProjectInferencePipelineListResponse.Item.builder() + InferencePipelineListResponse.Item.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -134,7 +126,7 @@ class ProjectInferencePipelineListResponseTest { .description("This pipeline is used for production.") .failingGoalCount(1L) .links( - ProjectInferencePipelineListResponse.Item.Links.builder() + InferencePipelineListResponse.Item.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -143,11 +135,11 @@ class ProjectInferencePipelineListResponseTest { .name("production") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineListResponse.Item.Status.QUEUED) + .status(InferencePipelineListResponse.Item.Status.QUEUED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( - ProjectInferencePipelineListResponse.Item.Project.builder() + InferencePipelineListResponse.Item.Project.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -156,7 +148,7 @@ class ProjectInferencePipelineListResponseTest { .goalCount(10L) .inferencePipelineCount(1L) .links( - ProjectInferencePipelineListResponse.Item.Project.Links.builder() + InferencePipelineListResponse.Item.Project.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -164,15 +156,13 @@ class ProjectInferencePipelineListResponseTest { ) .monitoringGoalCount(5L) .name("My Project") - .source(ProjectInferencePipelineListResponse.Item.Project.Source.WEB) - .taskType( - ProjectInferencePipelineListResponse.Item.Project.TaskType.LLM_BASE - ) + .source(InferencePipelineListResponse.Item.Project.Source.WEB) + .taskType(InferencePipelineListResponse.Item.Project.TaskType.LLM_BASE) .versionCount(2L) .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") .gitRepo( - ProjectInferencePipelineListResponse.Item.Project.GitRepo.builder() + InferencePipelineListResponse.Item.Project.GitRepo.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -190,7 +180,7 @@ class ProjectInferencePipelineListResponseTest { .build() ) .workspace( - ProjectInferencePipelineListResponse.Item.Workspace.builder() + InferencePipelineListResponse.Item.Workspace.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -202,12 +192,9 @@ class ProjectInferencePipelineListResponseTest { .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .projectCount(0L) .slug("openlayer") - .status( - ProjectInferencePipelineListResponse.Item.Workspace.Status.ACTIVE - ) + .status(InferencePipelineListResponse.Item.Workspace.Status.ACTIVE) .addMonthlyUsage( - ProjectInferencePipelineListResponse.Item.Workspace.MonthlyUsage - .builder() + InferencePipelineListResponse.Item.Workspace.MonthlyUsage.builder() .executionTimeMs(0L) .monthYear(LocalDate.parse("2019-12-27")) .predictionCount(0L) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParamsTest.kt similarity index 65% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParamsTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParamsTest.kt index 8b212850..fac4f9ff 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParamsTest.kt @@ -1,21 +1,21 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.models +package com.openlayer.api.models.storage.presignedurl import com.openlayer.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class StoragePresignedUrlCreateParamsTest { +class PresignedUrlCreateParamsTest { @Test fun create() { - StoragePresignedUrlCreateParams.builder().objectName("objectName").build() + PresignedUrlCreateParams.builder().objectName("objectName").build() } @Test fun queryParams() { - val params = StoragePresignedUrlCreateParams.builder().objectName("objectName").build() + val params = PresignedUrlCreateParams.builder().objectName("objectName").build() val expected = QueryParams.builder() expected.put("objectName", "objectName") assertThat(params._queryParams()).isEqualTo(expected.build()) @@ -23,7 +23,7 @@ class StoragePresignedUrlCreateParamsTest { @Test fun queryParamsWithoutOptionalFields() { - val params = StoragePresignedUrlCreateParams.builder().objectName("objectName").build() + val params = PresignedUrlCreateParams.builder().objectName("objectName").build() val expected = QueryParams.builder() expected.put("objectName", "objectName") assertThat(params._queryParams()).isEqualTo(expected.build()) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponseTest.kt new file mode 100644 index 00000000..f062a9e9 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponseTest.kt @@ -0,0 +1,25 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.storage.presignedurl + +import com.openlayer.api.core.JsonValue +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class PresignedUrlCreateResponseTest { + + @Test + fun createPresignedUrlCreateResponse() { + val presignedUrlCreateResponse = + PresignedUrlCreateResponse.builder() + .storageUri("storageUri") + .url("url") + .fields(JsonValue.from(mapOf())) + .build() + assertThat(presignedUrlCreateResponse).isNotNull + assertThat(presignedUrlCreateResponse.storageUri()).isEqualTo("storageUri") + assertThat(presignedUrlCreateResponse.url()).isEqualTo("url") + assertThat(presignedUrlCreateResponse._fields()) + .isEqualTo(JsonValue.from(mapOf())) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt index ebf9f15a..a04cb4db 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt @@ -23,7 +23,7 @@ import com.openlayer.api.errors.RateLimitException import com.openlayer.api.errors.UnauthorizedException import com.openlayer.api.errors.UnexpectedStatusCodeException import com.openlayer.api.errors.UnprocessableEntityException -import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.inferencepipelines.data.DataStreamParams import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.entry import org.junit.jupiter.api.BeforeEach @@ -71,10 +71,10 @@ class ErrorHandlingTest { val e = assertThrows { dataService.stream( - InferencePipelineDataStreamParams.builder() + DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() + DataStreamParams.Config.LlmData.builder() .outputColumnName("output") .contextColumnName("context") .costColumnName("cost") @@ -85,8 +85,7 @@ class ErrorHandlingTest { .metadata(JsonValue.from(mapOf())) .numOfTokenColumnName("tokens") .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() + DataStreamParams.Config.LlmData.Prompt.builder() .content("{{ user_query }}") .role("user") .build() @@ -96,7 +95,7 @@ class ErrorHandlingTest { .build() ) .addRow( - InferencePipelineDataStreamParams.Row.builder() + DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) .putAdditionalProperty("tokens", JsonValue.from("bar")) @@ -124,10 +123,10 @@ class ErrorHandlingTest { val e = assertThrows { dataService.stream( - InferencePipelineDataStreamParams.builder() + DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() + DataStreamParams.Config.LlmData.builder() .outputColumnName("output") .contextColumnName("context") .costColumnName("cost") @@ -138,8 +137,7 @@ class ErrorHandlingTest { .metadata(JsonValue.from(mapOf())) .numOfTokenColumnName("tokens") .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() + DataStreamParams.Config.LlmData.Prompt.builder() .content("{{ user_query }}") .role("user") .build() @@ -149,7 +147,7 @@ class ErrorHandlingTest { .build() ) .addRow( - InferencePipelineDataStreamParams.Row.builder() + DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) .putAdditionalProperty("tokens", JsonValue.from("bar")) @@ -177,10 +175,10 @@ class ErrorHandlingTest { val e = assertThrows { dataService.stream( - InferencePipelineDataStreamParams.builder() + DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() + DataStreamParams.Config.LlmData.builder() .outputColumnName("output") .contextColumnName("context") .costColumnName("cost") @@ -191,8 +189,7 @@ class ErrorHandlingTest { .metadata(JsonValue.from(mapOf())) .numOfTokenColumnName("tokens") .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() + DataStreamParams.Config.LlmData.Prompt.builder() .content("{{ user_query }}") .role("user") .build() @@ -202,7 +199,7 @@ class ErrorHandlingTest { .build() ) .addRow( - InferencePipelineDataStreamParams.Row.builder() + DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) .putAdditionalProperty("tokens", JsonValue.from("bar")) @@ -230,10 +227,10 @@ class ErrorHandlingTest { val e = assertThrows { dataService.stream( - InferencePipelineDataStreamParams.builder() + DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() + DataStreamParams.Config.LlmData.builder() .outputColumnName("output") .contextColumnName("context") .costColumnName("cost") @@ -244,8 +241,7 @@ class ErrorHandlingTest { .metadata(JsonValue.from(mapOf())) .numOfTokenColumnName("tokens") .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() + DataStreamParams.Config.LlmData.Prompt.builder() .content("{{ user_query }}") .role("user") .build() @@ -255,7 +251,7 @@ class ErrorHandlingTest { .build() ) .addRow( - InferencePipelineDataStreamParams.Row.builder() + DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) .putAdditionalProperty("tokens", JsonValue.from("bar")) @@ -283,10 +279,10 @@ class ErrorHandlingTest { val e = assertThrows { dataService.stream( - InferencePipelineDataStreamParams.builder() + DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() + DataStreamParams.Config.LlmData.builder() .outputColumnName("output") .contextColumnName("context") .costColumnName("cost") @@ -297,8 +293,7 @@ class ErrorHandlingTest { .metadata(JsonValue.from(mapOf())) .numOfTokenColumnName("tokens") .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() + DataStreamParams.Config.LlmData.Prompt.builder() .content("{{ user_query }}") .role("user") .build() @@ -308,7 +303,7 @@ class ErrorHandlingTest { .build() ) .addRow( - InferencePipelineDataStreamParams.Row.builder() + DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) .putAdditionalProperty("tokens", JsonValue.from("bar")) @@ -336,10 +331,10 @@ class ErrorHandlingTest { val e = assertThrows { dataService.stream( - InferencePipelineDataStreamParams.builder() + DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() + DataStreamParams.Config.LlmData.builder() .outputColumnName("output") .contextColumnName("context") .costColumnName("cost") @@ -350,8 +345,7 @@ class ErrorHandlingTest { .metadata(JsonValue.from(mapOf())) .numOfTokenColumnName("tokens") .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() + DataStreamParams.Config.LlmData.Prompt.builder() .content("{{ user_query }}") .role("user") .build() @@ -361,7 +355,7 @@ class ErrorHandlingTest { .build() ) .addRow( - InferencePipelineDataStreamParams.Row.builder() + DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) .putAdditionalProperty("tokens", JsonValue.from("bar")) @@ -389,10 +383,10 @@ class ErrorHandlingTest { val e = assertThrows { dataService.stream( - InferencePipelineDataStreamParams.builder() + DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() + DataStreamParams.Config.LlmData.builder() .outputColumnName("output") .contextColumnName("context") .costColumnName("cost") @@ -403,8 +397,7 @@ class ErrorHandlingTest { .metadata(JsonValue.from(mapOf())) .numOfTokenColumnName("tokens") .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() + DataStreamParams.Config.LlmData.Prompt.builder() .content("{{ user_query }}") .role("user") .build() @@ -414,7 +407,7 @@ class ErrorHandlingTest { .build() ) .addRow( - InferencePipelineDataStreamParams.Row.builder() + DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) .putAdditionalProperty("tokens", JsonValue.from("bar")) @@ -442,10 +435,10 @@ class ErrorHandlingTest { val e = assertThrows { dataService.stream( - InferencePipelineDataStreamParams.builder() + DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() + DataStreamParams.Config.LlmData.builder() .outputColumnName("output") .contextColumnName("context") .costColumnName("cost") @@ -456,8 +449,7 @@ class ErrorHandlingTest { .metadata(JsonValue.from(mapOf())) .numOfTokenColumnName("tokens") .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() + DataStreamParams.Config.LlmData.Prompt.builder() .content("{{ user_query }}") .role("user") .build() @@ -467,7 +459,7 @@ class ErrorHandlingTest { .build() ) .addRow( - InferencePipelineDataStreamParams.Row.builder() + DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) .putAdditionalProperty("tokens", JsonValue.from("bar")) @@ -495,10 +487,10 @@ class ErrorHandlingTest { val e = assertThrows { dataService.stream( - InferencePipelineDataStreamParams.builder() + DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() + DataStreamParams.Config.LlmData.builder() .outputColumnName("output") .contextColumnName("context") .costColumnName("cost") @@ -509,8 +501,7 @@ class ErrorHandlingTest { .metadata(JsonValue.from(mapOf())) .numOfTokenColumnName("tokens") .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt - .builder() + DataStreamParams.Config.LlmData.Prompt.builder() .content("{{ user_query }}") .role("user") .build() @@ -520,7 +511,7 @@ class ErrorHandlingTest { .build() ) .addRow( - InferencePipelineDataStreamParams.Row.builder() + DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) .putAdditionalProperty("tokens", JsonValue.from("bar")) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt index 3b817ef5..28d1a606 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt @@ -15,7 +15,7 @@ import com.github.tomakehurst.wiremock.junit5.WireMockTest import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.inferencepipelines.data.DataStreamParams import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test @@ -39,10 +39,10 @@ internal class ServiceParamsTest { stubFor(post(anyUrl()).willReturn(ok("{}"))) dataService.stream( - InferencePipelineDataStreamParams.builder() + DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() + DataStreamParams.Config.LlmData.builder() .outputColumnName("output") .contextColumnName("context") .costColumnName("cost") @@ -53,7 +53,7 @@ internal class ServiceParamsTest { .metadata(JsonValue.from(mapOf())) .numOfTokenColumnName("tokens") .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + DataStreamParams.Config.LlmData.Prompt.builder() .content("{{ user_query }}") .role("user") .build() @@ -63,7 +63,7 @@ internal class ServiceParamsTest { .build() ) .addRow( - InferencePipelineDataStreamParams.Row.builder() + DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) .putAdditionalProperty("tokens", JsonValue.from("bar")) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/CommitServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/CommitServiceAsyncTest.kt index c2e20b61..dade0f9d 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/CommitServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/CommitServiceAsyncTest.kt @@ -4,7 +4,7 @@ package com.openlayer.api.services.async import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync -import com.openlayer.api.models.CommitRetrieveParams +import com.openlayer.api.models.commits.CommitRetrieveParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncTest.kt index 16fa15ac..c1fce262 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncTest.kt @@ -4,9 +4,9 @@ package com.openlayer.api.services.async import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync -import com.openlayer.api.models.InferencePipelineDeleteParams -import com.openlayer.api.models.InferencePipelineRetrieveParams -import com.openlayer.api.models.InferencePipelineUpdateParams +import com.openlayer.api.models.inferencepipelines.InferencePipelineDeleteParams +import com.openlayer.api.models.inferencepipelines.InferencePipelineRetrieveParams +import com.openlayer.api.models.inferencepipelines.InferencePipelineUpdateParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncTest.kt index f796c2c0..c63b6596 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncTest.kt @@ -4,8 +4,8 @@ package com.openlayer.api.services.async import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync -import com.openlayer.api.models.ProjectCreateParams -import com.openlayer.api.models.ProjectListParams +import com.openlayer.api.models.projects.ProjectCreateParams +import com.openlayer.api.models.projects.ProjectListParams import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt index d40b3c3e..b9d12301 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt @@ -4,7 +4,7 @@ package com.openlayer.api.services.async.commits import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync -import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.commits.testresults.TestResultListParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -22,13 +22,13 @@ class TestResultServiceAsyncTest { val testResultFuture = testResultServiceAsync.list( - CommitTestResultListParams.builder() + TestResultListParams.builder() .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .includeArchived(true) .page(1L) .perPage(1L) - .status(CommitTestResultListParams.Status.RUNNING) - .type(CommitTestResultListParams.Type.INTEGRITY) + .status(TestResultListParams.Status.RUNNING) + .type(TestResultListParams.Type.INTEGRITY) .build() ) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsyncTest.kt similarity index 84% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsyncTest.kt index 6c949cfa..8062d7a3 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsyncTest.kt @@ -1,11 +1,11 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.services.async.inferencePipelines +package com.openlayer.api.services.async.inferencepipelines import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.inferencepipelines.data.DataStreamParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -23,10 +23,10 @@ class DataServiceAsyncTest { val responseFuture = dataServiceAsync.stream( - InferencePipelineDataStreamParams.builder() + DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() + DataStreamParams.Config.LlmData.builder() .outputColumnName("output") .contextColumnName("context") .costColumnName("cost") @@ -37,7 +37,7 @@ class DataServiceAsyncTest { .metadata(JsonValue.from(mapOf())) .numOfTokenColumnName("tokens") .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + DataStreamParams.Config.LlmData.Prompt.builder() .content("{{ user_query }}") .role("user") .build() @@ -47,7 +47,7 @@ class DataServiceAsyncTest { .build() ) .addRow( - InferencePipelineDataStreamParams.Row.builder() + DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) .putAdditionalProperty("tokens", JsonValue.from("bar")) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsyncTest.kt similarity index 83% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsyncTest.kt index 4da1d56d..cb6b7894 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsyncTest.kt @@ -1,11 +1,11 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.services.async.inferencePipelines +package com.openlayer.api.services.async.inferencepipelines import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.InferencePipelineRowUpdateParams +import com.openlayer.api.models.inferencepipelines.rows.RowUpdateParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -23,12 +23,12 @@ class RowServiceAsyncTest { val rowFuture = rowServiceAsync.update( - InferencePipelineRowUpdateParams.builder() + RowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .inferenceId("inferenceId") .row(JsonValue.from(mapOf())) .config( - InferencePipelineRowUpdateParams.Config.builder() + RowUpdateParams.Config.builder() .groundTruthColumnName("ground_truth") .humanFeedbackColumnName("human_feedback") .latencyColumnName("latency") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncTest.kt similarity index 73% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncTest.kt index 6cd49817..fa3abb77 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncTest.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.services.async.inferencePipelines +package com.openlayer.api.services.async.inferencepipelines import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync -import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.inferencepipelines.testresults.TestResultListParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -22,12 +22,12 @@ class TestResultServiceAsyncTest { val testResultFuture = testResultServiceAsync.list( - InferencePipelineTestResultListParams.builder() + TestResultListParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .page(1L) .perPage(1L) - .status(InferencePipelineTestResultListParams.Status.RUNNING) - .type(InferencePipelineTestResultListParams.Type.INTEGRITY) + .status(TestResultListParams.Status.RUNNING) + .type(TestResultListParams.Type.INTEGRITY) .build() ) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt index 09172768..a5be2c6d 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt @@ -4,8 +4,8 @@ package com.openlayer.api.services.async.projects import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync -import com.openlayer.api.models.ProjectCommitCreateParams -import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.projects.commits.CommitCreateParams +import com.openlayer.api.models.projects.commits.CommitListParams import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -24,11 +24,11 @@ class CommitServiceAsyncTest { val commitFuture = commitServiceAsync.create( - ProjectCommitCreateParams.builder() + CommitCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( - ProjectCommitCreateParams.Commit.builder() + CommitCreateParams.Commit.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") .fileSize(1024L) @@ -49,7 +49,7 @@ class CommitServiceAsyncTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectCommitCreateParams.Status.QUEUED) + .status(CommitCreateParams.Status.QUEUED) .statusMessage("Commit successfully processed.") .storageUri("s3://...") .totalGoalCount(6L) @@ -58,7 +58,7 @@ class CommitServiceAsyncTest { .archived(false) .deploymentStatus("Deployed") .links( - ProjectCommitCreateParams.Links.builder() + CommitCreateParams.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -82,7 +82,7 @@ class CommitServiceAsyncTest { val commitFuture = commitServiceAsync.list( - ProjectCommitListParams.builder() + CommitListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .page(1L) .perPage(1L) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt index 99ca1060..d23f1d0f 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt @@ -4,8 +4,8 @@ package com.openlayer.api.services.async.projects import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync -import com.openlayer.api.models.ProjectInferencePipelineCreateParams -import com.openlayer.api.models.ProjectInferencePipelineListParams +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineCreateParams +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineListParams import java.time.LocalDate import java.time.OffsetDateTime import org.junit.jupiter.api.Test @@ -25,7 +25,7 @@ class InferencePipelineServiceAsyncTest { val inferencePipelineFuture = inferencePipelineServiceAsync.create( - ProjectInferencePipelineCreateParams.builder() + InferencePipelineCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -36,7 +36,7 @@ class InferencePipelineServiceAsyncTest { .description("This pipeline is used for production.") .failingGoalCount(1L) .links( - ProjectInferencePipelineCreateParams.Links.builder() + InferencePipelineCreateParams.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -45,11 +45,11 @@ class InferencePipelineServiceAsyncTest { .name("production") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineCreateParams.Status.QUEUED) + .status(InferencePipelineCreateParams.Status.QUEUED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( - ProjectInferencePipelineCreateParams.Project.builder() + InferencePipelineCreateParams.Project.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -58,7 +58,7 @@ class InferencePipelineServiceAsyncTest { .goalCount(10L) .inferencePipelineCount(1L) .links( - ProjectInferencePipelineCreateParams.Project.Links.builder() + InferencePipelineCreateParams.Project.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -66,15 +66,13 @@ class InferencePipelineServiceAsyncTest { ) .monitoringGoalCount(5L) .name("My Project") - .source(ProjectInferencePipelineCreateParams.Project.Source.WEB) - .taskType( - ProjectInferencePipelineCreateParams.Project.TaskType.LLM_BASE - ) + .source(InferencePipelineCreateParams.Project.Source.WEB) + .taskType(InferencePipelineCreateParams.Project.TaskType.LLM_BASE) .versionCount(2L) .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") .gitRepo( - ProjectInferencePipelineCreateParams.Project.GitRepo.builder() + InferencePipelineCreateParams.Project.GitRepo.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -92,7 +90,7 @@ class InferencePipelineServiceAsyncTest { .build() ) .workspace( - ProjectInferencePipelineCreateParams.Workspace.builder() + InferencePipelineCreateParams.Workspace.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -104,10 +102,9 @@ class InferencePipelineServiceAsyncTest { .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .projectCount(0L) .slug("openlayer") - .status(ProjectInferencePipelineCreateParams.Workspace.Status.ACTIVE) + .status(InferencePipelineCreateParams.Workspace.Status.ACTIVE) .addMonthlyUsage( - ProjectInferencePipelineCreateParams.Workspace.MonthlyUsage - .builder() + InferencePipelineCreateParams.Workspace.MonthlyUsage.builder() .executionTimeMs(0L) .monthYear(LocalDate.parse("2019-12-27")) .predictionCount(0L) @@ -136,7 +133,7 @@ class InferencePipelineServiceAsyncTest { val inferencePipelineFuture = inferencePipelineServiceAsync.list( - ProjectInferencePipelineListParams.builder() + InferencePipelineListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .name("name") .page(1L) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncTest.kt index e05b3955..c8ffdc74 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncTest.kt @@ -4,7 +4,7 @@ package com.openlayer.api.services.async.storage import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync -import com.openlayer.api.models.StoragePresignedUrlCreateParams +import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -22,7 +22,7 @@ class PresignedUrlServiceAsyncTest { val presignedUrlFuture = presignedUrlServiceAsync.create( - StoragePresignedUrlCreateParams.builder().objectName("objectName").build() + PresignedUrlCreateParams.builder().objectName("objectName").build() ) val presignedUrl = presignedUrlFuture.get() diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt index ed876dd9..0d98e9d6 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt @@ -4,7 +4,7 @@ package com.openlayer.api.services.blocking import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.models.CommitRetrieveParams +import com.openlayer.api.models.commits.CommitRetrieveParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt index 5bc78f55..6b168a1a 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt @@ -4,9 +4,9 @@ package com.openlayer.api.services.blocking import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.models.InferencePipelineDeleteParams -import com.openlayer.api.models.InferencePipelineRetrieveParams -import com.openlayer.api.models.InferencePipelineUpdateParams +import com.openlayer.api.models.inferencepipelines.InferencePipelineDeleteParams +import com.openlayer.api.models.inferencepipelines.InferencePipelineRetrieveParams +import com.openlayer.api.models.inferencepipelines.InferencePipelineUpdateParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt index 26399d17..a5342433 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt @@ -4,8 +4,8 @@ package com.openlayer.api.services.blocking import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.models.ProjectCreateParams -import com.openlayer.api.models.ProjectListParams +import com.openlayer.api.models.projects.ProjectCreateParams +import com.openlayer.api.models.projects.ProjectListParams import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt index bcdc37b8..75435126 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt @@ -4,7 +4,7 @@ package com.openlayer.api.services.blocking.commits import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.commits.testresults.TestResultListParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -22,13 +22,13 @@ class TestResultServiceTest { val testResult = testResultService.list( - CommitTestResultListParams.builder() + TestResultListParams.builder() .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .includeArchived(true) .page(1L) .perPage(1L) - .status(CommitTestResultListParams.Status.RUNNING) - .type(CommitTestResultListParams.Type.INTEGRITY) + .status(TestResultListParams.Status.RUNNING) + .type(TestResultListParams.Type.INTEGRITY) .build() ) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataServiceTest.kt similarity index 84% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataServiceTest.kt index e0e48a38..a8762af1 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataServiceTest.kt @@ -1,11 +1,11 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.services.blocking.inferencePipelines +package com.openlayer.api.services.blocking.inferencepipelines import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.inferencepipelines.data.DataStreamParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -23,10 +23,10 @@ class DataServiceTest { val response = dataService.stream( - InferencePipelineDataStreamParams.builder() + DataStreamParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config( - InferencePipelineDataStreamParams.Config.LlmData.builder() + DataStreamParams.Config.LlmData.builder() .outputColumnName("output") .contextColumnName("context") .costColumnName("cost") @@ -37,7 +37,7 @@ class DataServiceTest { .metadata(JsonValue.from(mapOf())) .numOfTokenColumnName("tokens") .addPrompt( - InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + DataStreamParams.Config.LlmData.Prompt.builder() .content("{{ user_query }}") .role("user") .build() @@ -47,7 +47,7 @@ class DataServiceTest { .build() ) .addRow( - InferencePipelineDataStreamParams.Row.builder() + DataStreamParams.Row.builder() .putAdditionalProperty("user_query", JsonValue.from("bar")) .putAdditionalProperty("output", JsonValue.from("bar")) .putAdditionalProperty("tokens", JsonValue.from("bar")) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowServiceTest.kt similarity index 83% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowServiceTest.kt index 221221e3..9b43392b 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowServiceTest.kt @@ -1,11 +1,11 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.services.blocking.inferencePipelines +package com.openlayer.api.services.blocking.inferencepipelines import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.InferencePipelineRowUpdateParams +import com.openlayer.api.models.inferencepipelines.rows.RowUpdateParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -23,12 +23,12 @@ class RowServiceTest { val row = rowService.update( - InferencePipelineRowUpdateParams.builder() + RowUpdateParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .inferenceId("inferenceId") .row(JsonValue.from(mapOf())) .config( - InferencePipelineRowUpdateParams.Config.builder() + RowUpdateParams.Config.builder() .groundTruthColumnName("ground_truth") .humanFeedbackColumnName("human_feedback") .latencyColumnName("latency") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceTest.kt similarity index 71% rename from openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceTest.kt rename to openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceTest.kt index 05acf486..2be47030 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceTest.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -package com.openlayer.api.services.blocking.inferencePipelines +package com.openlayer.api.services.blocking.inferencepipelines import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.inferencepipelines.testresults.TestResultListParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -22,12 +22,12 @@ class TestResultServiceTest { val testResult = testResultService.list( - InferencePipelineTestResultListParams.builder() + TestResultListParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .page(1L) .perPage(1L) - .status(InferencePipelineTestResultListParams.Status.RUNNING) - .type(InferencePipelineTestResultListParams.Type.INTEGRITY) + .status(TestResultListParams.Status.RUNNING) + .type(TestResultListParams.Type.INTEGRITY) .build() ) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt index 34211f99..e94a74c2 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt @@ -4,8 +4,8 @@ package com.openlayer.api.services.blocking.projects import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.models.ProjectCommitCreateParams -import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.projects.commits.CommitCreateParams +import com.openlayer.api.models.projects.commits.CommitListParams import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -24,11 +24,11 @@ class CommitServiceTest { val commit = commitService.create( - ProjectCommitCreateParams.builder() + CommitCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( - ProjectCommitCreateParams.Commit.builder() + CommitCreateParams.Commit.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") .fileSize(1024L) @@ -49,7 +49,7 @@ class CommitServiceTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectCommitCreateParams.Status.QUEUED) + .status(CommitCreateParams.Status.QUEUED) .statusMessage("Commit successfully processed.") .storageUri("s3://...") .totalGoalCount(6L) @@ -58,7 +58,7 @@ class CommitServiceTest { .archived(false) .deploymentStatus("Deployed") .links( - ProjectCommitCreateParams.Links.builder() + CommitCreateParams.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -81,7 +81,7 @@ class CommitServiceTest { val commit = commitService.list( - ProjectCommitListParams.builder() + CommitListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .page(1L) .perPage(1L) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt index b1a86009..56d21e5a 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt @@ -4,8 +4,8 @@ package com.openlayer.api.services.blocking.projects import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.models.ProjectInferencePipelineCreateParams -import com.openlayer.api.models.ProjectInferencePipelineListParams +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineCreateParams +import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineListParams import java.time.LocalDate import java.time.OffsetDateTime import org.junit.jupiter.api.Test @@ -25,7 +25,7 @@ class InferencePipelineServiceTest { val inferencePipeline = inferencePipelineService.create( - ProjectInferencePipelineCreateParams.builder() + InferencePipelineCreateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -36,7 +36,7 @@ class InferencePipelineServiceTest { .description("This pipeline is used for production.") .failingGoalCount(1L) .links( - ProjectInferencePipelineCreateParams.Links.builder() + InferencePipelineCreateParams.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -45,11 +45,11 @@ class InferencePipelineServiceTest { .name("production") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(ProjectInferencePipelineCreateParams.Status.QUEUED) + .status(InferencePipelineCreateParams.Status.QUEUED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( - ProjectInferencePipelineCreateParams.Project.builder() + InferencePipelineCreateParams.Project.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -58,7 +58,7 @@ class InferencePipelineServiceTest { .goalCount(10L) .inferencePipelineCount(1L) .links( - ProjectInferencePipelineCreateParams.Project.Links.builder() + InferencePipelineCreateParams.Project.Links.builder() .app( "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" ) @@ -66,15 +66,13 @@ class InferencePipelineServiceTest { ) .monitoringGoalCount(5L) .name("My Project") - .source(ProjectInferencePipelineCreateParams.Project.Source.WEB) - .taskType( - ProjectInferencePipelineCreateParams.Project.TaskType.LLM_BASE - ) + .source(InferencePipelineCreateParams.Project.Source.WEB) + .taskType(InferencePipelineCreateParams.Project.TaskType.LLM_BASE) .versionCount(2L) .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .description("My project description.") .gitRepo( - ProjectInferencePipelineCreateParams.Project.GitRepo.builder() + InferencePipelineCreateParams.Project.GitRepo.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -92,7 +90,7 @@ class InferencePipelineServiceTest { .build() ) .workspace( - ProjectInferencePipelineCreateParams.Workspace.builder() + InferencePipelineCreateParams.Workspace.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -104,10 +102,9 @@ class InferencePipelineServiceTest { .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .projectCount(0L) .slug("openlayer") - .status(ProjectInferencePipelineCreateParams.Workspace.Status.ACTIVE) + .status(InferencePipelineCreateParams.Workspace.Status.ACTIVE) .addMonthlyUsage( - ProjectInferencePipelineCreateParams.Workspace.MonthlyUsage - .builder() + InferencePipelineCreateParams.Workspace.MonthlyUsage.builder() .executionTimeMs(0L) .monthYear(LocalDate.parse("2019-12-27")) .predictionCount(0L) @@ -135,7 +132,7 @@ class InferencePipelineServiceTest { val inferencePipeline = inferencePipelineService.list( - ProjectInferencePipelineListParams.builder() + InferencePipelineListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .name("name") .page(1L) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt index 09338d14..33d211f8 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt @@ -4,7 +4,7 @@ package com.openlayer.api.services.blocking.storage import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.models.StoragePresignedUrlCreateParams +import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -22,7 +22,7 @@ class PresignedUrlServiceTest { val presignedUrl = presignedUrlService.create( - StoragePresignedUrlCreateParams.builder().objectName("objectName").build() + PresignedUrlCreateParams.builder().objectName("objectName").build() ) presignedUrl.validate() From 9eba32cbaa34b9c97ac7efd81533066229470ea5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 14 Mar 2025 06:40:15 +0000 Subject: [PATCH 16/74] chore(internal): remove extra empty newlines (#81) --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e2883ca..e20299a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,5 +31,3 @@ jobs: - name: Run lints run: ./scripts/lint - - From 54e8c738a650f838cdc25c71ad355c17b6b23867 Mon Sep 17 00:00:00 2001 From: meorphis Date: Fri, 14 Mar 2025 10:46:57 -0400 Subject: [PATCH 17/74] chore(internal): remove workflow --- .../handle-release-pr-title-edit.yml | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 .github/workflows/handle-release-pr-title-edit.yml diff --git a/.github/workflows/handle-release-pr-title-edit.yml b/.github/workflows/handle-release-pr-title-edit.yml deleted file mode 100644 index ac2a6802..00000000 --- a/.github/workflows/handle-release-pr-title-edit.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Handle release PR title edits -on: - pull_request: - types: - - edited - - unlabeled - -jobs: - update_pr_content: - name: Update pull request content - if: | - ((github.event.action == 'edited' && github.event.changes.title.from != github.event.pull_request.title) || - (github.event.action == 'unlabeled' && github.event.label.name == 'autorelease: custom version')) && - startsWith(github.event.pull_request.head.ref, 'release-please--') && - github.event.pull_request.state == 'open' && - github.event.sender.login != 'stainless-bot' && - github.event.sender.login != 'stainless-app' && - github.repository == 'openlayer-ai/openlayer-java' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: stainless-api/trigger-release-please@v1 - with: - repo: ${{ github.event.repository.full_name }} - stainless-api-key: ${{ secrets.STAINLESS_API_KEY }} From 687dd630eed0499e0b786c0df214c8671ae43402 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 15 Mar 2025 04:52:22 +0000 Subject: [PATCH 18/74] docs: deduplicate and refine comments (#84) --- .../client/okhttp/OpenlayerOkHttpClient.kt | 1 + .../okhttp/OpenlayerOkHttpClientAsync.kt | 1 + .../com/openlayer/api/core/ClientOptions.kt | 1 + .../kotlin/com/openlayer/api/core/Timeout.kt | 35 +- .../models/commits/CommitRetrieveResponse.kt | 659 ++++++- .../testresults/TestResultListParams.kt | 34 +- .../testresults/TestResultListResponse.kt | 876 ++++++-- .../InferencePipelineRetrieveParams.kt | 8 +- .../InferencePipelineRetrieveResponse.kt | 1371 +++++++++++-- .../InferencePipelineUpdateParams.kt | 127 +- .../InferencePipelineUpdateResponse.kt | 1371 +++++++++++-- .../data/DataStreamParams.kt | 876 ++++++-- .../data/DataStreamResponse.kt | 15 + .../rows/RowUpdateParams.kt | 154 +- .../rows/RowUpdateResponse.kt | 15 + .../testresults/TestResultListParams.kt | 26 +- .../testresults/TestResultListResponse.kt | 876 ++++++-- .../models/projects/ProjectCreateParams.kt | 891 ++++++++- .../models/projects/ProjectCreateResponse.kt | 547 ++++- .../api/models/projects/ProjectListParams.kt | 20 +- .../models/projects/ProjectListResponse.kt | 589 +++++- .../projects/commits/CommitCreateParams.kt | 1036 ++++++++-- .../projects/commits/CommitCreateResponse.kt | 659 ++++++- .../projects/commits/CommitListParams.kt | 16 +- .../projects/commits/CommitListResponse.kt | 701 ++++++- .../InferencePipelineCreateParams.kt | 1757 +++++++++++++++-- .../InferencePipelineCreateResponse.kt | 1371 +++++++++++-- .../InferencePipelineListParams.kt | 18 +- .../InferencePipelineListResponse.kt | 1439 ++++++++++++-- .../PresignedUrlCreateResponse.kt | 42 +- 30 files changed, 13595 insertions(+), 1937 deletions(-) diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt index a8e78d19..f322838c 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt @@ -146,6 +146,7 @@ class OpenlayerOkHttpClient private constructor() { fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) } + /** Alias for calling [Builder.apiKey] with `apiKey.orElse(null)`. */ fun apiKey(apiKey: Optional) = apiKey(apiKey.getOrNull()) fun fromEnv() = apply { clientOptions.fromEnv() } diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt index d41b82f7..9118c3b6 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt @@ -148,6 +148,7 @@ class OpenlayerOkHttpClientAsync private constructor() { fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) } + /** Alias for calling [Builder.apiKey] with `apiKey.orElse(null)`. */ fun apiKey(apiKey: Optional) = apiKey(apiKey.getOrNull()) fun fromEnv() = apply { clientOptions.fromEnv() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt index 1606933d..b22b2b18 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt @@ -94,6 +94,7 @@ private constructor( fun apiKey(apiKey: String?) = apply { this.apiKey = apiKey } + /** Alias for calling [Builder.apiKey] with `apiKey.orElse(null)`. */ fun apiKey(apiKey: Optional) = apiKey(apiKey.getOrNull()) fun headers(headers: Headers) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Timeout.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Timeout.kt index cb3f493c..5cdd099f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Timeout.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Timeout.kt @@ -90,13 +90,7 @@ private constructor( */ fun connect(connect: Duration?) = apply { this.connect = connect } - /** - * The maximum time allowed to establish a connection with a host. - * - * A value of [Duration.ZERO] means there's no timeout. - * - * Defaults to `Duration.ofMinutes(1)`. - */ + /** Alias for calling [Builder.connect] with `connect.orElse(null)`. */ fun connect(connect: Optional) = connect(connect.getOrNull()) /** @@ -108,13 +102,7 @@ private constructor( */ fun read(read: Duration?) = apply { this.read = read } - /** - * The maximum time allowed between two data packets when waiting for the server’s response. - * - * A value of [Duration.ZERO] means there's no timeout. - * - * Defaults to `request()`. - */ + /** Alias for calling [Builder.read] with `read.orElse(null)`. */ fun read(read: Optional) = read(read.getOrNull()) /** @@ -126,13 +114,7 @@ private constructor( */ fun write(write: Duration?) = apply { this.write = write } - /** - * The maximum time allowed between two data packets when sending the request to the server. - * - * A value of [Duration.ZERO] means there's no timeout. - * - * Defaults to `request()`. - */ + /** Alias for calling [Builder.write] with `write.orElse(null)`. */ fun write(write: Optional) = write(write.getOrNull()) /** @@ -147,16 +129,7 @@ private constructor( */ fun request(request: Duration?) = apply { this.request = request } - /** - * The maximum time allowed for a complete HTTP call, not including retries. - * - * This includes resolving DNS, connecting, writing the request body, server processing, as - * well as reading the response body. - * - * A value of [Duration.ZERO] means there's no timeout. - * - * Defaults to `Duration.ofMinutes(1)`. - */ + /** Alias for calling [Builder.request] with `request.orElse(null)`. */ fun request(request: Optional) = request(request.getOrNull()) fun build(): Timeout = Timeout(connect, read, write, request) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt index 5ec6e533..633c1d9e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt @@ -75,133 +75,286 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The project version (commit) id. */ + /** + * The project version (commit) id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The details of a commit (project version). */ + /** + * The details of a commit (project version). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun commit(): Commit = commit.getRequired("commit") - /** The commit archive date. */ + /** + * The commit archive date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dateArchived(): Optional = Optional.ofNullable(dateArchived.getNullable("dateArchived")) - /** The project version (commit) creation date. */ + /** + * The project version (commit) creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The number of tests that are failing for the commit. */ + /** + * The number of tests that are failing for the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") - /** The model id. */ + /** + * The model id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) - /** The number of tests that are passing for the commit. */ + /** + * The number of tests that are passing for the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("projectId") /** * The commit status. Initially, the commit is `queued`, then, it switches to `running`. * Finally, it can be `paused`, `failed`, or `completed`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun status(): Status = status.getRequired("status") - /** The commit status message. */ + /** + * The commit status message. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) - /** The storage URI where the commit bundle is stored. */ + /** + * The storage URI where the commit bundle is stored. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun storageUri(): String = storageUri.getRequired("storageUri") - /** The total number of tests for the commit. */ + /** + * The total number of tests for the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") - /** The training dataset id. */ + /** + * The training dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun trainingDatasetId(): Optional = Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) - /** The validation dataset id. */ + /** + * The validation dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun validationDatasetId(): Optional = Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) - /** Whether the commit is archived. */ + /** + * Whether the commit is archived. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) - /** The deployment status associated with the commit's model. */ + /** + * The deployment status associated with the commit's model. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun deploymentStatus(): Optional = Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun links(): Optional = Optional.ofNullable(links.getNullable("links")) - /** The project version (commit) id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The details of a commit (project version). */ + /** + * Returns the raw JSON value of [commit]. + * + * Unlike [commit], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("commit") @ExcludeMissing fun _commit(): JsonField = commit - /** The commit archive date. */ + /** + * Returns the raw JSON value of [dateArchived]. + * + * Unlike [dateArchived], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived(): JsonField = dateArchived - /** The project version (commit) creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The number of tests that are failing for the commit. */ + /** + * Returns the raw JSON value of [failingGoalCount]. + * + * Unlike [failingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount(): JsonField = failingGoalCount - /** The model id. */ + /** + * Returns the raw JSON value of [mlModelId]. + * + * Unlike [mlModelId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId(): JsonField = mlModelId - /** The number of tests that are passing for the commit. */ + /** + * Returns the raw JSON value of [passingGoalCount]. + * + * Unlike [passingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount(): JsonField = passingGoalCount - /** The project id. */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The commit status message. */ + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage(): JsonField = statusMessage - /** The storage URI where the commit bundle is stored. */ + /** + * Returns the raw JSON value of [storageUri]. + * + * Unlike [storageUri], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("storageUri") @ExcludeMissing fun _storageUri(): JsonField = storageUri - /** The total number of tests for the commit. */ + /** + * Returns the raw JSON value of [totalGoalCount]. + * + * Unlike [totalGoalCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount(): JsonField = totalGoalCount - /** The training dataset id. */ + /** + * Returns the raw JSON value of [trainingDatasetId]. + * + * Unlike [trainingDatasetId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("trainingDatasetId") @ExcludeMissing fun _trainingDatasetId(): JsonField = trainingDatasetId - /** The validation dataset id. */ + /** + * Returns the raw JSON value of [validationDatasetId]. + * + * Unlike [validationDatasetId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("validationDatasetId") @ExcludeMissing fun _validationDatasetId(): JsonField = validationDatasetId - /** Whether the commit is archived. */ + /** + * Returns the raw JSON value of [archived]. + * + * Unlike [archived], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived - /** The deployment status associated with the commit's model. */ + /** + * Returns the raw JSON value of [deploymentStatus]. + * + * Unlike [deploymentStatus], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("deploymentStatus") @ExcludeMissing fun _deploymentStatus(): JsonField = deploymentStatus + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links @JsonAnyGetter @@ -310,24 +463,40 @@ private constructor( /** The project version (commit) id. */ fun id(id: String) = id(JsonField.of(id)) - /** The project version (commit) id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** The details of a commit (project version). */ fun commit(commit: Commit) = commit(JsonField.of(commit)) - /** The details of a commit (project version). */ + /** + * Sets [Builder.commit] to an arbitrary JSON value. + * + * You should usually call [Builder.commit] with a well-typed [Commit] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun commit(commit: JsonField) = apply { this.commit = commit } /** The commit archive date. */ fun dateArchived(dateArchived: OffsetDateTime?) = dateArchived(JsonField.ofNullable(dateArchived)) - /** The commit archive date. */ + /** Alias for calling [Builder.dateArchived] with `dateArchived.orElse(null)`. */ fun dateArchived(dateArchived: Optional) = dateArchived(dateArchived.getOrNull()) - /** The commit archive date. */ + /** + * Sets [Builder.dateArchived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateArchived] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dateArchived(dateArchived: JsonField) = apply { this.dateArchived = dateArchived } @@ -335,7 +504,13 @@ private constructor( /** The project version (commit) creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The project version (commit) creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -344,7 +519,13 @@ private constructor( fun failingGoalCount(failingGoalCount: Long) = failingGoalCount(JsonField.of(failingGoalCount)) - /** The number of tests that are failing for the commit. */ + /** + * Sets [Builder.failingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun failingGoalCount(failingGoalCount: JsonField) = apply { this.failingGoalCount = failingGoalCount } @@ -352,17 +533,29 @@ private constructor( /** The model id. */ fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) - /** The model id. */ + /** Alias for calling [Builder.mlModelId] with `mlModelId.orElse(null)`. */ fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) - /** The model id. */ + /** + * Sets [Builder.mlModelId] to an arbitrary JSON value. + * + * You should usually call [Builder.mlModelId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } /** The number of tests that are passing for the commit. */ fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) - /** The number of tests that are passing for the commit. */ + /** + * Sets [Builder.passingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun passingGoalCount(passingGoalCount: JsonField) = apply { this.passingGoalCount = passingGoalCount } @@ -370,7 +563,13 @@ private constructor( /** The project id. */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** The project id. */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** @@ -380,8 +579,10 @@ private constructor( fun status(status: Status) = status(JsonField.of(status)) /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun status(status: JsonField) = apply { this.status = status } @@ -389,11 +590,17 @@ private constructor( fun statusMessage(statusMessage: String?) = statusMessage(JsonField.ofNullable(statusMessage)) - /** The commit status message. */ + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ fun statusMessage(statusMessage: Optional) = statusMessage(statusMessage.getOrNull()) - /** The commit status message. */ + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } @@ -401,13 +608,25 @@ private constructor( /** The storage URI where the commit bundle is stored. */ fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) - /** The storage URI where the commit bundle is stored. */ + /** + * Sets [Builder.storageUri] to an arbitrary JSON value. + * + * You should usually call [Builder.storageUri] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } /** The total number of tests for the commit. */ fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - /** The total number of tests for the commit. */ + /** + * Sets [Builder.totalGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun totalGoalCount(totalGoalCount: JsonField) = apply { this.totalGoalCount = totalGoalCount } @@ -416,11 +635,17 @@ private constructor( fun trainingDatasetId(trainingDatasetId: String?) = trainingDatasetId(JsonField.ofNullable(trainingDatasetId)) - /** The training dataset id. */ + /** Alias for calling [Builder.trainingDatasetId] with `trainingDatasetId.orElse(null)`. */ fun trainingDatasetId(trainingDatasetId: Optional) = trainingDatasetId(trainingDatasetId.getOrNull()) - /** The training dataset id. */ + /** + * Sets [Builder.trainingDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.trainingDatasetId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun trainingDatasetId(trainingDatasetId: JsonField) = apply { this.trainingDatasetId = trainingDatasetId } @@ -429,11 +654,19 @@ private constructor( fun validationDatasetId(validationDatasetId: String?) = validationDatasetId(JsonField.ofNullable(validationDatasetId)) - /** The validation dataset id. */ + /** + * Alias for calling [Builder.validationDatasetId] with `validationDatasetId.orElse(null)`. + */ fun validationDatasetId(validationDatasetId: Optional) = validationDatasetId(validationDatasetId.getOrNull()) - /** The validation dataset id. */ + /** + * Sets [Builder.validationDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.validationDatasetId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun validationDatasetId(validationDatasetId: JsonField) = apply { this.validationDatasetId = validationDatasetId } @@ -441,26 +674,48 @@ private constructor( /** Whether the commit is archived. */ fun archived(archived: Boolean?) = archived(JsonField.ofNullable(archived)) - /** Whether the commit is archived. */ + /** + * Alias for [Builder.archived]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun archived(archived: Boolean) = archived(archived as Boolean?) - /** Whether the commit is archived. */ + /** Alias for calling [Builder.archived] with `archived.orElse(null)`. */ fun archived(archived: Optional) = archived(archived.getOrNull()) - /** Whether the commit is archived. */ + /** + * Sets [Builder.archived] to an arbitrary JSON value. + * + * You should usually call [Builder.archived] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun archived(archived: JsonField) = apply { this.archived = archived } /** The deployment status associated with the commit's model. */ fun deploymentStatus(deploymentStatus: String) = deploymentStatus(JsonField.of(deploymentStatus)) - /** The deployment status associated with the commit's model. */ + /** + * Sets [Builder.deploymentStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.deploymentStatus] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun deploymentStatus(deploymentStatus: JsonField) = apply { this.deploymentStatus = deploymentStatus } fun links(links: Links) = links(JsonField.of(links)) + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun links(links: JsonField) = apply { this.links = links } fun additionalProperties(additionalProperties: Map) = apply { @@ -548,94 +803,207 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The commit id. */ + /** + * The commit id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The author id of the commit. */ + /** + * The author id of the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun authorId(): String = authorId.getRequired("authorId") - /** The size of the commit bundle in bytes. */ + /** + * The size of the commit bundle in bytes. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun fileSize(): Optional = Optional.ofNullable(fileSize.getNullable("fileSize")) - /** The commit message. */ + /** + * The commit message. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun message(): String = message.getRequired("message") - /** The model id. */ + /** + * The model id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) - /** The storage URI where the commit bundle is stored. */ + /** + * The storage URI where the commit bundle is stored. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun storageUri(): String = storageUri.getRequired("storageUri") - /** The training dataset id. */ + /** + * The training dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun trainingDatasetId(): Optional = Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) - /** The validation dataset id. */ + /** + * The validation dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun validationDatasetId(): Optional = Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) - /** The commit creation date. */ + /** + * The commit creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun dateCreated(): Optional = Optional.ofNullable(dateCreated.getNullable("dateCreated")) - /** The ref of the corresponding git commit. */ + /** + * The ref of the corresponding git commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun gitCommitRef(): Optional = Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) - /** The SHA of the corresponding git commit. */ + /** + * The SHA of the corresponding git commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun gitCommitSha(): Optional = Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) - /** The URL of the corresponding git commit. */ + /** + * The URL of the corresponding git commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun gitCommitUrl(): Optional = Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) - /** The commit id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The author id of the commit. */ + /** + * Returns the raw JSON value of [authorId]. + * + * Unlike [authorId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("authorId") @ExcludeMissing fun _authorId(): JsonField = authorId - /** The size of the commit bundle in bytes. */ + /** + * Returns the raw JSON value of [fileSize]. + * + * Unlike [fileSize], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("fileSize") @ExcludeMissing fun _fileSize(): JsonField = fileSize - /** The commit message. */ + /** + * Returns the raw JSON value of [message]. + * + * Unlike [message], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("message") @ExcludeMissing fun _message(): JsonField = message - /** The model id. */ + /** + * Returns the raw JSON value of [mlModelId]. + * + * Unlike [mlModelId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId(): JsonField = mlModelId - /** The storage URI where the commit bundle is stored. */ + /** + * Returns the raw JSON value of [storageUri]. + * + * Unlike [storageUri], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("storageUri") @ExcludeMissing fun _storageUri(): JsonField = storageUri - /** The training dataset id. */ + /** + * Returns the raw JSON value of [trainingDatasetId]. + * + * Unlike [trainingDatasetId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("trainingDatasetId") @ExcludeMissing fun _trainingDatasetId(): JsonField = trainingDatasetId - /** The validation dataset id. */ + /** + * Returns the raw JSON value of [validationDatasetId]. + * + * Unlike [validationDatasetId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("validationDatasetId") @ExcludeMissing fun _validationDatasetId(): JsonField = validationDatasetId - /** The commit creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The ref of the corresponding git commit. */ + /** + * Returns the raw JSON value of [gitCommitRef]. + * + * Unlike [gitCommitRef], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitCommitRef") @ExcludeMissing fun _gitCommitRef(): JsonField = gitCommitRef - /** The SHA of the corresponding git commit. */ + /** + * Returns the raw JSON value of [gitCommitSha]. + * + * Unlike [gitCommitSha], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitCommitSha") @ExcludeMissing fun _gitCommitSha(): JsonField = gitCommitSha - /** The URL of the corresponding git commit. */ + /** + * Returns the raw JSON value of [gitCommitUrl]. + * + * Unlike [gitCommitUrl], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitCommitUrl") @ExcludeMissing fun _gitCommitUrl(): JsonField = gitCommitUrl @@ -725,57 +1093,105 @@ private constructor( /** The commit id. */ fun id(id: String) = id(JsonField.of(id)) - /** The commit id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The author id of the commit. */ fun authorId(authorId: String) = authorId(JsonField.of(authorId)) - /** The author id of the commit. */ + /** + * Sets [Builder.authorId] to an arbitrary JSON value. + * + * You should usually call [Builder.authorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun authorId(authorId: JsonField) = apply { this.authorId = authorId } /** The size of the commit bundle in bytes. */ fun fileSize(fileSize: Long?) = fileSize(JsonField.ofNullable(fileSize)) - /** The size of the commit bundle in bytes. */ + /** + * Alias for [Builder.fileSize]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun fileSize(fileSize: Long) = fileSize(fileSize as Long?) - /** The size of the commit bundle in bytes. */ + /** Alias for calling [Builder.fileSize] with `fileSize.orElse(null)`. */ fun fileSize(fileSize: Optional) = fileSize(fileSize.getOrNull()) - /** The size of the commit bundle in bytes. */ + /** + * Sets [Builder.fileSize] to an arbitrary JSON value. + * + * You should usually call [Builder.fileSize] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun fileSize(fileSize: JsonField) = apply { this.fileSize = fileSize } /** The commit message. */ fun message(message: String) = message(JsonField.of(message)) - /** The commit message. */ + /** + * Sets [Builder.message] to an arbitrary JSON value. + * + * You should usually call [Builder.message] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun message(message: JsonField) = apply { this.message = message } /** The model id. */ fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) - /** The model id. */ + /** Alias for calling [Builder.mlModelId] with `mlModelId.orElse(null)`. */ fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) - /** The model id. */ + /** + * Sets [Builder.mlModelId] to an arbitrary JSON value. + * + * You should usually call [Builder.mlModelId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } /** The storage URI where the commit bundle is stored. */ fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) - /** The storage URI where the commit bundle is stored. */ + /** + * Sets [Builder.storageUri] to an arbitrary JSON value. + * + * You should usually call [Builder.storageUri] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: String?) = trainingDatasetId(JsonField.ofNullable(trainingDatasetId)) - /** The training dataset id. */ + /** + * Alias for calling [Builder.trainingDatasetId] with `trainingDatasetId.orElse(null)`. + */ fun trainingDatasetId(trainingDatasetId: Optional) = trainingDatasetId(trainingDatasetId.getOrNull()) - /** The training dataset id. */ + /** + * Sets [Builder.trainingDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.trainingDatasetId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun trainingDatasetId(trainingDatasetId: JsonField) = apply { this.trainingDatasetId = trainingDatasetId } @@ -784,11 +1200,20 @@ private constructor( fun validationDatasetId(validationDatasetId: String?) = validationDatasetId(JsonField.ofNullable(validationDatasetId)) - /** The validation dataset id. */ + /** + * Alias for calling [Builder.validationDatasetId] with + * `validationDatasetId.orElse(null)`. + */ fun validationDatasetId(validationDatasetId: Optional) = validationDatasetId(validationDatasetId.getOrNull()) - /** The validation dataset id. */ + /** + * Sets [Builder.validationDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.validationDatasetId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun validationDatasetId(validationDatasetId: JsonField) = apply { this.validationDatasetId = validationDatasetId } @@ -796,7 +1221,13 @@ private constructor( /** The commit creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The commit creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -804,7 +1235,13 @@ private constructor( /** The ref of the corresponding git commit. */ fun gitCommitRef(gitCommitRef: String) = gitCommitRef(JsonField.of(gitCommitRef)) - /** The ref of the corresponding git commit. */ + /** + * Sets [Builder.gitCommitRef] to an arbitrary JSON value. + * + * You should usually call [Builder.gitCommitRef] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitCommitRef(gitCommitRef: JsonField) = apply { this.gitCommitRef = gitCommitRef } @@ -812,7 +1249,13 @@ private constructor( /** The SHA of the corresponding git commit. */ fun gitCommitSha(gitCommitSha: Long) = gitCommitSha(JsonField.of(gitCommitSha)) - /** The SHA of the corresponding git commit. */ + /** + * Sets [Builder.gitCommitSha] to an arbitrary JSON value. + * + * You should usually call [Builder.gitCommitSha] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitCommitSha(gitCommitSha: JsonField) = apply { this.gitCommitSha = gitCommitSha } @@ -820,7 +1263,13 @@ private constructor( /** The URL of the corresponding git commit. */ fun gitCommitUrl(gitCommitUrl: String) = gitCommitUrl(JsonField.of(gitCommitUrl)) - /** The URL of the corresponding git commit. */ + /** + * Sets [Builder.gitCommitUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.gitCommitUrl] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitCommitUrl(gitCommitUrl: JsonField) = apply { this.gitCommitUrl = gitCommitUrl } @@ -1017,8 +1466,17 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun app(): String = app.getRequired("app") + /** + * Returns the raw JSON value of [app]. + * + * Unlike [app], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @@ -1065,6 +1523,13 @@ private constructor( fun app(app: String) = app(JsonField.of(app)) + /** + * Sets [Builder.app] to an arbitrary JSON value. + * + * You should usually call [Builder.app] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt index 5a490932..b5df591f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt @@ -124,29 +124,41 @@ private constructor( this.includeArchived = includeArchived } - /** Include archived goals. */ + /** + * Alias for [Builder.includeArchived]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun includeArchived(includeArchived: Boolean) = includeArchived(includeArchived as Boolean?) - /** Include archived goals. */ + /** Alias for calling [Builder.includeArchived] with `includeArchived.orElse(null)`. */ fun includeArchived(includeArchived: Optional) = includeArchived(includeArchived.getOrNull()) /** The page to return in a paginated query. */ fun page(page: Long?) = apply { this.page = page } - /** The page to return in a paginated query. */ + /** + * Alias for [Builder.page]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun page(page: Long) = page(page as Long?) - /** The page to return in a paginated query. */ + /** Alias for calling [Builder.page] with `page.orElse(null)`. */ fun page(page: Optional) = page(page.getOrNull()) /** Maximum number of items to return per page. */ fun perPage(perPage: Long?) = apply { this.perPage = perPage } - /** Maximum number of items to return per page. */ + /** + * Alias for [Builder.perPage]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun perPage(perPage: Long) = perPage(perPage as Long?) - /** Maximum number of items to return per page. */ + /** Alias for calling [Builder.perPage] with `perPage.orElse(null)`. */ fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) /** @@ -155,10 +167,7 @@ private constructor( */ fun status(status: Status?) = apply { this.status = status } - /** - * Filter list of test results by status. Available statuses are `running`, `passing`, - * `failing`, `skipped`, and `error`. - */ + /** Alias for calling [Builder.status] with `status.orElse(null)`. */ fun status(status: Optional) = status(status.getOrNull()) /** @@ -167,10 +176,7 @@ private constructor( */ fun type(type: Type?) = apply { this.type = type } - /** - * Filter objects by test type. Available types are `integrity`, `consistency`, - * `performance`, `fairness`, and `robustness`. - */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt index 0c196fbd..7c3f4fe0 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt @@ -42,8 +42,17 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun items(): List = items.getRequired("items") + /** + * Returns the raw JSON value of [items]. + * + * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items @JsonAnyGetter @@ -90,10 +99,22 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) + /** + * Sets [Builder.items] to an arbitrary JSON value. + * + * You should usually call [Builder.items] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun items(items: JsonField>) = apply { this.items = items.map { it.toMutableList() } } + /** + * Adds a single [Item] to [items]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addItem(item: Item) = apply { items = (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } @@ -162,87 +183,191 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Project version (commit) id. */ + /** + * Project version (commit) id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The creation date. */ + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The data end date. */ + /** + * The data end date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun dateDataEnds(): Optional = Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) - /** The data start date. */ + /** + * The data start date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun dateDataStarts(): Optional = Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) - /** The last updated date. */ + /** + * The last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The inference pipeline id. */ + /** + * The inference pipeline id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun inferencePipelineId(): Optional = Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) - /** The project version (commit) id. */ + /** + * The project version (commit) id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun projectVersionId(): Optional = Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) - /** The status of the test. */ + /** + * The status of the test. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun status(): Status = status.getRequired("status") - /** The status message. */ + /** + * The status message. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun goal(): Optional = Optional.ofNullable(goal.getNullable("goal")) - /** The test id. */ + /** + * The test id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun goalId(): Optional = Optional.ofNullable(goalId.getNullable("goalId")) - /** Project version (commit) id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The data end date. */ + /** + * Returns the raw JSON value of [dateDataEnds]. + * + * Unlike [dateDataEnds], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateDataEnds") @ExcludeMissing fun _dateDataEnds(): JsonField = dateDataEnds - /** The data start date. */ + /** + * Returns the raw JSON value of [dateDataStarts]. + * + * Unlike [dateDataStarts], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateDataStarts") @ExcludeMissing fun _dateDataStarts(): JsonField = dateDataStarts - /** The last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The inference pipeline id. */ + /** + * Returns the raw JSON value of [inferencePipelineId]. + * + * Unlike [inferencePipelineId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("inferencePipelineId") @ExcludeMissing fun _inferencePipelineId(): JsonField = inferencePipelineId - /** The project version (commit) id. */ + /** + * Returns the raw JSON value of [projectVersionId]. + * + * Unlike [projectVersionId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("projectVersionId") @ExcludeMissing fun _projectVersionId(): JsonField = projectVersionId - /** The status of the test. */ + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The status message. */ + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage(): JsonField = statusMessage + /** + * Returns the raw JSON value of [goal]. + * + * Unlike [goal], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("goal") @ExcludeMissing fun _goal(): JsonField = goal - /** The test id. */ + /** + * Returns the raw JSON value of [goalId]. + * + * Unlike [goalId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("goalId") @ExcludeMissing fun _goalId(): JsonField = goalId @JsonAnyGetter @@ -328,13 +453,25 @@ private constructor( /** Project version (commit) id. */ fun id(id: String) = id(JsonField.of(id)) - /** Project version (commit) id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -343,11 +480,17 @@ private constructor( fun dateDataEnds(dateDataEnds: OffsetDateTime?) = dateDataEnds(JsonField.ofNullable(dateDataEnds)) - /** The data end date. */ + /** Alias for calling [Builder.dateDataEnds] with `dateDataEnds.orElse(null)`. */ fun dateDataEnds(dateDataEnds: Optional) = dateDataEnds(dateDataEnds.getOrNull()) - /** The data end date. */ + /** + * Sets [Builder.dateDataEnds] to an arbitrary JSON value. + * + * You should usually call [Builder.dateDataEnds] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateDataEnds(dateDataEnds: JsonField) = apply { this.dateDataEnds = dateDataEnds } @@ -356,11 +499,17 @@ private constructor( fun dateDataStarts(dateDataStarts: OffsetDateTime?) = dateDataStarts(JsonField.ofNullable(dateDataStarts)) - /** The data start date. */ + /** Alias for calling [Builder.dateDataStarts] with `dateDataStarts.orElse(null)`. */ fun dateDataStarts(dateDataStarts: Optional) = dateDataStarts(dateDataStarts.getOrNull()) - /** The data start date. */ + /** + * Sets [Builder.dateDataStarts] to an arbitrary JSON value. + * + * You should usually call [Builder.dateDataStarts] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateDataStarts(dateDataStarts: JsonField) = apply { this.dateDataStarts = dateDataStarts } @@ -368,7 +517,13 @@ private constructor( /** The last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -377,11 +532,20 @@ private constructor( fun inferencePipelineId(inferencePipelineId: String?) = inferencePipelineId(JsonField.ofNullable(inferencePipelineId)) - /** The inference pipeline id. */ + /** + * Alias for calling [Builder.inferencePipelineId] with + * `inferencePipelineId.orElse(null)`. + */ fun inferencePipelineId(inferencePipelineId: Optional) = inferencePipelineId(inferencePipelineId.getOrNull()) - /** The inference pipeline id. */ + /** + * Sets [Builder.inferencePipelineId] to an arbitrary JSON value. + * + * You should usually call [Builder.inferencePipelineId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun inferencePipelineId(inferencePipelineId: JsonField) = apply { this.inferencePipelineId = inferencePipelineId } @@ -390,11 +554,19 @@ private constructor( fun projectVersionId(projectVersionId: String?) = projectVersionId(JsonField.ofNullable(projectVersionId)) - /** The project version (commit) id. */ + /** + * Alias for calling [Builder.projectVersionId] with `projectVersionId.orElse(null)`. + */ fun projectVersionId(projectVersionId: Optional) = projectVersionId(projectVersionId.getOrNull()) - /** The project version (commit) id. */ + /** + * Sets [Builder.projectVersionId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectVersionId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectVersionId(projectVersionId: JsonField) = apply { this.projectVersionId = projectVersionId } @@ -402,33 +574,58 @@ private constructor( /** The status of the test. */ fun status(status: Status) = status(JsonField.of(status)) - /** The status of the test. */ + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun status(status: JsonField) = apply { this.status = status } /** The status message. */ fun statusMessage(statusMessage: String?) = statusMessage(JsonField.ofNullable(statusMessage)) - /** The status message. */ + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ fun statusMessage(statusMessage: Optional) = statusMessage(statusMessage.getOrNull()) - /** The status message. */ + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } fun goal(goal: Goal) = goal(JsonField.of(goal)) + /** + * Sets [Builder.goal] to an arbitrary JSON value. + * + * You should usually call [Builder.goal] with a well-typed [Goal] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun goal(goal: JsonField) = apply { this.goal = goal } /** The test id. */ fun goalId(goalId: String?) = goalId(JsonField.ofNullable(goalId)) - /** The test id. */ + /** Alias for calling [Builder.goalId] with `goalId.orElse(null)`. */ fun goalId(goalId: Optional) = goalId(goalId.getOrNull()) - /** The test id. */ + /** + * Sets [Builder.goalId] to an arbitrary JSON value. + * + * You should usually call [Builder.goalId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun goalId(goalId: JsonField) = apply { this.goalId = goalId } fun additionalProperties(additionalProperties: Map) = apply { @@ -662,170 +859,385 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The test id. */ + /** + * The test id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun id(): String = id.getRequired("id") - /** The number of comments on the test. */ + /** + * The number of comments on the test. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun commentCount(): Long = commentCount.getRequired("commentCount") - /** The test creator id. */ + /** + * The test creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The date the test was archived. */ + /** + * The date the test was archived. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun dateArchived(): Optional = Optional.ofNullable(dateArchived.getNullable("dateArchived")) - /** The creation date. */ + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The last updated date. */ + /** + * The last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The test description. */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonValue = description - /** The test name. */ + /** + * The test name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun name(): String = name.getRequired("name") - /** The test number. */ + /** + * The test number. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun number(): Long = number.getRequired("number") - /** The project version (commit) id where the test was created. */ + /** + * The project version (commit) id where the test was created. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun originProjectVersionId(): Optional = Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) - /** The test subtype. */ + /** + * The test subtype. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun subtype(): String = subtype.getRequired("subtype") - /** Whether the test is suggested or user-created. */ + /** + * Whether the test is suggested or user-created. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun suggested(): Boolean = suggested.getRequired("suggested") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun thresholds(): List = thresholds.getRequired("thresholds") - /** The test type. */ + /** + * The test type. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): String = type.getRequired("type") - /** Whether the test is archived. */ + /** + * Whether the test is archived. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) - /** The delay window in seconds. Only applies to tests that use production data. */ + /** + * The delay window in seconds. Only applies to tests that use production data. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun delayWindow(): Optional = Optional.ofNullable(delayWindow.getNullable("delayWindow")) - /** The evaluation window in seconds. Only applies to tests that use production data. */ + /** + * The evaluation window in seconds. Only applies to tests that use production data. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun evaluationWindow(): Optional = Optional.ofNullable(evaluationWindow.getNullable("evaluationWindow")) - /** Whether the test uses an ML model. */ + /** + * Whether the test uses an ML model. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun usesMlModel(): Optional = Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) - /** Whether the test uses production data (monitoring mode only). */ + /** + * Whether the test uses production data (monitoring mode only). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun usesProductionData(): Optional = Optional.ofNullable(usesProductionData.getNullable("usesProductionData")) - /** Whether the test uses a reference dataset (monitoring mode only). */ + /** + * Whether the test uses a reference dataset (monitoring mode only). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun usesReferenceDataset(): Optional = Optional.ofNullable(usesReferenceDataset.getNullable("usesReferenceDataset")) - /** Whether the test uses a training dataset. */ + /** + * Whether the test uses a training dataset. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun usesTrainingDataset(): Optional = Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) - /** Whether the test uses a validation dataset. */ + /** + * Whether the test uses a validation dataset. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun usesValidationDataset(): Optional = Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) - /** The test id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The number of comments on the test. */ + /** + * Returns the raw JSON value of [commentCount]. + * + * Unlike [commentCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("commentCount") @ExcludeMissing fun _commentCount(): JsonField = commentCount - /** The test creator id. */ + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId - /** The date the test was archived. */ + /** + * Returns the raw JSON value of [dateArchived]. + * + * Unlike [dateArchived], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived(): JsonField = dateArchived - /** The creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The test name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The test number. */ + /** + * Returns the raw JSON value of [number]. + * + * Unlike [number], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("number") @ExcludeMissing fun _number(): JsonField = number - /** The project version (commit) id where the test was created. */ + /** + * Returns the raw JSON value of [originProjectVersionId]. + * + * Unlike [originProjectVersionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("originProjectVersionId") @ExcludeMissing fun _originProjectVersionId(): JsonField = originProjectVersionId - /** The test subtype. */ + /** + * Returns the raw JSON value of [subtype]. + * + * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype - /** Whether the test is suggested or user-created. */ + /** + * Returns the raw JSON value of [suggested]. + * + * Unlike [suggested], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("suggested") @ExcludeMissing fun _suggested(): JsonField = suggested + /** + * Returns the raw JSON value of [thresholds]. + * + * Unlike [thresholds], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("thresholds") @ExcludeMissing fun _thresholds(): JsonField> = thresholds - /** The test type. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - /** Whether the test is archived. */ + /** + * Returns the raw JSON value of [archived]. + * + * Unlike [archived], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived - /** The delay window in seconds. Only applies to tests that use production data. */ + /** + * Returns the raw JSON value of [delayWindow]. + * + * Unlike [delayWindow], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("delayWindow") @ExcludeMissing fun _delayWindow(): JsonField = delayWindow - /** The evaluation window in seconds. Only applies to tests that use production data. */ + /** + * Returns the raw JSON value of [evaluationWindow]. + * + * Unlike [evaluationWindow], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("evaluationWindow") @ExcludeMissing fun _evaluationWindow(): JsonField = evaluationWindow - /** Whether the test uses an ML model. */ + /** + * Returns the raw JSON value of [usesMlModel]. + * + * Unlike [usesMlModel], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("usesMlModel") @ExcludeMissing fun _usesMlModel(): JsonField = usesMlModel - /** Whether the test uses production data (monitoring mode only). */ + /** + * Returns the raw JSON value of [usesProductionData]. + * + * Unlike [usesProductionData], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("usesProductionData") @ExcludeMissing fun _usesProductionData(): JsonField = usesProductionData - /** Whether the test uses a reference dataset (monitoring mode only). */ + /** + * Returns the raw JSON value of [usesReferenceDataset]. + * + * Unlike [usesReferenceDataset], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("usesReferenceDataset") @ExcludeMissing fun _usesReferenceDataset(): JsonField = usesReferenceDataset - /** Whether the test uses a training dataset. */ + /** + * Returns the raw JSON value of [usesTrainingDataset]. + * + * Unlike [usesTrainingDataset], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("usesTrainingDataset") @ExcludeMissing fun _usesTrainingDataset(): JsonField = usesTrainingDataset - /** Whether the test uses a validation dataset. */ + /** + * Returns the raw JSON value of [usesValidationDataset]. + * + * Unlike [usesValidationDataset], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("usesValidationDataset") @ExcludeMissing fun _usesValidationDataset(): JsonField = usesValidationDataset @@ -950,13 +1362,25 @@ private constructor( /** The test id. */ fun id(id: String) = id(JsonField.of(id)) - /** The test id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** The number of comments on the test. */ fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) - /** The number of comments on the test. */ + /** + * Sets [Builder.commentCount] to an arbitrary JSON value. + * + * You should usually call [Builder.commentCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun commentCount(commentCount: JsonField) = apply { this.commentCount = commentCount } @@ -964,21 +1388,33 @@ private constructor( /** The test creator id. */ fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The test creator id. */ + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) - /** The test creator id. */ + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The date the test was archived. */ fun dateArchived(dateArchived: OffsetDateTime?) = dateArchived(JsonField.ofNullable(dateArchived)) - /** The date the test was archived. */ + /** Alias for calling [Builder.dateArchived] with `dateArchived.orElse(null)`. */ fun dateArchived(dateArchived: Optional) = dateArchived(dateArchived.getOrNull()) - /** The date the test was archived. */ + /** + * Sets [Builder.dateArchived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateArchived] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun dateArchived(dateArchived: JsonField) = apply { this.dateArchived = dateArchived } @@ -987,7 +1423,13 @@ private constructor( fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -996,7 +1438,13 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -1007,24 +1455,45 @@ private constructor( /** The test name. */ fun name(name: String) = name(JsonField.of(name)) - /** The test name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** The test number. */ fun number(number: Long) = number(JsonField.of(number)) - /** The test number. */ + /** + * Sets [Builder.number] to an arbitrary JSON value. + * + * You should usually call [Builder.number] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun number(number: JsonField) = apply { this.number = number } /** The project version (commit) id where the test was created. */ fun originProjectVersionId(originProjectVersionId: String?) = originProjectVersionId(JsonField.ofNullable(originProjectVersionId)) - /** The project version (commit) id where the test was created. */ + /** + * Alias for calling [Builder.originProjectVersionId] with + * `originProjectVersionId.orElse(null)`. + */ fun originProjectVersionId(originProjectVersionId: Optional) = originProjectVersionId(originProjectVersionId.getOrNull()) - /** The project version (commit) id where the test was created. */ + /** + * Sets [Builder.originProjectVersionId] to an arbitrary JSON value. + * + * You should usually call [Builder.originProjectVersionId] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun originProjectVersionId(originProjectVersionId: JsonField) = apply { this.originProjectVersionId = originProjectVersionId } @@ -1032,21 +1501,45 @@ private constructor( /** The test subtype. */ fun subtype(subtype: String) = subtype(JsonField.of(subtype)) - /** The test subtype. */ + /** + * Sets [Builder.subtype] to an arbitrary JSON value. + * + * You should usually call [Builder.subtype] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun subtype(subtype: JsonField) = apply { this.subtype = subtype } /** Whether the test is suggested or user-created. */ fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) - /** Whether the test is suggested or user-created. */ + /** + * Sets [Builder.suggested] to an arbitrary JSON value. + * + * You should usually call [Builder.suggested] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun suggested(suggested: JsonField) = apply { this.suggested = suggested } fun thresholds(thresholds: List) = thresholds(JsonField.of(thresholds)) + /** + * Sets [Builder.thresholds] to an arbitrary JSON value. + * + * You should usually call [Builder.thresholds] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun thresholds(thresholds: JsonField>) = apply { this.thresholds = thresholds.map { it.toMutableList() } } + /** + * Adds a single [Threshold] to [thresholds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addThreshold(threshold: Threshold) = apply { thresholds = (thresholds ?: JsonField.of(mutableListOf())).also { @@ -1057,27 +1550,49 @@ private constructor( /** The test type. */ fun type(type: String) = type(JsonField.of(type)) - /** The test type. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } /** Whether the test is archived. */ fun archived(archived: Boolean) = archived(JsonField.of(archived)) - /** Whether the test is archived. */ + /** + * Sets [Builder.archived] to an arbitrary JSON value. + * + * You should usually call [Builder.archived] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun archived(archived: JsonField) = apply { this.archived = archived } /** The delay window in seconds. Only applies to tests that use production data. */ fun delayWindow(delayWindow: Double?) = delayWindow(JsonField.ofNullable(delayWindow)) - /** The delay window in seconds. Only applies to tests that use production data. */ + /** + * Alias for [Builder.delayWindow]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun delayWindow(delayWindow: Double) = delayWindow(delayWindow as Double?) - /** The delay window in seconds. Only applies to tests that use production data. */ + /** Alias for calling [Builder.delayWindow] with `delayWindow.orElse(null)`. */ fun delayWindow(delayWindow: Optional) = delayWindow(delayWindow.getOrNull()) - /** The delay window in seconds. Only applies to tests that use production data. */ + /** + * Sets [Builder.delayWindow] to an arbitrary JSON value. + * + * You should usually call [Builder.delayWindow] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun delayWindow(delayWindow: JsonField) = apply { this.delayWindow = delayWindow } @@ -1089,19 +1604,26 @@ private constructor( evaluationWindow(JsonField.ofNullable(evaluationWindow)) /** - * The evaluation window in seconds. Only applies to tests that use production data. + * Alias for [Builder.evaluationWindow]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun evaluationWindow(evaluationWindow: Double) = evaluationWindow(evaluationWindow as Double?) /** - * The evaluation window in seconds. Only applies to tests that use production data. + * Alias for calling [Builder.evaluationWindow] with + * `evaluationWindow.orElse(null)`. */ fun evaluationWindow(evaluationWindow: Optional) = evaluationWindow(evaluationWindow.getOrNull()) /** - * The evaluation window in seconds. Only applies to tests that use production data. + * Sets [Builder.evaluationWindow] to an arbitrary JSON value. + * + * You should usually call [Builder.evaluationWindow] with a well-typed [Double] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ fun evaluationWindow(evaluationWindow: JsonField) = apply { this.evaluationWindow = evaluationWindow @@ -1110,7 +1632,13 @@ private constructor( /** Whether the test uses an ML model. */ fun usesMlModel(usesMlModel: Boolean) = usesMlModel(JsonField.of(usesMlModel)) - /** Whether the test uses an ML model. */ + /** + * Sets [Builder.usesMlModel] to an arbitrary JSON value. + * + * You should usually call [Builder.usesMlModel] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun usesMlModel(usesMlModel: JsonField) = apply { this.usesMlModel = usesMlModel } @@ -1119,7 +1647,13 @@ private constructor( fun usesProductionData(usesProductionData: Boolean) = usesProductionData(JsonField.of(usesProductionData)) - /** Whether the test uses production data (monitoring mode only). */ + /** + * Sets [Builder.usesProductionData] to an arbitrary JSON value. + * + * You should usually call [Builder.usesProductionData] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun usesProductionData(usesProductionData: JsonField) = apply { this.usesProductionData = usesProductionData } @@ -1128,7 +1662,13 @@ private constructor( fun usesReferenceDataset(usesReferenceDataset: Boolean) = usesReferenceDataset(JsonField.of(usesReferenceDataset)) - /** Whether the test uses a reference dataset (monitoring mode only). */ + /** + * Sets [Builder.usesReferenceDataset] to an arbitrary JSON value. + * + * You should usually call [Builder.usesReferenceDataset] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun usesReferenceDataset(usesReferenceDataset: JsonField) = apply { this.usesReferenceDataset = usesReferenceDataset } @@ -1137,7 +1677,13 @@ private constructor( fun usesTrainingDataset(usesTrainingDataset: Boolean) = usesTrainingDataset(JsonField.of(usesTrainingDataset)) - /** Whether the test uses a training dataset. */ + /** + * Sets [Builder.usesTrainingDataset] to an arbitrary JSON value. + * + * You should usually call [Builder.usesTrainingDataset] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun usesTrainingDataset(usesTrainingDataset: JsonField) = apply { this.usesTrainingDataset = usesTrainingDataset } @@ -1146,7 +1692,13 @@ private constructor( fun usesValidationDataset(usesValidationDataset: Boolean) = usesValidationDataset(JsonField.of(usesValidationDataset)) - /** Whether the test uses a validation dataset. */ + /** + * Sets [Builder.usesValidationDataset] to an arbitrary JSON value. + * + * You should usually call [Builder.usesValidationDataset] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun usesValidationDataset(usesValidationDataset: JsonField) = apply { this.usesValidationDataset = usesValidationDataset } @@ -1224,44 +1776,94 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The insight name to be evaluated. */ + /** + * The insight name to be evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun insightName(): Optional = Optional.ofNullable(insightName.getNullable("insightName")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun insightParameters(): Optional> = Optional.ofNullable(insightParameters.getNullable("insightParameters")) - /** The measurement to be evaluated. */ + /** + * The measurement to be evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun measurement(): Optional = Optional.ofNullable(measurement.getNullable("measurement")) - /** The operator to be used for the evaluation. */ + /** + * The operator to be used for the evaluation. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) - /** The value to be compared. */ + /** + * The value to be compared. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun value(): Optional = Optional.ofNullable(value.getNullable("value")) - /** The insight name to be evaluated. */ + /** + * Returns the raw JSON value of [insightName]. + * + * Unlike [insightName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("insightName") @ExcludeMissing fun _insightName(): JsonField = insightName + /** + * Returns the raw JSON value of [insightParameters]. + * + * Unlike [insightParameters], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("insightParameters") @ExcludeMissing fun _insightParameters(): JsonField> = insightParameters - /** The measurement to be evaluated. */ + /** + * Returns the raw JSON value of [measurement]. + * + * Unlike [measurement], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("measurement") @ExcludeMissing fun _measurement(): JsonField = measurement - /** The operator to be used for the evaluation. */ + /** + * Returns the raw JSON value of [operator]. + * + * Unlike [operator], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("operator") @ExcludeMissing fun _operator(): JsonField = operator - /** The value to be compared. */ + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value @JsonAnyGetter @@ -1314,7 +1916,13 @@ private constructor( /** The insight name to be evaluated. */ fun insightName(insightName: String) = insightName(JsonField.of(insightName)) - /** The insight name to be evaluated. */ + /** + * Sets [Builder.insightName] to an arbitrary JSON value. + * + * You should usually call [Builder.insightName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun insightName(insightName: JsonField) = apply { this.insightName = insightName } @@ -1322,10 +1930,22 @@ private constructor( fun insightParameters(insightParameters: List) = insightParameters(JsonField.of(insightParameters)) + /** + * Sets [Builder.insightParameters] to an arbitrary JSON value. + * + * You should usually call [Builder.insightParameters] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun insightParameters(insightParameters: JsonField>) = apply { this.insightParameters = insightParameters.map { it.toMutableList() } } + /** + * Adds a single [JsonValue] to [insightParameters]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addInsightParameter(insightParameter: JsonValue) = apply { insightParameters = (insightParameters ?: JsonField.of(mutableListOf())).also { @@ -1336,7 +1956,13 @@ private constructor( /** The measurement to be evaluated. */ fun measurement(measurement: String) = measurement(JsonField.of(measurement)) - /** The measurement to be evaluated. */ + /** + * Sets [Builder.measurement] to an arbitrary JSON value. + * + * You should usually call [Builder.measurement] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun measurement(measurement: JsonField) = apply { this.measurement = measurement } @@ -1344,25 +1970,37 @@ private constructor( /** The operator to be used for the evaluation. */ fun operator(operator: String) = operator(JsonField.of(operator)) - /** The operator to be used for the evaluation. */ + /** + * Sets [Builder.operator] to an arbitrary JSON value. + * + * You should usually call [Builder.operator] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun operator(operator: JsonField) = apply { this.operator = operator } /** The value to be compared. */ fun value(value: Value) = value(JsonField.of(value)) - /** The value to be compared. */ + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [Value] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun value(value: JsonField) = apply { this.value = value } - /** The value to be compared. */ + /** Alias for calling [value] with `Value.ofNumber(number)`. */ fun value(number: Double) = value(Value.ofNumber(number)) - /** The value to be compared. */ + /** Alias for calling [value] with `Value.ofBool(bool)`. */ fun value(bool: Boolean) = value(Value.ofBool(bool)) - /** The value to be compared. */ + /** Alias for calling [value] with `Value.ofString(string)`. */ fun value(string: String) = value(Value.ofString(string)) - /** The value to be compared. */ + /** Alias for calling [value] with `Value.ofStrings(strings)`. */ fun valueOfStrings(strings: List) = value(Value.ofStrings(strings)) fun additionalProperties(additionalProperties: Map) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt index 9c76d388..8b8bd60f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt @@ -92,10 +92,14 @@ private constructor( /** Expand specific nested objects. */ fun expand(expand: List?) = apply { this.expand = expand?.toMutableList() } - /** Expand specific nested objects. */ + /** Alias for calling [Builder.expand] with `expand.orElse(null)`. */ fun expand(expand: Optional>) = expand(expand.getOrNull()) - /** Expand specific nested objects. */ + /** + * Adds a single [Expand] to [Builder.expand]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addExpand(expand: Expand) = apply { this.expand = (this.expand ?: mutableListOf()).apply { add(expand) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt index 7639e73e..eab69602 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt @@ -78,130 +78,297 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The inference pipeline id. */ + /** + * The inference pipeline id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The creation date. */ + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The last test evaluation date. */ + /** + * The last test evaluation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dateLastEvaluated(): Optional = Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) - /** The last data sample received date. */ + /** + * The last data sample received date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dateLastSampleReceived(): Optional = Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) - /** The next test evaluation date. */ + /** + * The next test evaluation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dateOfNextEvaluation(): Optional = Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) - /** The last updated date. */ + /** + * The last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The inference pipeline description. */ + /** + * The inference pipeline description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** The number of tests failing. */ + /** + * The number of tests failing. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun links(): Links = links.getRequired("links") - /** The inference pipeline name. */ + /** + * The inference pipeline name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The number of tests passing. */ + /** + * The number of tests passing. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("projectId") - /** The status of test evaluation for the inference pipeline. */ + /** + * The status of test evaluation for the inference pipeline. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun status(): Status = status.getRequired("status") - /** The status message of test evaluation for the inference pipeline. */ + /** + * The status message of test evaluation for the inference pipeline. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) - /** The total number of tests. */ + /** + * The total number of tests. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun project(): Optional = Optional.ofNullable(project.getNullable("project")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun workspace(): Optional = Optional.ofNullable(workspace.getNullable("workspace")) - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The inference pipeline id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The last test evaluation date. */ + /** + * Returns the raw JSON value of [dateLastEvaluated]. + * + * Unlike [dateLastEvaluated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateLastEvaluated") @ExcludeMissing fun _dateLastEvaluated(): JsonField = dateLastEvaluated - /** The last data sample received date. */ + /** + * Returns the raw JSON value of [dateLastSampleReceived]. + * + * Unlike [dateLastSampleReceived], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("dateLastSampleReceived") @ExcludeMissing fun _dateLastSampleReceived(): JsonField = dateLastSampleReceived - /** The next test evaluation date. */ + /** + * Returns the raw JSON value of [dateOfNextEvaluation]. + * + * Unlike [dateOfNextEvaluation], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateOfNextEvaluation") @ExcludeMissing fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation - /** The last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The inference pipeline description. */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** The number of tests failing. */ + /** + * Returns the raw JSON value of [failingGoalCount]. + * + * Unlike [failingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount(): JsonField = failingGoalCount + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links - /** The inference pipeline name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The number of tests passing. */ + /** + * Returns the raw JSON value of [passingGoalCount]. + * + * Unlike [passingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount(): JsonField = passingGoalCount - /** The project id. */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId - /** The status of test evaluation for the inference pipeline. */ + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The status message of test evaluation for the inference pipeline. */ + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage(): JsonField = statusMessage - /** The total number of tests. */ + /** + * Returns the raw JSON value of [totalGoalCount]. + * + * Unlike [totalGoalCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount(): JsonField = totalGoalCount + /** + * Returns the raw JSON value of [project]. + * + * Unlike [project], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project") @ExcludeMissing fun _project(): JsonField = project + /** + * Returns the raw JSON value of [workspace]. + * + * Unlike [workspace], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("workspace") @ExcludeMissing fun _workspace(): JsonField = workspace - /** The workspace id. */ + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId @JsonAnyGetter @@ -317,13 +484,24 @@ private constructor( /** The inference pipeline id. */ fun id(id: String) = id(JsonField.of(id)) - /** The inference pipeline id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** The creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -332,11 +510,17 @@ private constructor( fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) - /** The last test evaluation date. */ + /** Alias for calling [Builder.dateLastEvaluated] with `dateLastEvaluated.orElse(null)`. */ fun dateLastEvaluated(dateLastEvaluated: Optional) = dateLastEvaluated(dateLastEvaluated.getOrNull()) - /** The last test evaluation date. */ + /** + * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastEvaluated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { this.dateLastEvaluated = dateLastEvaluated } @@ -345,11 +529,20 @@ private constructor( fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime?) = dateLastSampleReceived(JsonField.ofNullable(dateLastSampleReceived)) - /** The last data sample received date. */ + /** + * Alias for calling [Builder.dateLastSampleReceived] with + * `dateLastSampleReceived.orElse(null)`. + */ fun dateLastSampleReceived(dateLastSampleReceived: Optional) = dateLastSampleReceived(dateLastSampleReceived.getOrNull()) - /** The last data sample received date. */ + /** + * Sets [Builder.dateLastSampleReceived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastSampleReceived] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { this.dateLastSampleReceived = dateLastSampleReceived } @@ -358,11 +551,20 @@ private constructor( fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) - /** The next test evaluation date. */ + /** + * Alias for calling [Builder.dateOfNextEvaluation] with + * `dateOfNextEvaluation.orElse(null)`. + */ fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) - /** The next test evaluation date. */ + /** + * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfNextEvaluation] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { this.dateOfNextEvaluation = dateOfNextEvaluation } @@ -370,7 +572,13 @@ private constructor( /** The last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -378,36 +586,65 @@ private constructor( /** The inference pipeline description. */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** The inference pipeline description. */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** The inference pipeline description. */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { this.description = description } /** The number of tests failing. */ fun failingGoalCount(failingGoalCount: Long) = failingGoalCount(JsonField.of(failingGoalCount)) - /** The number of tests failing. */ + /** + * Sets [Builder.failingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun failingGoalCount(failingGoalCount: JsonField) = apply { this.failingGoalCount = failingGoalCount } fun links(links: Links) = links(JsonField.of(links)) + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun links(links: JsonField) = apply { this.links = links } /** The inference pipeline name. */ fun name(name: String) = name(JsonField.of(name)) - /** The inference pipeline name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** The number of tests passing. */ fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) - /** The number of tests passing. */ + /** + * Sets [Builder.passingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun passingGoalCount(passingGoalCount: JsonField) = apply { this.passingGoalCount = passingGoalCount } @@ -415,24 +652,41 @@ private constructor( /** The project id. */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** The project id. */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** The status of test evaluation for the inference pipeline. */ fun status(status: Status) = status(JsonField.of(status)) - /** The status of test evaluation for the inference pipeline. */ + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun status(status: JsonField) = apply { this.status = status } /** The status message of test evaluation for the inference pipeline. */ fun statusMessage(statusMessage: String?) = statusMessage(JsonField.ofNullable(statusMessage)) - /** The status message of test evaluation for the inference pipeline. */ + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ fun statusMessage(statusMessage: Optional) = statusMessage(statusMessage.getOrNull()) - /** The status message of test evaluation for the inference pipeline. */ + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } @@ -440,27 +694,54 @@ private constructor( /** The total number of tests. */ fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - /** The total number of tests. */ + /** + * Sets [Builder.totalGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun totalGoalCount(totalGoalCount: JsonField) = apply { this.totalGoalCount = totalGoalCount } fun project(project: Project?) = project(JsonField.ofNullable(project)) + /** Alias for calling [Builder.project] with `project.orElse(null)`. */ fun project(project: Optional) = project(project.getOrNull()) + /** + * Sets [Builder.project] to an arbitrary JSON value. + * + * You should usually call [Builder.project] with a well-typed [Project] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun project(project: JsonField) = apply { this.project = project } fun workspace(workspace: Workspace?) = workspace(JsonField.ofNullable(workspace)) + /** Alias for calling [Builder.workspace] with `workspace.orElse(null)`. */ fun workspace(workspace: Optional) = workspace(workspace.getOrNull()) + /** + * Sets [Builder.workspace] to an arbitrary JSON value. + * + * You should usually call [Builder.workspace] with a well-typed [Workspace] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun workspace(workspace: JsonField) = apply { this.workspace = workspace } /** The workspace id. */ fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) - /** The workspace id. */ + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } fun additionalProperties(additionalProperties: Map) = apply { @@ -515,8 +796,17 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun app(): String = app.getRequired("app") + /** + * Returns the raw JSON value of [app]. + * + * Unlike [app], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @@ -563,6 +853,13 @@ private constructor( fun app(app: String) = app(JsonField.of(app)) + /** + * Sets [Builder.app] to an arbitrary JSON value. + * + * You should usually call [Builder.app] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { @@ -784,117 +1081,265 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The project creator id. */ + /** + * The project creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The project creation date. */ + /** + * The project creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The project last updated date. */ + /** + * The project last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The number of tests in the development mode of the project. */ + /** + * The number of tests in the development mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") - /** The total number of tests in the project. */ + /** + * The total number of tests in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun goalCount(): Long = goalCount.getRequired("goalCount") - /** The number of inference pipelines in the project. */ + /** + * The number of inference pipelines in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun inferencePipelineCount(): Long = inferencePipelineCount.getRequired("inferencePipelineCount") - /** Links to the project. */ + /** + * Links to the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun links(): Links = links.getRequired("links") - /** The number of tests in the monitoring mode of the project. */ + /** + * The number of tests in the monitoring mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") - /** The project name. */ + /** + * The project name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The source of the project. */ + /** + * The source of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) - /** The task type of the project. */ + /** + * The task type of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun taskType(): TaskType = taskType.getRequired("taskType") - /** The number of versions (commits) in the project. */ + /** + * The number of versions (commits) in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun versionCount(): Long = versionCount.getRequired("versionCount") - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The project description. */ + /** + * The project description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) - /** The project id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The project creator id. */ + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId - /** The project creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The project last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The number of tests in the development mode of the project. */ + /** + * Returns the raw JSON value of [developmentGoalCount]. + * + * Unlike [developmentGoalCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("developmentGoalCount") @ExcludeMissing fun _developmentGoalCount(): JsonField = developmentGoalCount - /** The total number of tests in the project. */ + /** + * Returns the raw JSON value of [goalCount]. + * + * Unlike [goalCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount - /** The number of inference pipelines in the project. */ + /** + * Returns the raw JSON value of [inferencePipelineCount]. + * + * Unlike [inferencePipelineCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("inferencePipelineCount") @ExcludeMissing fun _inferencePipelineCount(): JsonField = inferencePipelineCount - /** Links to the project. */ + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links - /** The number of tests in the monitoring mode of the project. */ + /** + * Returns the raw JSON value of [monitoringGoalCount]. + * + * Unlike [monitoringGoalCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("monitoringGoalCount") @ExcludeMissing fun _monitoringGoalCount(): JsonField = monitoringGoalCount - /** The project name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The source of the project. */ + /** + * Returns the raw JSON value of [source]. + * + * Unlike [source], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source - /** The task type of the project. */ + /** + * Returns the raw JSON value of [taskType]. + * + * Unlike [taskType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("taskType") @ExcludeMissing fun _taskType(): JsonField = taskType - /** The number of versions (commits) in the project. */ + /** + * Returns the raw JSON value of [versionCount]. + * + * Unlike [versionCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("versionCount") @ExcludeMissing fun _versionCount(): JsonField = versionCount - /** The workspace id. */ + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId - /** The project description. */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + /** + * Returns the raw JSON value of [gitRepo]. + * + * Unlike [gitRepo], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo @JsonAnyGetter @@ -1000,22 +1445,40 @@ private constructor( /** The project id. */ fun id(id: String) = id(JsonField.of(id)) - /** The project id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The project creator id. */ fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The project creator id. */ + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) - /** The project creator id. */ + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The project creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -1023,7 +1486,13 @@ private constructor( /** The project last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The project last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -1032,7 +1501,13 @@ private constructor( fun developmentGoalCount(developmentGoalCount: Long) = developmentGoalCount(JsonField.of(developmentGoalCount)) - /** The number of tests in the development mode of the project. */ + /** + * Sets [Builder.developmentGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.developmentGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun developmentGoalCount(developmentGoalCount: JsonField) = apply { this.developmentGoalCount = developmentGoalCount } @@ -1040,14 +1515,26 @@ private constructor( /** The total number of tests in the project. */ fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) - /** The total number of tests in the project. */ + /** + * Sets [Builder.goalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.goalCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } /** The number of inference pipelines in the project. */ fun inferencePipelineCount(inferencePipelineCount: Long) = inferencePipelineCount(JsonField.of(inferencePipelineCount)) - /** The number of inference pipelines in the project. */ + /** + * Sets [Builder.inferencePipelineCount] to an arbitrary JSON value. + * + * You should usually call [Builder.inferencePipelineCount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { this.inferencePipelineCount = inferencePipelineCount } @@ -1055,14 +1542,26 @@ private constructor( /** Links to the project. */ fun links(links: Links) = links(JsonField.of(links)) - /** Links to the project. */ + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun links(links: JsonField) = apply { this.links = links } /** The number of tests in the monitoring mode of the project. */ fun monitoringGoalCount(monitoringGoalCount: Long) = monitoringGoalCount(JsonField.of(monitoringGoalCount)) - /** The number of tests in the monitoring mode of the project. */ + /** + * Sets [Builder.monitoringGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.monitoringGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { this.monitoringGoalCount = monitoringGoalCount } @@ -1070,28 +1569,52 @@ private constructor( /** The project name. */ fun name(name: String) = name(JsonField.of(name)) - /** The project name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The source of the project. */ fun source(source: Source?) = source(JsonField.ofNullable(source)) - /** The source of the project. */ + /** Alias for calling [Builder.source] with `source.orElse(null)`. */ fun source(source: Optional) = source(source.getOrNull()) - /** The source of the project. */ + /** + * Sets [Builder.source] to an arbitrary JSON value. + * + * You should usually call [Builder.source] with a well-typed [Source] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun source(source: JsonField) = apply { this.source = source } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) - /** The task type of the project. */ + /** + * Sets [Builder.taskType] to an arbitrary JSON value. + * + * You should usually call [Builder.taskType] with a well-typed [TaskType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun taskType(taskType: JsonField) = apply { this.taskType = taskType } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) - /** The number of versions (commits) in the project. */ + /** + * Sets [Builder.versionCount] to an arbitrary JSON value. + * + * You should usually call [Builder.versionCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun versionCount(versionCount: JsonField) = apply { this.versionCount = versionCount } @@ -1099,10 +1622,16 @@ private constructor( /** The workspace id. */ fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) - /** The workspace id. */ + /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) - /** The workspace id. */ + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } @@ -1110,18 +1639,32 @@ private constructor( /** The project description. */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** The project description. */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** The project description. */ - fun description(description: JsonField) = apply { - this.description = description + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description } fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) + /** Alias for calling [Builder.gitRepo] with `gitRepo.orElse(null)`. */ fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) + /** + * Sets [Builder.gitRepo] to an arbitrary JSON value. + * + * You should usually call [Builder.gitRepo] with a well-typed [GitRepo] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { @@ -1177,8 +1720,18 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun app(): String = app.getRequired("app") + /** + * Returns the raw JSON value of [app]. + * + * Unlike [app], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @@ -1225,6 +1778,13 @@ private constructor( fun app(app: String) = app(JsonField.of(app)) + /** + * Sets [Builder.app] to an arbitrary JSON value. + * + * You should usually call [Builder.app] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { @@ -1539,60 +2099,183 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun id(): String = id.getRequired("id") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun dateConnected(): OffsetDateTime = dateConnected.getRequired("dateConnected") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun gitId(): Long = gitId.getRequired("gitId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun name(): String = name.getRequired("name") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun private_(): Boolean = private_.getRequired("private") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun projectId(): String = projectId.getRequired("projectId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun slug(): String = slug.getRequired("slug") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun url(): String = url.getRequired("url") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [dateConnected]. + * + * Unlike [dateConnected], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected(): JsonField = dateConnected + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated + /** + * Returns the raw JSON value of [gitAccountId]. + * + * Unlike [gitAccountId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId(): JsonField = gitAccountId + /** + * Returns the raw JSON value of [gitId]. + * + * Unlike [gitId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gitId") @ExcludeMissing fun _gitId(): JsonField = gitId + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [private_]. + * + * Unlike [private_], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("private") @ExcludeMissing fun _private_(): JsonField = private_ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url + /** + * Returns the raw JSON value of [branch]. + * + * Unlike [branch], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch + /** + * Returns the raw JSON value of [rootDir]. + * + * Unlike [rootDir], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir @JsonAnyGetter @@ -1681,11 +2364,25 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) + /** + * Sets [Builder.dateConnected] to an arbitrary JSON value. + * + * You should usually call [Builder.dateConnected] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun dateConnected(dateConnected: JsonField) = apply { this.dateConnected = dateConnected } @@ -1693,46 +2390,116 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) + /** + * Sets [Builder.gitAccountId] to an arbitrary JSON value. + * + * You should usually call [Builder.gitAccountId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun gitAccountId(gitAccountId: JsonField) = apply { this.gitAccountId = gitAccountId } fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) + /** + * Sets [Builder.gitId] to an arbitrary JSON value. + * + * You should usually call [Builder.gitId] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitId(gitId: JsonField) = apply { this.gitId = gitId } fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun private_(private_: Boolean) = private_(JsonField.of(private_)) + /** + * Sets [Builder.private_] to an arbitrary JSON value. + * + * You should usually call [Builder.private_] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun private_(private_: JsonField) = apply { this.private_ = private_ } fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } fun slug(slug: String) = slug(JsonField.of(slug)) + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } fun url(url: String) = url(JsonField.of(url)) + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun url(url: JsonField) = apply { this.url = url } fun branch(branch: String) = branch(JsonField.of(branch)) + /** + * Sets [Builder.branch] to an arbitrary JSON value. + * + * You should usually call [Builder.branch] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun branch(branch: JsonField) = apply { this.branch = branch } fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) + /** + * Sets [Builder.rootDir] to an arbitrary JSON value. + * + * You should usually call [Builder.rootDir] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun additionalProperties(additionalProperties: Map) = apply { @@ -1865,120 +2632,270 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The workspace creator id. */ + /** + * The workspace creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The workspace creation date. */ + /** + * The workspace creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The workspace last updated date. */ + /** + * The workspace last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The number of invites in the workspace. */ + /** + * The number of invites in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun inviteCount(): Long = inviteCount.getRequired("inviteCount") - /** The number of members in the workspace. */ + /** + * The number of members in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun memberCount(): Long = memberCount.getRequired("memberCount") - /** The workspace name. */ + /** + * The workspace name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The end date of the current billing period. */ + /** + * The end date of the current billing period. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun periodEndDate(): Optional = Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) - /** The start date of the current billing period. */ + /** + * The start date of the current billing period. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun periodStartDate(): Optional = Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) - /** The number of projects in the workspace. */ + /** + * The number of projects in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectCount(): Long = projectCount.getRequired("projectCount") - /** The workspace slug. */ + /** + * The workspace slug. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun slug(): String = slug.getRequired("slug") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun status(): Status = status.getRequired("status") - /** The workspace invite code. */ + /** + * The workspace invite code. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun inviteCode(): Optional = Optional.ofNullable(inviteCode.getNullable("inviteCode")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun monthlyUsage(): Optional> = Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) - /** Whether the workspace only allows SAML authentication. */ + /** + * Whether the workspace only allows SAML authentication. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun samlOnlyAccess(): Optional = Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun wildcardDomains(): Optional> = Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) - /** The workspace id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The workspace creator id. */ + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId - /** The workspace creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The workspace last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The number of invites in the workspace. */ + /** + * Returns the raw JSON value of [inviteCount]. + * + * Unlike [inviteCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("inviteCount") @ExcludeMissing fun _inviteCount(): JsonField = inviteCount - /** The number of members in the workspace. */ + /** + * Returns the raw JSON value of [memberCount]. + * + * Unlike [memberCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("memberCount") @ExcludeMissing fun _memberCount(): JsonField = memberCount - /** The workspace name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The end date of the current billing period. */ + /** + * Returns the raw JSON value of [periodEndDate]. + * + * Unlike [periodEndDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("periodEndDate") @ExcludeMissing fun _periodEndDate(): JsonField = periodEndDate - /** The start date of the current billing period. */ + /** + * Returns the raw JSON value of [periodStartDate]. + * + * Unlike [periodStartDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("periodStartDate") @ExcludeMissing fun _periodStartDate(): JsonField = periodStartDate - /** The number of projects in the workspace. */ + /** + * Returns the raw JSON value of [projectCount]. + * + * Unlike [projectCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("projectCount") @ExcludeMissing fun _projectCount(): JsonField = projectCount - /** The workspace slug. */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The workspace invite code. */ + /** + * Returns the raw JSON value of [inviteCode]. + * + * Unlike [inviteCode], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("inviteCode") @ExcludeMissing fun _inviteCode(): JsonField = inviteCode + /** + * Returns the raw JSON value of [monthlyUsage]. + * + * Unlike [monthlyUsage], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("monthlyUsage") @ExcludeMissing fun _monthlyUsage(): JsonField> = monthlyUsage - /** Whether the workspace only allows SAML authentication. */ + /** + * Returns the raw JSON value of [samlOnlyAccess]. + * + * Unlike [samlOnlyAccess], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("samlOnlyAccess") @ExcludeMissing fun _samlOnlyAccess(): JsonField = samlOnlyAccess + /** + * Returns the raw JSON value of [wildcardDomains]. + * + * Unlike [wildcardDomains], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("wildcardDomains") @ExcludeMissing fun _wildcardDomains(): JsonField> = wildcardDomains @@ -2084,22 +3001,40 @@ private constructor( /** The workspace id. */ fun id(id: String) = id(JsonField.of(id)) - /** The workspace id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The workspace creator id. */ fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The workspace creator id. */ + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) - /** The workspace creator id. */ + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The workspace creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The workspace creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -2107,7 +3042,13 @@ private constructor( /** The workspace last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The workspace last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -2115,30 +3056,54 @@ private constructor( /** The number of invites in the workspace. */ fun inviteCount(inviteCount: Long) = inviteCount(JsonField.of(inviteCount)) - /** The number of invites in the workspace. */ + /** + * Sets [Builder.inviteCount] to an arbitrary JSON value. + * + * You should usually call [Builder.inviteCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun inviteCount(inviteCount: JsonField) = apply { this.inviteCount = inviteCount } /** The number of members in the workspace. */ fun memberCount(memberCount: Long) = memberCount(JsonField.of(memberCount)) - /** The number of members in the workspace. */ + /** + * Sets [Builder.memberCount] to an arbitrary JSON value. + * + * You should usually call [Builder.memberCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun memberCount(memberCount: JsonField) = apply { this.memberCount = memberCount } /** The workspace name. */ fun name(name: String) = name(JsonField.of(name)) - /** The workspace name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: OffsetDateTime?) = periodEndDate(JsonField.ofNullable(periodEndDate)) - /** The end date of the current billing period. */ + /** Alias for calling [Builder.periodEndDate] with `periodEndDate.orElse(null)`. */ fun periodEndDate(periodEndDate: Optional) = periodEndDate(periodEndDate.getOrNull()) - /** The end date of the current billing period. */ + /** + * Sets [Builder.periodEndDate] to an arbitrary JSON value. + * + * You should usually call [Builder.periodEndDate] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun periodEndDate(periodEndDate: JsonField) = apply { this.periodEndDate = periodEndDate } @@ -2147,11 +3112,17 @@ private constructor( fun periodStartDate(periodStartDate: OffsetDateTime?) = periodStartDate(JsonField.ofNullable(periodStartDate)) - /** The start date of the current billing period. */ + /** Alias for calling [Builder.periodStartDate] with `periodStartDate.orElse(null)`. */ fun periodStartDate(periodStartDate: Optional) = periodStartDate(periodStartDate.getOrNull()) - /** The start date of the current billing period. */ + /** + * Sets [Builder.periodStartDate] to an arbitrary JSON value. + * + * You should usually call [Builder.periodStartDate] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun periodStartDate(periodStartDate: JsonField) = apply { this.periodStartDate = periodStartDate } @@ -2159,7 +3130,13 @@ private constructor( /** The number of projects in the workspace. */ fun projectCount(projectCount: Long) = projectCount(JsonField.of(projectCount)) - /** The number of projects in the workspace. */ + /** + * Sets [Builder.projectCount] to an arbitrary JSON value. + * + * You should usually call [Builder.projectCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectCount(projectCount: JsonField) = apply { this.projectCount = projectCount } @@ -2167,26 +3144,57 @@ private constructor( /** The workspace slug. */ fun slug(slug: String) = slug(JsonField.of(slug)) - /** The workspace slug. */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } fun status(status: Status) = status(JsonField.of(status)) + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun status(status: JsonField) = apply { this.status = status } /** The workspace invite code. */ fun inviteCode(inviteCode: String) = inviteCode(JsonField.of(inviteCode)) - /** The workspace invite code. */ + /** + * Sets [Builder.inviteCode] to an arbitrary JSON value. + * + * You should usually call [Builder.inviteCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun inviteCode(inviteCode: JsonField) = apply { this.inviteCode = inviteCode } fun monthlyUsage(monthlyUsage: List) = monthlyUsage(JsonField.of(monthlyUsage)) + /** + * Sets [Builder.monthlyUsage] to an arbitrary JSON value. + * + * You should usually call [Builder.monthlyUsage] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun monthlyUsage(monthlyUsage: JsonField>) = apply { this.monthlyUsage = monthlyUsage.map { it.toMutableList() } } + /** + * Adds a single [MonthlyUsage] to [Builder.monthlyUsage]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMonthlyUsage(monthlyUsage: MonthlyUsage) = apply { this.monthlyUsage = (this.monthlyUsage ?: JsonField.of(mutableListOf())).also { @@ -2198,7 +3206,13 @@ private constructor( fun samlOnlyAccess(samlOnlyAccess: Boolean) = samlOnlyAccess(JsonField.of(samlOnlyAccess)) - /** Whether the workspace only allows SAML authentication. */ + /** + * Sets [Builder.samlOnlyAccess] to an arbitrary JSON value. + * + * You should usually call [Builder.samlOnlyAccess] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun samlOnlyAccess(samlOnlyAccess: JsonField) = apply { this.samlOnlyAccess = samlOnlyAccess } @@ -2206,10 +3220,22 @@ private constructor( fun wildcardDomains(wildcardDomains: List) = wildcardDomains(JsonField.of(wildcardDomains)) + /** + * Sets [Builder.wildcardDomains] to an arbitrary JSON value. + * + * You should usually call [Builder.wildcardDomains] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun wildcardDomains(wildcardDomains: JsonField>) = apply { this.wildcardDomains = wildcardDomains.map { it.toMutableList() } } + /** + * Adds a single [String] to [wildcardDomains]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addWildcardDomain(wildcardDomain: String) = apply { wildcardDomains = (wildcardDomains ?: JsonField.of(mutableListOf())).also { @@ -2413,23 +3439,53 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun executionTimeMs(): Optional = Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun monthYear(): Optional = Optional.ofNullable(monthYear.getNullable("monthYear")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun predictionCount(): Optional = Optional.ofNullable(predictionCount.getNullable("predictionCount")) + /** + * Returns the raw JSON value of [executionTimeMs]. + * + * Unlike [executionTimeMs], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("executionTimeMs") @ExcludeMissing fun _executionTimeMs(): JsonField = executionTimeMs + /** + * Returns the raw JSON value of [monthYear]. + * + * Unlike [monthYear], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("monthYear") @ExcludeMissing fun _monthYear(): JsonField = monthYear + /** + * Returns the raw JSON value of [predictionCount]. + * + * Unlike [predictionCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("predictionCount") @ExcludeMissing fun _predictionCount(): JsonField = predictionCount @@ -2478,18 +3534,40 @@ private constructor( fun executionTimeMs(executionTimeMs: Long?) = executionTimeMs(JsonField.ofNullable(executionTimeMs)) + /** + * Alias for [Builder.executionTimeMs]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun executionTimeMs(executionTimeMs: Long) = executionTimeMs(executionTimeMs as Long?) + /** + * Alias for calling [Builder.executionTimeMs] with `executionTimeMs.orElse(null)`. + */ fun executionTimeMs(executionTimeMs: Optional) = executionTimeMs(executionTimeMs.getOrNull()) + /** + * Sets [Builder.executionTimeMs] to an arbitrary JSON value. + * + * You should usually call [Builder.executionTimeMs] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun executionTimeMs(executionTimeMs: JsonField) = apply { this.executionTimeMs = executionTimeMs } fun monthYear(monthYear: LocalDate) = monthYear(JsonField.of(monthYear)) + /** + * Sets [Builder.monthYear] to an arbitrary JSON value. + * + * You should usually call [Builder.monthYear] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun monthYear(monthYear: JsonField) = apply { this.monthYear = monthYear } @@ -2497,6 +3575,13 @@ private constructor( fun predictionCount(predictionCount: Long) = predictionCount(JsonField.of(predictionCount)) + /** + * Sets [Builder.predictionCount] to an arbitrary JSON value. + * + * You should usually call [Builder.predictionCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun predictionCount(predictionCount: JsonField) = apply { this.predictionCount = predictionCount } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt index c7c52c80..0c244a8e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt @@ -17,6 +17,7 @@ import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -32,27 +33,50 @@ private constructor( fun inferencePipelineId(): String = inferencePipelineId - /** The inference pipeline description. */ + /** + * The inference pipeline description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** The inference pipeline name. */ + /** + * The inference pipeline name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = body.name() /** * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to * handle your reference dataset updates. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun referenceDatasetUri(): Optional = body.referenceDatasetUri() - /** The inference pipeline description. */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() - /** The inference pipeline name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() /** - * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to - * handle your reference dataset updates. + * Returns the raw JSON value of [referenceDatasetUri]. + * + * Unlike [referenceDatasetUri], this method doesn't throw if the JSON field has an unexpected + * type. */ fun _referenceDatasetUri(): JsonField = body._referenceDatasetUri() @@ -92,31 +116,54 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The inference pipeline description. */ + /** + * The inference pipeline description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** The inference pipeline name. */ + /** + * The inference pipeline name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) /** * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to * handle your reference dataset updates. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun referenceDatasetUri(): Optional = Optional.ofNullable(referenceDatasetUri.getNullable("referenceDatasetUri")) - /** The inference pipeline description. */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** The inference pipeline name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to - * handle your reference dataset updates. + * Returns the raw JSON value of [referenceDatasetUri]. + * + * Unlike [referenceDatasetUri], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("referenceDatasetUri") @ExcludeMissing @@ -166,10 +213,16 @@ private constructor( /** The inference pipeline description. */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** The inference pipeline description. */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** The inference pipeline description. */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -177,7 +230,13 @@ private constructor( /** The inference pipeline name. */ fun name(name: String) = name(JsonField.of(name)) - /** The inference pipeline name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** @@ -188,15 +247,18 @@ private constructor( referenceDatasetUri(JsonField.ofNullable(referenceDatasetUri)) /** - * The storage uri of your reference dataset. We recommend using the Python SDK or the - * UI to handle your reference dataset updates. + * Alias for calling [Builder.referenceDatasetUri] with + * `referenceDatasetUri.orElse(null)`. */ fun referenceDatasetUri(referenceDatasetUri: Optional) = referenceDatasetUri(referenceDatasetUri.getOrNull()) /** - * The storage uri of your reference dataset. We recommend using the Python SDK or the - * UI to handle your reference dataset updates. + * Sets [Builder.referenceDatasetUri] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceDatasetUri] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ fun referenceDatasetUri(referenceDatasetUri: JsonField) = apply { this.referenceDatasetUri = referenceDatasetUri @@ -283,16 +345,27 @@ private constructor( /** The inference pipeline description. */ fun description(description: String?) = apply { body.description(description) } - /** The inference pipeline description. */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** The inference pipeline description. */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } /** The inference pipeline name. */ fun name(name: String) = apply { body.name(name) } - /** The inference pipeline name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** @@ -304,15 +377,17 @@ private constructor( } /** - * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to - * handle your reference dataset updates. + * Alias for calling [Builder.referenceDatasetUri] with `referenceDatasetUri.orElse(null)`. */ fun referenceDatasetUri(referenceDatasetUri: Optional) = referenceDatasetUri(referenceDatasetUri.getOrNull()) /** - * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to - * handle your reference dataset updates. + * Sets [Builder.referenceDatasetUri] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceDatasetUri] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun referenceDatasetUri(referenceDatasetUri: JsonField) = apply { body.referenceDatasetUri(referenceDatasetUri) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt index fdb63441..a3937dc9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt @@ -78,130 +78,297 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The inference pipeline id. */ + /** + * The inference pipeline id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The creation date. */ + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The last test evaluation date. */ + /** + * The last test evaluation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dateLastEvaluated(): Optional = Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) - /** The last data sample received date. */ + /** + * The last data sample received date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dateLastSampleReceived(): Optional = Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) - /** The next test evaluation date. */ + /** + * The next test evaluation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dateOfNextEvaluation(): Optional = Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) - /** The last updated date. */ + /** + * The last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The inference pipeline description. */ + /** + * The inference pipeline description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** The number of tests failing. */ + /** + * The number of tests failing. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun links(): Links = links.getRequired("links") - /** The inference pipeline name. */ + /** + * The inference pipeline name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The number of tests passing. */ + /** + * The number of tests passing. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("projectId") - /** The status of test evaluation for the inference pipeline. */ + /** + * The status of test evaluation for the inference pipeline. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun status(): Status = status.getRequired("status") - /** The status message of test evaluation for the inference pipeline. */ + /** + * The status message of test evaluation for the inference pipeline. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) - /** The total number of tests. */ + /** + * The total number of tests. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun project(): Optional = Optional.ofNullable(project.getNullable("project")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun workspace(): Optional = Optional.ofNullable(workspace.getNullable("workspace")) - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The inference pipeline id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The last test evaluation date. */ + /** + * Returns the raw JSON value of [dateLastEvaluated]. + * + * Unlike [dateLastEvaluated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateLastEvaluated") @ExcludeMissing fun _dateLastEvaluated(): JsonField = dateLastEvaluated - /** The last data sample received date. */ + /** + * Returns the raw JSON value of [dateLastSampleReceived]. + * + * Unlike [dateLastSampleReceived], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("dateLastSampleReceived") @ExcludeMissing fun _dateLastSampleReceived(): JsonField = dateLastSampleReceived - /** The next test evaluation date. */ + /** + * Returns the raw JSON value of [dateOfNextEvaluation]. + * + * Unlike [dateOfNextEvaluation], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateOfNextEvaluation") @ExcludeMissing fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation - /** The last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The inference pipeline description. */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** The number of tests failing. */ + /** + * Returns the raw JSON value of [failingGoalCount]. + * + * Unlike [failingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount(): JsonField = failingGoalCount + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links - /** The inference pipeline name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The number of tests passing. */ + /** + * Returns the raw JSON value of [passingGoalCount]. + * + * Unlike [passingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount(): JsonField = passingGoalCount - /** The project id. */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId - /** The status of test evaluation for the inference pipeline. */ + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The status message of test evaluation for the inference pipeline. */ + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage(): JsonField = statusMessage - /** The total number of tests. */ + /** + * Returns the raw JSON value of [totalGoalCount]. + * + * Unlike [totalGoalCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount(): JsonField = totalGoalCount + /** + * Returns the raw JSON value of [project]. + * + * Unlike [project], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project") @ExcludeMissing fun _project(): JsonField = project + /** + * Returns the raw JSON value of [workspace]. + * + * Unlike [workspace], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("workspace") @ExcludeMissing fun _workspace(): JsonField = workspace - /** The workspace id. */ + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId @JsonAnyGetter @@ -317,13 +484,24 @@ private constructor( /** The inference pipeline id. */ fun id(id: String) = id(JsonField.of(id)) - /** The inference pipeline id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** The creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -332,11 +510,17 @@ private constructor( fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) - /** The last test evaluation date. */ + /** Alias for calling [Builder.dateLastEvaluated] with `dateLastEvaluated.orElse(null)`. */ fun dateLastEvaluated(dateLastEvaluated: Optional) = dateLastEvaluated(dateLastEvaluated.getOrNull()) - /** The last test evaluation date. */ + /** + * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastEvaluated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { this.dateLastEvaluated = dateLastEvaluated } @@ -345,11 +529,20 @@ private constructor( fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime?) = dateLastSampleReceived(JsonField.ofNullable(dateLastSampleReceived)) - /** The last data sample received date. */ + /** + * Alias for calling [Builder.dateLastSampleReceived] with + * `dateLastSampleReceived.orElse(null)`. + */ fun dateLastSampleReceived(dateLastSampleReceived: Optional) = dateLastSampleReceived(dateLastSampleReceived.getOrNull()) - /** The last data sample received date. */ + /** + * Sets [Builder.dateLastSampleReceived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastSampleReceived] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { this.dateLastSampleReceived = dateLastSampleReceived } @@ -358,11 +551,20 @@ private constructor( fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) - /** The next test evaluation date. */ + /** + * Alias for calling [Builder.dateOfNextEvaluation] with + * `dateOfNextEvaluation.orElse(null)`. + */ fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) - /** The next test evaluation date. */ + /** + * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfNextEvaluation] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { this.dateOfNextEvaluation = dateOfNextEvaluation } @@ -370,7 +572,13 @@ private constructor( /** The last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -378,36 +586,65 @@ private constructor( /** The inference pipeline description. */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** The inference pipeline description. */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** The inference pipeline description. */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { this.description = description } /** The number of tests failing. */ fun failingGoalCount(failingGoalCount: Long) = failingGoalCount(JsonField.of(failingGoalCount)) - /** The number of tests failing. */ + /** + * Sets [Builder.failingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun failingGoalCount(failingGoalCount: JsonField) = apply { this.failingGoalCount = failingGoalCount } fun links(links: Links) = links(JsonField.of(links)) + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun links(links: JsonField) = apply { this.links = links } /** The inference pipeline name. */ fun name(name: String) = name(JsonField.of(name)) - /** The inference pipeline name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** The number of tests passing. */ fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) - /** The number of tests passing. */ + /** + * Sets [Builder.passingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun passingGoalCount(passingGoalCount: JsonField) = apply { this.passingGoalCount = passingGoalCount } @@ -415,24 +652,41 @@ private constructor( /** The project id. */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** The project id. */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** The status of test evaluation for the inference pipeline. */ fun status(status: Status) = status(JsonField.of(status)) - /** The status of test evaluation for the inference pipeline. */ + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun status(status: JsonField) = apply { this.status = status } /** The status message of test evaluation for the inference pipeline. */ fun statusMessage(statusMessage: String?) = statusMessage(JsonField.ofNullable(statusMessage)) - /** The status message of test evaluation for the inference pipeline. */ + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ fun statusMessage(statusMessage: Optional) = statusMessage(statusMessage.getOrNull()) - /** The status message of test evaluation for the inference pipeline. */ + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } @@ -440,27 +694,54 @@ private constructor( /** The total number of tests. */ fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - /** The total number of tests. */ + /** + * Sets [Builder.totalGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun totalGoalCount(totalGoalCount: JsonField) = apply { this.totalGoalCount = totalGoalCount } fun project(project: Project?) = project(JsonField.ofNullable(project)) + /** Alias for calling [Builder.project] with `project.orElse(null)`. */ fun project(project: Optional) = project(project.getOrNull()) + /** + * Sets [Builder.project] to an arbitrary JSON value. + * + * You should usually call [Builder.project] with a well-typed [Project] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun project(project: JsonField) = apply { this.project = project } fun workspace(workspace: Workspace?) = workspace(JsonField.ofNullable(workspace)) + /** Alias for calling [Builder.workspace] with `workspace.orElse(null)`. */ fun workspace(workspace: Optional) = workspace(workspace.getOrNull()) + /** + * Sets [Builder.workspace] to an arbitrary JSON value. + * + * You should usually call [Builder.workspace] with a well-typed [Workspace] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun workspace(workspace: JsonField) = apply { this.workspace = workspace } /** The workspace id. */ fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) - /** The workspace id. */ + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } fun additionalProperties(additionalProperties: Map) = apply { @@ -515,8 +796,17 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun app(): String = app.getRequired("app") + /** + * Returns the raw JSON value of [app]. + * + * Unlike [app], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @@ -563,6 +853,13 @@ private constructor( fun app(app: String) = app(JsonField.of(app)) + /** + * Sets [Builder.app] to an arbitrary JSON value. + * + * You should usually call [Builder.app] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { @@ -784,117 +1081,265 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The project creator id. */ + /** + * The project creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The project creation date. */ + /** + * The project creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The project last updated date. */ + /** + * The project last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The number of tests in the development mode of the project. */ + /** + * The number of tests in the development mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") - /** The total number of tests in the project. */ + /** + * The total number of tests in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun goalCount(): Long = goalCount.getRequired("goalCount") - /** The number of inference pipelines in the project. */ + /** + * The number of inference pipelines in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun inferencePipelineCount(): Long = inferencePipelineCount.getRequired("inferencePipelineCount") - /** Links to the project. */ + /** + * Links to the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun links(): Links = links.getRequired("links") - /** The number of tests in the monitoring mode of the project. */ + /** + * The number of tests in the monitoring mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") - /** The project name. */ + /** + * The project name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The source of the project. */ + /** + * The source of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) - /** The task type of the project. */ + /** + * The task type of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun taskType(): TaskType = taskType.getRequired("taskType") - /** The number of versions (commits) in the project. */ + /** + * The number of versions (commits) in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun versionCount(): Long = versionCount.getRequired("versionCount") - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The project description. */ + /** + * The project description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) - /** The project id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The project creator id. */ + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId - /** The project creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The project last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The number of tests in the development mode of the project. */ + /** + * Returns the raw JSON value of [developmentGoalCount]. + * + * Unlike [developmentGoalCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("developmentGoalCount") @ExcludeMissing fun _developmentGoalCount(): JsonField = developmentGoalCount - /** The total number of tests in the project. */ + /** + * Returns the raw JSON value of [goalCount]. + * + * Unlike [goalCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount - /** The number of inference pipelines in the project. */ + /** + * Returns the raw JSON value of [inferencePipelineCount]. + * + * Unlike [inferencePipelineCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("inferencePipelineCount") @ExcludeMissing fun _inferencePipelineCount(): JsonField = inferencePipelineCount - /** Links to the project. */ + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links - /** The number of tests in the monitoring mode of the project. */ + /** + * Returns the raw JSON value of [monitoringGoalCount]. + * + * Unlike [monitoringGoalCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("monitoringGoalCount") @ExcludeMissing fun _monitoringGoalCount(): JsonField = monitoringGoalCount - /** The project name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The source of the project. */ + /** + * Returns the raw JSON value of [source]. + * + * Unlike [source], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source - /** The task type of the project. */ + /** + * Returns the raw JSON value of [taskType]. + * + * Unlike [taskType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("taskType") @ExcludeMissing fun _taskType(): JsonField = taskType - /** The number of versions (commits) in the project. */ + /** + * Returns the raw JSON value of [versionCount]. + * + * Unlike [versionCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("versionCount") @ExcludeMissing fun _versionCount(): JsonField = versionCount - /** The workspace id. */ + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId - /** The project description. */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + /** + * Returns the raw JSON value of [gitRepo]. + * + * Unlike [gitRepo], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo @JsonAnyGetter @@ -1000,22 +1445,40 @@ private constructor( /** The project id. */ fun id(id: String) = id(JsonField.of(id)) - /** The project id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The project creator id. */ fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The project creator id. */ + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) - /** The project creator id. */ + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The project creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -1023,7 +1486,13 @@ private constructor( /** The project last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The project last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -1032,7 +1501,13 @@ private constructor( fun developmentGoalCount(developmentGoalCount: Long) = developmentGoalCount(JsonField.of(developmentGoalCount)) - /** The number of tests in the development mode of the project. */ + /** + * Sets [Builder.developmentGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.developmentGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun developmentGoalCount(developmentGoalCount: JsonField) = apply { this.developmentGoalCount = developmentGoalCount } @@ -1040,14 +1515,26 @@ private constructor( /** The total number of tests in the project. */ fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) - /** The total number of tests in the project. */ + /** + * Sets [Builder.goalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.goalCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } /** The number of inference pipelines in the project. */ fun inferencePipelineCount(inferencePipelineCount: Long) = inferencePipelineCount(JsonField.of(inferencePipelineCount)) - /** The number of inference pipelines in the project. */ + /** + * Sets [Builder.inferencePipelineCount] to an arbitrary JSON value. + * + * You should usually call [Builder.inferencePipelineCount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { this.inferencePipelineCount = inferencePipelineCount } @@ -1055,14 +1542,26 @@ private constructor( /** Links to the project. */ fun links(links: Links) = links(JsonField.of(links)) - /** Links to the project. */ + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun links(links: JsonField) = apply { this.links = links } /** The number of tests in the monitoring mode of the project. */ fun monitoringGoalCount(monitoringGoalCount: Long) = monitoringGoalCount(JsonField.of(monitoringGoalCount)) - /** The number of tests in the monitoring mode of the project. */ + /** + * Sets [Builder.monitoringGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.monitoringGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { this.monitoringGoalCount = monitoringGoalCount } @@ -1070,28 +1569,52 @@ private constructor( /** The project name. */ fun name(name: String) = name(JsonField.of(name)) - /** The project name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The source of the project. */ fun source(source: Source?) = source(JsonField.ofNullable(source)) - /** The source of the project. */ + /** Alias for calling [Builder.source] with `source.orElse(null)`. */ fun source(source: Optional) = source(source.getOrNull()) - /** The source of the project. */ + /** + * Sets [Builder.source] to an arbitrary JSON value. + * + * You should usually call [Builder.source] with a well-typed [Source] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun source(source: JsonField) = apply { this.source = source } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) - /** The task type of the project. */ + /** + * Sets [Builder.taskType] to an arbitrary JSON value. + * + * You should usually call [Builder.taskType] with a well-typed [TaskType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun taskType(taskType: JsonField) = apply { this.taskType = taskType } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) - /** The number of versions (commits) in the project. */ + /** + * Sets [Builder.versionCount] to an arbitrary JSON value. + * + * You should usually call [Builder.versionCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun versionCount(versionCount: JsonField) = apply { this.versionCount = versionCount } @@ -1099,10 +1622,16 @@ private constructor( /** The workspace id. */ fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) - /** The workspace id. */ + /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) - /** The workspace id. */ + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } @@ -1110,18 +1639,32 @@ private constructor( /** The project description. */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** The project description. */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** The project description. */ - fun description(description: JsonField) = apply { - this.description = description + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description } fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) + /** Alias for calling [Builder.gitRepo] with `gitRepo.orElse(null)`. */ fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) + /** + * Sets [Builder.gitRepo] to an arbitrary JSON value. + * + * You should usually call [Builder.gitRepo] with a well-typed [GitRepo] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { @@ -1177,8 +1720,18 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun app(): String = app.getRequired("app") + /** + * Returns the raw JSON value of [app]. + * + * Unlike [app], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @@ -1225,6 +1778,13 @@ private constructor( fun app(app: String) = app(JsonField.of(app)) + /** + * Sets [Builder.app] to an arbitrary JSON value. + * + * You should usually call [Builder.app] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { @@ -1539,60 +2099,183 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun id(): String = id.getRequired("id") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun dateConnected(): OffsetDateTime = dateConnected.getRequired("dateConnected") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun gitId(): Long = gitId.getRequired("gitId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun name(): String = name.getRequired("name") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun private_(): Boolean = private_.getRequired("private") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun projectId(): String = projectId.getRequired("projectId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun slug(): String = slug.getRequired("slug") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun url(): String = url.getRequired("url") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [dateConnected]. + * + * Unlike [dateConnected], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected(): JsonField = dateConnected + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated + /** + * Returns the raw JSON value of [gitAccountId]. + * + * Unlike [gitAccountId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId(): JsonField = gitAccountId + /** + * Returns the raw JSON value of [gitId]. + * + * Unlike [gitId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gitId") @ExcludeMissing fun _gitId(): JsonField = gitId + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [private_]. + * + * Unlike [private_], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("private") @ExcludeMissing fun _private_(): JsonField = private_ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url + /** + * Returns the raw JSON value of [branch]. + * + * Unlike [branch], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch + /** + * Returns the raw JSON value of [rootDir]. + * + * Unlike [rootDir], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir @JsonAnyGetter @@ -1681,11 +2364,25 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) + /** + * Sets [Builder.dateConnected] to an arbitrary JSON value. + * + * You should usually call [Builder.dateConnected] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun dateConnected(dateConnected: JsonField) = apply { this.dateConnected = dateConnected } @@ -1693,46 +2390,116 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) + /** + * Sets [Builder.gitAccountId] to an arbitrary JSON value. + * + * You should usually call [Builder.gitAccountId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun gitAccountId(gitAccountId: JsonField) = apply { this.gitAccountId = gitAccountId } fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) + /** + * Sets [Builder.gitId] to an arbitrary JSON value. + * + * You should usually call [Builder.gitId] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitId(gitId: JsonField) = apply { this.gitId = gitId } fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun private_(private_: Boolean) = private_(JsonField.of(private_)) + /** + * Sets [Builder.private_] to an arbitrary JSON value. + * + * You should usually call [Builder.private_] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun private_(private_: JsonField) = apply { this.private_ = private_ } fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } fun slug(slug: String) = slug(JsonField.of(slug)) + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } fun url(url: String) = url(JsonField.of(url)) + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun url(url: JsonField) = apply { this.url = url } fun branch(branch: String) = branch(JsonField.of(branch)) + /** + * Sets [Builder.branch] to an arbitrary JSON value. + * + * You should usually call [Builder.branch] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun branch(branch: JsonField) = apply { this.branch = branch } fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) + /** + * Sets [Builder.rootDir] to an arbitrary JSON value. + * + * You should usually call [Builder.rootDir] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun additionalProperties(additionalProperties: Map) = apply { @@ -1865,120 +2632,270 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The workspace creator id. */ + /** + * The workspace creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The workspace creation date. */ + /** + * The workspace creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The workspace last updated date. */ + /** + * The workspace last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The number of invites in the workspace. */ + /** + * The number of invites in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun inviteCount(): Long = inviteCount.getRequired("inviteCount") - /** The number of members in the workspace. */ + /** + * The number of members in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun memberCount(): Long = memberCount.getRequired("memberCount") - /** The workspace name. */ + /** + * The workspace name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The end date of the current billing period. */ + /** + * The end date of the current billing period. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun periodEndDate(): Optional = Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) - /** The start date of the current billing period. */ + /** + * The start date of the current billing period. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun periodStartDate(): Optional = Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) - /** The number of projects in the workspace. */ + /** + * The number of projects in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectCount(): Long = projectCount.getRequired("projectCount") - /** The workspace slug. */ + /** + * The workspace slug. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun slug(): String = slug.getRequired("slug") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun status(): Status = status.getRequired("status") - /** The workspace invite code. */ + /** + * The workspace invite code. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun inviteCode(): Optional = Optional.ofNullable(inviteCode.getNullable("inviteCode")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun monthlyUsage(): Optional> = Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) - /** Whether the workspace only allows SAML authentication. */ + /** + * Whether the workspace only allows SAML authentication. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun samlOnlyAccess(): Optional = Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun wildcardDomains(): Optional> = Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) - /** The workspace id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The workspace creator id. */ + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId - /** The workspace creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The workspace last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The number of invites in the workspace. */ + /** + * Returns the raw JSON value of [inviteCount]. + * + * Unlike [inviteCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("inviteCount") @ExcludeMissing fun _inviteCount(): JsonField = inviteCount - /** The number of members in the workspace. */ + /** + * Returns the raw JSON value of [memberCount]. + * + * Unlike [memberCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("memberCount") @ExcludeMissing fun _memberCount(): JsonField = memberCount - /** The workspace name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The end date of the current billing period. */ + /** + * Returns the raw JSON value of [periodEndDate]. + * + * Unlike [periodEndDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("periodEndDate") @ExcludeMissing fun _periodEndDate(): JsonField = periodEndDate - /** The start date of the current billing period. */ + /** + * Returns the raw JSON value of [periodStartDate]. + * + * Unlike [periodStartDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("periodStartDate") @ExcludeMissing fun _periodStartDate(): JsonField = periodStartDate - /** The number of projects in the workspace. */ + /** + * Returns the raw JSON value of [projectCount]. + * + * Unlike [projectCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("projectCount") @ExcludeMissing fun _projectCount(): JsonField = projectCount - /** The workspace slug. */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The workspace invite code. */ + /** + * Returns the raw JSON value of [inviteCode]. + * + * Unlike [inviteCode], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("inviteCode") @ExcludeMissing fun _inviteCode(): JsonField = inviteCode + /** + * Returns the raw JSON value of [monthlyUsage]. + * + * Unlike [monthlyUsage], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("monthlyUsage") @ExcludeMissing fun _monthlyUsage(): JsonField> = monthlyUsage - /** Whether the workspace only allows SAML authentication. */ + /** + * Returns the raw JSON value of [samlOnlyAccess]. + * + * Unlike [samlOnlyAccess], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("samlOnlyAccess") @ExcludeMissing fun _samlOnlyAccess(): JsonField = samlOnlyAccess + /** + * Returns the raw JSON value of [wildcardDomains]. + * + * Unlike [wildcardDomains], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("wildcardDomains") @ExcludeMissing fun _wildcardDomains(): JsonField> = wildcardDomains @@ -2084,22 +3001,40 @@ private constructor( /** The workspace id. */ fun id(id: String) = id(JsonField.of(id)) - /** The workspace id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The workspace creator id. */ fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The workspace creator id. */ + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) - /** The workspace creator id. */ + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The workspace creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The workspace creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -2107,7 +3042,13 @@ private constructor( /** The workspace last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The workspace last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -2115,30 +3056,54 @@ private constructor( /** The number of invites in the workspace. */ fun inviteCount(inviteCount: Long) = inviteCount(JsonField.of(inviteCount)) - /** The number of invites in the workspace. */ + /** + * Sets [Builder.inviteCount] to an arbitrary JSON value. + * + * You should usually call [Builder.inviteCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun inviteCount(inviteCount: JsonField) = apply { this.inviteCount = inviteCount } /** The number of members in the workspace. */ fun memberCount(memberCount: Long) = memberCount(JsonField.of(memberCount)) - /** The number of members in the workspace. */ + /** + * Sets [Builder.memberCount] to an arbitrary JSON value. + * + * You should usually call [Builder.memberCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun memberCount(memberCount: JsonField) = apply { this.memberCount = memberCount } /** The workspace name. */ fun name(name: String) = name(JsonField.of(name)) - /** The workspace name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: OffsetDateTime?) = periodEndDate(JsonField.ofNullable(periodEndDate)) - /** The end date of the current billing period. */ + /** Alias for calling [Builder.periodEndDate] with `periodEndDate.orElse(null)`. */ fun periodEndDate(periodEndDate: Optional) = periodEndDate(periodEndDate.getOrNull()) - /** The end date of the current billing period. */ + /** + * Sets [Builder.periodEndDate] to an arbitrary JSON value. + * + * You should usually call [Builder.periodEndDate] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun periodEndDate(periodEndDate: JsonField) = apply { this.periodEndDate = periodEndDate } @@ -2147,11 +3112,17 @@ private constructor( fun periodStartDate(periodStartDate: OffsetDateTime?) = periodStartDate(JsonField.ofNullable(periodStartDate)) - /** The start date of the current billing period. */ + /** Alias for calling [Builder.periodStartDate] with `periodStartDate.orElse(null)`. */ fun periodStartDate(periodStartDate: Optional) = periodStartDate(periodStartDate.getOrNull()) - /** The start date of the current billing period. */ + /** + * Sets [Builder.periodStartDate] to an arbitrary JSON value. + * + * You should usually call [Builder.periodStartDate] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun periodStartDate(periodStartDate: JsonField) = apply { this.periodStartDate = periodStartDate } @@ -2159,7 +3130,13 @@ private constructor( /** The number of projects in the workspace. */ fun projectCount(projectCount: Long) = projectCount(JsonField.of(projectCount)) - /** The number of projects in the workspace. */ + /** + * Sets [Builder.projectCount] to an arbitrary JSON value. + * + * You should usually call [Builder.projectCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectCount(projectCount: JsonField) = apply { this.projectCount = projectCount } @@ -2167,26 +3144,57 @@ private constructor( /** The workspace slug. */ fun slug(slug: String) = slug(JsonField.of(slug)) - /** The workspace slug. */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } fun status(status: Status) = status(JsonField.of(status)) + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun status(status: JsonField) = apply { this.status = status } /** The workspace invite code. */ fun inviteCode(inviteCode: String) = inviteCode(JsonField.of(inviteCode)) - /** The workspace invite code. */ + /** + * Sets [Builder.inviteCode] to an arbitrary JSON value. + * + * You should usually call [Builder.inviteCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun inviteCode(inviteCode: JsonField) = apply { this.inviteCode = inviteCode } fun monthlyUsage(monthlyUsage: List) = monthlyUsage(JsonField.of(monthlyUsage)) + /** + * Sets [Builder.monthlyUsage] to an arbitrary JSON value. + * + * You should usually call [Builder.monthlyUsage] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun monthlyUsage(monthlyUsage: JsonField>) = apply { this.monthlyUsage = monthlyUsage.map { it.toMutableList() } } + /** + * Adds a single [MonthlyUsage] to [Builder.monthlyUsage]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMonthlyUsage(monthlyUsage: MonthlyUsage) = apply { this.monthlyUsage = (this.monthlyUsage ?: JsonField.of(mutableListOf())).also { @@ -2198,7 +3206,13 @@ private constructor( fun samlOnlyAccess(samlOnlyAccess: Boolean) = samlOnlyAccess(JsonField.of(samlOnlyAccess)) - /** Whether the workspace only allows SAML authentication. */ + /** + * Sets [Builder.samlOnlyAccess] to an arbitrary JSON value. + * + * You should usually call [Builder.samlOnlyAccess] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun samlOnlyAccess(samlOnlyAccess: JsonField) = apply { this.samlOnlyAccess = samlOnlyAccess } @@ -2206,10 +3220,22 @@ private constructor( fun wildcardDomains(wildcardDomains: List) = wildcardDomains(JsonField.of(wildcardDomains)) + /** + * Sets [Builder.wildcardDomains] to an arbitrary JSON value. + * + * You should usually call [Builder.wildcardDomains] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun wildcardDomains(wildcardDomains: JsonField>) = apply { this.wildcardDomains = wildcardDomains.map { it.toMutableList() } } + /** + * Adds a single [String] to [wildcardDomains]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addWildcardDomain(wildcardDomain: String) = apply { wildcardDomains = (wildcardDomains ?: JsonField.of(mutableListOf())).also { @@ -2413,23 +3439,53 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun executionTimeMs(): Optional = Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun monthYear(): Optional = Optional.ofNullable(monthYear.getNullable("monthYear")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun predictionCount(): Optional = Optional.ofNullable(predictionCount.getNullable("predictionCount")) + /** + * Returns the raw JSON value of [executionTimeMs]. + * + * Unlike [executionTimeMs], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("executionTimeMs") @ExcludeMissing fun _executionTimeMs(): JsonField = executionTimeMs + /** + * Returns the raw JSON value of [monthYear]. + * + * Unlike [monthYear], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("monthYear") @ExcludeMissing fun _monthYear(): JsonField = monthYear + /** + * Returns the raw JSON value of [predictionCount]. + * + * Unlike [predictionCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("predictionCount") @ExcludeMissing fun _predictionCount(): JsonField = predictionCount @@ -2478,18 +3534,40 @@ private constructor( fun executionTimeMs(executionTimeMs: Long?) = executionTimeMs(JsonField.ofNullable(executionTimeMs)) + /** + * Alias for [Builder.executionTimeMs]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun executionTimeMs(executionTimeMs: Long) = executionTimeMs(executionTimeMs as Long?) + /** + * Alias for calling [Builder.executionTimeMs] with `executionTimeMs.orElse(null)`. + */ fun executionTimeMs(executionTimeMs: Optional) = executionTimeMs(executionTimeMs.getOrNull()) + /** + * Sets [Builder.executionTimeMs] to an arbitrary JSON value. + * + * You should usually call [Builder.executionTimeMs] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun executionTimeMs(executionTimeMs: JsonField) = apply { this.executionTimeMs = executionTimeMs } fun monthYear(monthYear: LocalDate) = monthYear(JsonField.of(monthYear)) + /** + * Sets [Builder.monthYear] to an arbitrary JSON value. + * + * You should usually call [Builder.monthYear] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun monthYear(monthYear: JsonField) = apply { this.monthYear = monthYear } @@ -2497,6 +3575,13 @@ private constructor( fun predictionCount(predictionCount: Long) = predictionCount(JsonField.of(predictionCount)) + /** + * Sets [Builder.predictionCount] to an arbitrary JSON value. + * + * You should usually call [Builder.predictionCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun predictionCount(predictionCount: JsonField) = apply { this.predictionCount = predictionCount } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt index 402bf8bc..4b533336 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt @@ -44,16 +44,34 @@ private constructor( fun inferencePipelineId(): String = inferencePipelineId - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + /** + * Configuration for the data stream. Depends on your **Openlayer project task type**. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun config(): Config = body.config() - /** A list of inference data points with inputs and outputs */ + /** + * A list of inference data points with inputs and outputs + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun rows(): List = body.rows() - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ fun _config(): JsonField = body._config() - /** A list of inference data points with inputs and outputs */ + /** + * Returns the raw JSON value of [rows]. + * + * Unlike [rows], this method doesn't throw if the JSON field has an unexpected type. + */ fun _rows(): JsonField> = body._rows() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -89,16 +107,34 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + /** + * Configuration for the data stream. Depends on your **Openlayer project task type**. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun config(): Config = config.getRequired("config") - /** A list of inference data points with inputs and outputs */ + /** + * A list of inference data points with inputs and outputs + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun rows(): List = rows.getRequired("rows") - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("config") @ExcludeMissing fun _config(): JsonField = config - /** A list of inference data points with inputs and outputs */ + /** + * Returns the raw JSON value of [rows]. + * + * Unlike [rows], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("rows") @ExcludeMissing fun _rows(): JsonField> = rows @JsonAnyGetter @@ -153,29 +189,34 @@ private constructor( fun config(config: Config) = config(JsonField.of(config)) /** - * Configuration for the data stream. Depends on your **Openlayer project task type**. + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [Config] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun config(config: JsonField) = apply { this.config = config } - /** - * Configuration for the data stream. Depends on your **Openlayer project task type**. - */ + /** Alias for calling [config] with `Config.ofLlmData(llmData)`. */ fun config(llmData: Config.LlmData) = config(Config.ofLlmData(llmData)) /** - * Configuration for the data stream. Depends on your **Openlayer project task type**. + * Alias for calling [config] with + * `Config.ofTabularClassificationData(tabularClassificationData)`. */ fun config(tabularClassificationData: Config.TabularClassificationData) = config(Config.ofTabularClassificationData(tabularClassificationData)) /** - * Configuration for the data stream. Depends on your **Openlayer project task type**. + * Alias for calling [config] with + * `Config.ofTabularRegressionData(tabularRegressionData)`. */ fun config(tabularRegressionData: Config.TabularRegressionData) = config(Config.ofTabularRegressionData(tabularRegressionData)) /** - * Configuration for the data stream. Depends on your **Openlayer project task type**. + * Alias for calling [config] with + * `Config.ofTextClassificationData(textClassificationData)`. */ fun config(textClassificationData: Config.TextClassificationData) = config(Config.ofTextClassificationData(textClassificationData)) @@ -183,12 +224,22 @@ private constructor( /** A list of inference data points with inputs and outputs */ fun rows(rows: List) = rows(JsonField.of(rows)) - /** A list of inference data points with inputs and outputs */ + /** + * Sets [Builder.rows] to an arbitrary JSON value. + * + * You should usually call [Builder.rows] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun rows(rows: JsonField>) = apply { this.rows = rows.map { it.toMutableList() } } - /** A list of inference data points with inputs and outputs */ + /** + * Adds a single [Row] to [rows]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addRow(row: Row) = apply { rows = (rows ?: JsonField.of(mutableListOf())).also { checkKnown("rows", it).add(row) } @@ -280,23 +331,36 @@ private constructor( /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ fun config(config: Config) = apply { body.config(config) } - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + /** + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [Config] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun config(config: JsonField) = apply { body.config(config) } - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + /** Alias for calling [config] with `Config.ofLlmData(llmData)`. */ fun config(llmData: Config.LlmData) = apply { body.config(llmData) } - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + /** + * Alias for calling [config] with + * `Config.ofTabularClassificationData(tabularClassificationData)`. + */ fun config(tabularClassificationData: Config.TabularClassificationData) = apply { body.config(tabularClassificationData) } - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + /** + * Alias for calling [config] with `Config.ofTabularRegressionData(tabularRegressionData)`. + */ fun config(tabularRegressionData: Config.TabularRegressionData) = apply { body.config(tabularRegressionData) } - /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + /** + * Alias for calling [config] with + * `Config.ofTextClassificationData(textClassificationData)`. + */ fun config(textClassificationData: Config.TextClassificationData) = apply { body.config(textClassificationData) } @@ -304,10 +368,19 @@ private constructor( /** A list of inference data points with inputs and outputs */ fun rows(rows: List) = apply { body.rows(rows) } - /** A list of inference data points with inputs and outputs */ + /** + * Sets [Builder.rows] to an arbitrary JSON value. + * + * You should usually call [Builder.rows] with a well-typed `List` value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun rows(rows: JsonField>) = apply { body.rows(rows) } - /** A list of inference data points with inputs and outputs */ + /** + * Adds a single [Row] to [rows]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addRow(row: Row) = apply { body.addRow(row) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { @@ -687,52 +760,97 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the column with the model outputs. */ + /** + * Name of the column with the model outputs. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun outputColumnName(): String = outputColumnName.getRequired("outputColumnName") /** * Name of the column with the context retrieved. Applies to RAG use cases. Providing * the context enables RAG-specific metrics. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun contextColumnName(): Optional = Optional.ofNullable(contextColumnName.getNullable("contextColumnName")) - /** Name of the column with the cost associated with each row. */ + /** + * Name of the column with the cost associated with each row. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun costColumnName(): Optional = Optional.ofNullable(costColumnName.getNullable("costColumnName")) - /** Name of the column with the ground truths. */ + /** + * Name of the column with the ground truths. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun groundTruthColumnName(): Optional = Optional.ofNullable(groundTruthColumnName.getNullable("groundTruthColumnName")) /** * Name of the column with the inference ids. This is useful if you want to update rows * at a later point in time. If not provided, a unique id is generated by Openlayer. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun inferenceIdColumnName(): Optional = Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) - /** Array of input variable names. Each input variable should be a dataset column. */ + /** + * Array of input variable names. Each input variable should be a dataset column. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun inputVariableNames(): Optional> = Optional.ofNullable(inputVariableNames.getNullable("inputVariableNames")) - /** Name of the column with the latencies. */ + /** + * Name of the column with the latencies. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata - /** Name of the column with the total number of tokens. */ + /** + * Name of the column with the total number of tokens. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun numOfTokenColumnName(): Optional = Optional.ofNullable(numOfTokenColumnName.getNullable("numOfTokenColumnName")) - /** Prompt for the LLM. */ + /** + * Prompt for the LLM. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun prompt(): Optional> = Optional.ofNullable(prompt.getNullable("prompt")) /** * Name of the column with the questions. Applies to RAG use cases. Providing the * question enables RAG-specific metrics. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun questionColumnName(): Optional = Optional.ofNullable(questionColumnName.getNullable("questionColumnName")) @@ -740,70 +858,115 @@ private constructor( /** * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not * provided, the upload timestamp is used. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun timestampColumnName(): Optional = Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) - /** Name of the column with the model outputs. */ + /** + * Returns the raw JSON value of [outputColumnName]. + * + * Unlike [outputColumnName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("outputColumnName") @ExcludeMissing fun _outputColumnName(): JsonField = outputColumnName /** - * Name of the column with the context retrieved. Applies to RAG use cases. Providing - * the context enables RAG-specific metrics. + * Returns the raw JSON value of [contextColumnName]. + * + * Unlike [contextColumnName], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("contextColumnName") @ExcludeMissing fun _contextColumnName(): JsonField = contextColumnName - /** Name of the column with the cost associated with each row. */ + /** + * Returns the raw JSON value of [costColumnName]. + * + * Unlike [costColumnName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("costColumnName") @ExcludeMissing fun _costColumnName(): JsonField = costColumnName - /** Name of the column with the ground truths. */ + /** + * Returns the raw JSON value of [groundTruthColumnName]. + * + * Unlike [groundTruthColumnName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("groundTruthColumnName") @ExcludeMissing fun _groundTruthColumnName(): JsonField = groundTruthColumnName /** - * Name of the column with the inference ids. This is useful if you want to update rows - * at a later point in time. If not provided, a unique id is generated by Openlayer. + * Returns the raw JSON value of [inferenceIdColumnName]. + * + * Unlike [inferenceIdColumnName], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("inferenceIdColumnName") @ExcludeMissing fun _inferenceIdColumnName(): JsonField = inferenceIdColumnName - /** Array of input variable names. Each input variable should be a dataset column. */ + /** + * Returns the raw JSON value of [inputVariableNames]. + * + * Unlike [inputVariableNames], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("inputVariableNames") @ExcludeMissing fun _inputVariableNames(): JsonField> = inputVariableNames - /** Name of the column with the latencies. */ + /** + * Returns the raw JSON value of [latencyColumnName]. + * + * Unlike [latencyColumnName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("latencyColumnName") @ExcludeMissing fun _latencyColumnName(): JsonField = latencyColumnName - /** Name of the column with the total number of tokens. */ + /** + * Returns the raw JSON value of [numOfTokenColumnName]. + * + * Unlike [numOfTokenColumnName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("numOfTokenColumnName") @ExcludeMissing fun _numOfTokenColumnName(): JsonField = numOfTokenColumnName - /** Prompt for the LLM. */ + /** + * Returns the raw JSON value of [prompt]. + * + * Unlike [prompt], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("prompt") @ExcludeMissing fun _prompt(): JsonField> = prompt /** - * Name of the column with the questions. Applies to RAG use cases. Providing the - * question enables RAG-specific metrics. + * Returns the raw JSON value of [questionColumnName]. + * + * Unlike [questionColumnName], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("questionColumnName") @ExcludeMissing fun _questionColumnName(): JsonField = questionColumnName /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not - * provided, the upload timestamp is used. + * Returns the raw JSON value of [timestampColumnName]. + * + * Unlike [timestampColumnName], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("timestampColumnName") @ExcludeMissing @@ -887,7 +1050,13 @@ private constructor( fun outputColumnName(outputColumnName: String) = outputColumnName(JsonField.of(outputColumnName)) - /** Name of the column with the model outputs. */ + /** + * Sets [Builder.outputColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.outputColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun outputColumnName(outputColumnName: JsonField) = apply { this.outputColumnName = outputColumnName } @@ -900,8 +1069,11 @@ private constructor( contextColumnName(JsonField.of(contextColumnName)) /** - * Name of the column with the context retrieved. Applies to RAG use cases. - * Providing the context enables RAG-specific metrics. + * Sets [Builder.contextColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.contextColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ fun contextColumnName(contextColumnName: JsonField) = apply { this.contextColumnName = contextColumnName @@ -911,7 +1083,13 @@ private constructor( fun costColumnName(costColumnName: String) = costColumnName(JsonField.of(costColumnName)) - /** Name of the column with the cost associated with each row. */ + /** + * Sets [Builder.costColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.costColumnName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun costColumnName(costColumnName: JsonField) = apply { this.costColumnName = costColumnName } @@ -920,7 +1098,13 @@ private constructor( fun groundTruthColumnName(groundTruthColumnName: String) = groundTruthColumnName(JsonField.of(groundTruthColumnName)) - /** Name of the column with the ground truths. */ + /** + * Sets [Builder.groundTruthColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.groundTruthColumnName] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun groundTruthColumnName(groundTruthColumnName: JsonField) = apply { this.groundTruthColumnName = groundTruthColumnName } @@ -934,9 +1118,11 @@ private constructor( inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) /** - * Name of the column with the inference ids. This is useful if you want to update - * rows at a later point in time. If not provided, a unique id is generated by - * Openlayer. + * Sets [Builder.inferenceIdColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.inferenceIdColumnName] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { this.inferenceIdColumnName = inferenceIdColumnName @@ -949,14 +1135,20 @@ private constructor( inputVariableNames(JsonField.of(inputVariableNames)) /** - * Array of input variable names. Each input variable should be a dataset column. + * Sets [Builder.inputVariableNames] to an arbitrary JSON value. + * + * You should usually call [Builder.inputVariableNames] with a well-typed + * `List` value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ fun inputVariableNames(inputVariableNames: JsonField>) = apply { this.inputVariableNames = inputVariableNames.map { it.toMutableList() } } /** - * Array of input variable names. Each input variable should be a dataset column. + * Adds a single [String] to [inputVariableNames]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addInputVariableName(inputVariableName: String) = apply { inputVariableNames = @@ -969,7 +1161,13 @@ private constructor( fun latencyColumnName(latencyColumnName: String) = latencyColumnName(JsonField.of(latencyColumnName)) - /** Name of the column with the latencies. */ + /** + * Sets [Builder.latencyColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.latencyColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun latencyColumnName(latencyColumnName: JsonField) = apply { this.latencyColumnName = latencyColumnName } @@ -981,11 +1179,20 @@ private constructor( fun numOfTokenColumnName(numOfTokenColumnName: String?) = numOfTokenColumnName(JsonField.ofNullable(numOfTokenColumnName)) - /** Name of the column with the total number of tokens. */ + /** + * Alias for calling [Builder.numOfTokenColumnName] with + * `numOfTokenColumnName.orElse(null)`. + */ fun numOfTokenColumnName(numOfTokenColumnName: Optional) = numOfTokenColumnName(numOfTokenColumnName.getOrNull()) - /** Name of the column with the total number of tokens. */ + /** + * Sets [Builder.numOfTokenColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.numOfTokenColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun numOfTokenColumnName(numOfTokenColumnName: JsonField) = apply { this.numOfTokenColumnName = numOfTokenColumnName } @@ -993,12 +1200,22 @@ private constructor( /** Prompt for the LLM. */ fun prompt(prompt: List) = prompt(JsonField.of(prompt)) - /** Prompt for the LLM. */ + /** + * Sets [Builder.prompt] to an arbitrary JSON value. + * + * You should usually call [Builder.prompt] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun prompt(prompt: JsonField>) = apply { this.prompt = prompt.map { it.toMutableList() } } - /** Prompt for the LLM. */ + /** + * Adds a single [Prompt] to [Builder.prompt]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addPrompt(prompt: Prompt) = apply { this.prompt = (this.prompt ?: JsonField.of(mutableListOf())).also { @@ -1014,8 +1231,11 @@ private constructor( questionColumnName(JsonField.of(questionColumnName)) /** - * Name of the column with the questions. Applies to RAG use cases. Providing the - * question enables RAG-specific metrics. + * Sets [Builder.questionColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.questionColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ fun questionColumnName(questionColumnName: JsonField) = apply { this.questionColumnName = questionColumnName @@ -1029,8 +1249,11 @@ private constructor( timestampColumnName(JsonField.of(timestampColumnName)) /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If - * not provided, the upload timestamp is used. + * Sets [Builder.timestampColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.timestampColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ fun timestampColumnName(timestampColumnName: JsonField) = apply { this.timestampColumnName = timestampColumnName @@ -1090,17 +1313,37 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Content of the prompt. */ + /** + * Content of the prompt. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun content(): Optional = Optional.ofNullable(content.getNullable("content")) - /** Role of the prompt. */ + /** + * Role of the prompt. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun role(): Optional = Optional.ofNullable(role.getNullable("role")) - /** Content of the prompt. */ + /** + * Returns the raw JSON value of [content]. + * + * Unlike [content], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("content") @ExcludeMissing fun _content(): JsonField = content - /** Role of the prompt. */ + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role @JsonAnyGetter @@ -1144,13 +1387,25 @@ private constructor( /** Content of the prompt. */ fun content(content: String) = content(JsonField.of(content)) - /** Content of the prompt. */ + /** + * Sets [Builder.content] to an arbitrary JSON value. + * + * You should usually call [Builder.content] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun content(content: JsonField) = apply { this.content = content } /** Role of the prompt. */ fun role(role: String) = role(JsonField.of(role)) - /** Role of the prompt. */ + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun role(role: JsonField) = apply { this.role = role } fun additionalProperties(additionalProperties: Map) = apply { @@ -1255,23 +1510,38 @@ private constructor( /** * List of class names indexed by label integer in the dataset. E.g. * ["Retained", "Exited"] when 0, 1 are in your label column. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). */ fun classNames(): List = classNames.getRequired("classNames") /** * Array with the names of all categorical features in the dataset. E.g. * ["Age", "Geography"]. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun categoricalFeatureNames(): Optional> = Optional.ofNullable(categoricalFeatureNames.getNullable("categoricalFeatureNames")) - /** Array with all input feature names. */ + /** + * Array with all input feature names. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun featureNames(): Optional> = Optional.ofNullable(featureNames.getNullable("featureNames")) /** * Name of the column with the inference ids. This is useful if you want to update rows * at a later point in time. If not provided, a unique id is generated by Openlayer. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun inferenceIdColumnName(): Optional = Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) @@ -1279,23 +1549,39 @@ private constructor( /** * Name of the column with the labels. The data in this column must be **zero-indexed * integers**, matching the list provided in `classNames`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun labelColumnName(): Optional = Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) - /** Name of the column with the latencies. */ + /** + * Name of the column with the latencies. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata - /** Name of the column with the model's predictions as **zero-indexed integers**. */ + /** + * Name of the column with the model's predictions as **zero-indexed integers**. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun predictionsColumnName(): Optional = Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) /** * Name of the column with the model's predictions as **lists of class probabilities**. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun predictionScoresColumnName(): Optional = Optional.ofNullable( @@ -1305,67 +1591,98 @@ private constructor( /** * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not * provided, the upload timestamp is used. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun timestampColumnName(): Optional = Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) /** - * List of class names indexed by label integer in the dataset. E.g. - * ["Retained", "Exited"] when 0, 1 are in your label column. + * Returns the raw JSON value of [classNames]. + * + * Unlike [classNames], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("classNames") @ExcludeMissing fun _classNames(): JsonField> = classNames /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Age", "Geography"]. + * Returns the raw JSON value of [categoricalFeatureNames]. + * + * Unlike [categoricalFeatureNames], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("categoricalFeatureNames") @ExcludeMissing fun _categoricalFeatureNames(): JsonField> = categoricalFeatureNames - /** Array with all input feature names. */ + /** + * Returns the raw JSON value of [featureNames]. + * + * Unlike [featureNames], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("featureNames") @ExcludeMissing fun _featureNames(): JsonField> = featureNames /** - * Name of the column with the inference ids. This is useful if you want to update rows - * at a later point in time. If not provided, a unique id is generated by Openlayer. + * Returns the raw JSON value of [inferenceIdColumnName]. + * + * Unlike [inferenceIdColumnName], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("inferenceIdColumnName") @ExcludeMissing fun _inferenceIdColumnName(): JsonField = inferenceIdColumnName /** - * Name of the column with the labels. The data in this column must be **zero-indexed - * integers**, matching the list provided in `classNames`. + * Returns the raw JSON value of [labelColumnName]. + * + * Unlike [labelColumnName], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("labelColumnName") @ExcludeMissing fun _labelColumnName(): JsonField = labelColumnName - /** Name of the column with the latencies. */ + /** + * Returns the raw JSON value of [latencyColumnName]. + * + * Unlike [latencyColumnName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("latencyColumnName") @ExcludeMissing fun _latencyColumnName(): JsonField = latencyColumnName - /** Name of the column with the model's predictions as **zero-indexed integers**. */ + /** + * Returns the raw JSON value of [predictionsColumnName]. + * + * Unlike [predictionsColumnName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("predictionsColumnName") @ExcludeMissing fun _predictionsColumnName(): JsonField = predictionsColumnName /** - * Name of the column with the model's predictions as **lists of class probabilities**. + * Returns the raw JSON value of [predictionScoresColumnName]. + * + * Unlike [predictionScoresColumnName], this method doesn't throw if the JSON field has + * an unexpected type. */ @JsonProperty("predictionScoresColumnName") @ExcludeMissing fun _predictionScoresColumnName(): JsonField = predictionScoresColumnName /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not - * provided, the upload timestamp is used. + * Returns the raw JSON value of [timestampColumnName]. + * + * Unlike [timestampColumnName], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("timestampColumnName") @ExcludeMissing @@ -1450,16 +1767,20 @@ private constructor( fun classNames(classNames: List) = classNames(JsonField.of(classNames)) /** - * List of class names indexed by label integer in the dataset. E.g. - * ["Retained", "Exited"] when 0, 1 are in your label column. + * Sets [Builder.classNames] to an arbitrary JSON value. + * + * You should usually call [Builder.classNames] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ fun classNames(classNames: JsonField>) = apply { this.classNames = classNames.map { it.toMutableList() } } /** - * List of class names indexed by label integer in the dataset. E.g. - * ["Retained", "Exited"] when 0, 1 are in your label column. + * Adds a single [String] to [classNames]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addClassName(className: String) = apply { classNames = @@ -1476,8 +1797,11 @@ private constructor( categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Age", "Geography"]. + * Sets [Builder.categoricalFeatureNames] to an arbitrary JSON value. + * + * You should usually call [Builder.categoricalFeatureNames] with a well-typed + * `List` value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ fun categoricalFeatureNames(categoricalFeatureNames: JsonField>) = apply { @@ -1486,8 +1810,9 @@ private constructor( } /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Age", "Geography"]. + * Adds a single [String] to [categoricalFeatureNames]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addCategoricalFeatureName(categoricalFeatureName: String) = apply { categoricalFeatureNames = @@ -1500,12 +1825,22 @@ private constructor( fun featureNames(featureNames: List) = featureNames(JsonField.of(featureNames)) - /** Array with all input feature names. */ + /** + * Sets [Builder.featureNames] to an arbitrary JSON value. + * + * You should usually call [Builder.featureNames] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun featureNames(featureNames: JsonField>) = apply { this.featureNames = featureNames.map { it.toMutableList() } } - /** Array with all input feature names. */ + /** + * Adds a single [String] to [featureNames]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addFeatureName(featureName: String) = apply { featureNames = (featureNames ?: JsonField.of(mutableListOf())).also { @@ -1522,9 +1857,11 @@ private constructor( inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) /** - * Name of the column with the inference ids. This is useful if you want to update - * rows at a later point in time. If not provided, a unique id is generated by - * Openlayer. + * Sets [Builder.inferenceIdColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.inferenceIdColumnName] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { this.inferenceIdColumnName = inferenceIdColumnName @@ -1538,8 +1875,11 @@ private constructor( labelColumnName(JsonField.of(labelColumnName)) /** - * Name of the column with the labels. The data in this column must be - * **zero-indexed integers**, matching the list provided in `classNames`. + * Sets [Builder.labelColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.labelColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ fun labelColumnName(labelColumnName: JsonField) = apply { this.labelColumnName = labelColumnName @@ -1549,7 +1889,13 @@ private constructor( fun latencyColumnName(latencyColumnName: String) = latencyColumnName(JsonField.of(latencyColumnName)) - /** Name of the column with the latencies. */ + /** + * Sets [Builder.latencyColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.latencyColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun latencyColumnName(latencyColumnName: JsonField) = apply { this.latencyColumnName = latencyColumnName } @@ -1561,7 +1907,13 @@ private constructor( fun predictionsColumnName(predictionsColumnName: String) = predictionsColumnName(JsonField.of(predictionsColumnName)) - /** Name of the column with the model's predictions as **zero-indexed integers**. */ + /** + * Sets [Builder.predictionsColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.predictionsColumnName] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun predictionsColumnName(predictionsColumnName: JsonField) = apply { this.predictionsColumnName = predictionsColumnName } @@ -1574,8 +1926,11 @@ private constructor( predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) /** - * Name of the column with the model's predictions as **lists of class - * probabilities**. + * Sets [Builder.predictionScoresColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.predictionScoresColumnName] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ fun predictionScoresColumnName(predictionScoresColumnName: JsonField) = apply { @@ -1590,8 +1945,11 @@ private constructor( timestampColumnName(JsonField.of(timestampColumnName)) /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If - * not provided, the upload timestamp is used. + * Sets [Builder.timestampColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.timestampColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ fun timestampColumnName(timestampColumnName: JsonField) = apply { this.timestampColumnName = timestampColumnName @@ -1688,82 +2046,137 @@ private constructor( /** * Array with the names of all categorical features in the dataset. E.g. * ["Gender", "Geography"]. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun categoricalFeatureNames(): Optional> = Optional.ofNullable(categoricalFeatureNames.getNullable("categoricalFeatureNames")) - /** Array with all input feature names. */ + /** + * Array with all input feature names. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun featureNames(): Optional> = Optional.ofNullable(featureNames.getNullable("featureNames")) /** * Name of the column with the inference ids. This is useful if you want to update rows * at a later point in time. If not provided, a unique id is generated by Openlayer. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun inferenceIdColumnName(): Optional = Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) - /** Name of the column with the latencies. */ + /** + * Name of the column with the latencies. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata - /** Name of the column with the model's predictions. */ + /** + * Name of the column with the model's predictions. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun predictionsColumnName(): Optional = Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) - /** Name of the column with the targets (ground truth values). */ + /** + * Name of the column with the targets (ground truth values). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun targetColumnName(): Optional = Optional.ofNullable(targetColumnName.getNullable("targetColumnName")) /** * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not * provided, the upload timestamp is used. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun timestampColumnName(): Optional = Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Gender", "Geography"]. + * Returns the raw JSON value of [categoricalFeatureNames]. + * + * Unlike [categoricalFeatureNames], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("categoricalFeatureNames") @ExcludeMissing fun _categoricalFeatureNames(): JsonField> = categoricalFeatureNames - /** Array with all input feature names. */ + /** + * Returns the raw JSON value of [featureNames]. + * + * Unlike [featureNames], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("featureNames") @ExcludeMissing fun _featureNames(): JsonField> = featureNames /** - * Name of the column with the inference ids. This is useful if you want to update rows - * at a later point in time. If not provided, a unique id is generated by Openlayer. + * Returns the raw JSON value of [inferenceIdColumnName]. + * + * Unlike [inferenceIdColumnName], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("inferenceIdColumnName") @ExcludeMissing fun _inferenceIdColumnName(): JsonField = inferenceIdColumnName - /** Name of the column with the latencies. */ + /** + * Returns the raw JSON value of [latencyColumnName]. + * + * Unlike [latencyColumnName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("latencyColumnName") @ExcludeMissing fun _latencyColumnName(): JsonField = latencyColumnName - /** Name of the column with the model's predictions. */ + /** + * Returns the raw JSON value of [predictionsColumnName]. + * + * Unlike [predictionsColumnName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("predictionsColumnName") @ExcludeMissing fun _predictionsColumnName(): JsonField = predictionsColumnName - /** Name of the column with the targets (ground truth values). */ + /** + * Returns the raw JSON value of [targetColumnName]. + * + * Unlike [targetColumnName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("targetColumnName") @ExcludeMissing fun _targetColumnName(): JsonField = targetColumnName /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not - * provided, the upload timestamp is used. + * Returns the raw JSON value of [timestampColumnName]. + * + * Unlike [timestampColumnName], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("timestampColumnName") @ExcludeMissing @@ -1836,8 +2249,11 @@ private constructor( categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Gender", "Geography"]. + * Sets [Builder.categoricalFeatureNames] to an arbitrary JSON value. + * + * You should usually call [Builder.categoricalFeatureNames] with a well-typed + * `List` value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ fun categoricalFeatureNames(categoricalFeatureNames: JsonField>) = apply { @@ -1846,8 +2262,9 @@ private constructor( } /** - * Array with the names of all categorical features in the dataset. E.g. - * ["Gender", "Geography"]. + * Adds a single [String] to [categoricalFeatureNames]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addCategoricalFeatureName(categoricalFeatureName: String) = apply { categoricalFeatureNames = @@ -1860,12 +2277,22 @@ private constructor( fun featureNames(featureNames: List) = featureNames(JsonField.of(featureNames)) - /** Array with all input feature names. */ + /** + * Sets [Builder.featureNames] to an arbitrary JSON value. + * + * You should usually call [Builder.featureNames] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun featureNames(featureNames: JsonField>) = apply { this.featureNames = featureNames.map { it.toMutableList() } } - /** Array with all input feature names. */ + /** + * Adds a single [String] to [featureNames]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addFeatureName(featureName: String) = apply { featureNames = (featureNames ?: JsonField.of(mutableListOf())).also { @@ -1882,9 +2309,11 @@ private constructor( inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) /** - * Name of the column with the inference ids. This is useful if you want to update - * rows at a later point in time. If not provided, a unique id is generated by - * Openlayer. + * Sets [Builder.inferenceIdColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.inferenceIdColumnName] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { this.inferenceIdColumnName = inferenceIdColumnName @@ -1894,7 +2323,13 @@ private constructor( fun latencyColumnName(latencyColumnName: String) = latencyColumnName(JsonField.of(latencyColumnName)) - /** Name of the column with the latencies. */ + /** + * Sets [Builder.latencyColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.latencyColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun latencyColumnName(latencyColumnName: JsonField) = apply { this.latencyColumnName = latencyColumnName } @@ -1906,7 +2341,13 @@ private constructor( fun predictionsColumnName(predictionsColumnName: String) = predictionsColumnName(JsonField.of(predictionsColumnName)) - /** Name of the column with the model's predictions. */ + /** + * Sets [Builder.predictionsColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.predictionsColumnName] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun predictionsColumnName(predictionsColumnName: JsonField) = apply { this.predictionsColumnName = predictionsColumnName } @@ -1915,7 +2356,13 @@ private constructor( fun targetColumnName(targetColumnName: String) = targetColumnName(JsonField.of(targetColumnName)) - /** Name of the column with the targets (ground truth values). */ + /** + * Sets [Builder.targetColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.targetColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun targetColumnName(targetColumnName: JsonField) = apply { this.targetColumnName = targetColumnName } @@ -1928,8 +2375,11 @@ private constructor( timestampColumnName(JsonField.of(timestampColumnName)) /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If - * not provided, the upload timestamp is used. + * Sets [Builder.timestampColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.timestampColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ fun timestampColumnName(timestampColumnName: JsonField) = apply { this.timestampColumnName = timestampColumnName @@ -2027,12 +2477,19 @@ private constructor( /** * List of class names indexed by label integer in the dataset. E.g. * ["Retained", "Exited"] when 0, 1 are in your label column. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). */ fun classNames(): List = classNames.getRequired("classNames") /** * Name of the column with the inference ids. This is useful if you want to update rows * at a later point in time. If not provided, a unique id is generated by Openlayer. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun inferenceIdColumnName(): Optional = Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) @@ -2040,89 +2497,139 @@ private constructor( /** * Name of the column with the labels. The data in this column must be **zero-indexed * integers**, matching the list provided in `classNames`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun labelColumnName(): Optional = Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) - /** Name of the column with the latencies. */ + /** + * Name of the column with the latencies. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata - /** Name of the column with the model's predictions as **zero-indexed integers**. */ + /** + * Name of the column with the model's predictions as **zero-indexed integers**. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun predictionsColumnName(): Optional = Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) /** * Name of the column with the model's predictions as **lists of class probabilities**. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun predictionScoresColumnName(): Optional = Optional.ofNullable( predictionScoresColumnName.getNullable("predictionScoresColumnName") ) - /** Name of the column with the text data. */ + /** + * Name of the column with the text data. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun textColumnName(): Optional = Optional.ofNullable(textColumnName.getNullable("textColumnName")) /** * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not * provided, the upload timestamp is used. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun timestampColumnName(): Optional = Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) /** - * List of class names indexed by label integer in the dataset. E.g. - * ["Retained", "Exited"] when 0, 1 are in your label column. + * Returns the raw JSON value of [classNames]. + * + * Unlike [classNames], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("classNames") @ExcludeMissing fun _classNames(): JsonField> = classNames /** - * Name of the column with the inference ids. This is useful if you want to update rows - * at a later point in time. If not provided, a unique id is generated by Openlayer. + * Returns the raw JSON value of [inferenceIdColumnName]. + * + * Unlike [inferenceIdColumnName], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("inferenceIdColumnName") @ExcludeMissing fun _inferenceIdColumnName(): JsonField = inferenceIdColumnName /** - * Name of the column with the labels. The data in this column must be **zero-indexed - * integers**, matching the list provided in `classNames`. + * Returns the raw JSON value of [labelColumnName]. + * + * Unlike [labelColumnName], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("labelColumnName") @ExcludeMissing fun _labelColumnName(): JsonField = labelColumnName - /** Name of the column with the latencies. */ + /** + * Returns the raw JSON value of [latencyColumnName]. + * + * Unlike [latencyColumnName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("latencyColumnName") @ExcludeMissing fun _latencyColumnName(): JsonField = latencyColumnName - /** Name of the column with the model's predictions as **zero-indexed integers**. */ + /** + * Returns the raw JSON value of [predictionsColumnName]. + * + * Unlike [predictionsColumnName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("predictionsColumnName") @ExcludeMissing fun _predictionsColumnName(): JsonField = predictionsColumnName /** - * Name of the column with the model's predictions as **lists of class probabilities**. + * Returns the raw JSON value of [predictionScoresColumnName]. + * + * Unlike [predictionScoresColumnName], this method doesn't throw if the JSON field has + * an unexpected type. */ @JsonProperty("predictionScoresColumnName") @ExcludeMissing fun _predictionScoresColumnName(): JsonField = predictionScoresColumnName - /** Name of the column with the text data. */ + /** + * Returns the raw JSON value of [textColumnName]. + * + * Unlike [textColumnName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("textColumnName") @ExcludeMissing fun _textColumnName(): JsonField = textColumnName /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not - * provided, the upload timestamp is used. + * Returns the raw JSON value of [timestampColumnName]. + * + * Unlike [timestampColumnName], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("timestampColumnName") @ExcludeMissing @@ -2202,16 +2709,20 @@ private constructor( fun classNames(classNames: List) = classNames(JsonField.of(classNames)) /** - * List of class names indexed by label integer in the dataset. E.g. - * ["Retained", "Exited"] when 0, 1 are in your label column. + * Sets [Builder.classNames] to an arbitrary JSON value. + * + * You should usually call [Builder.classNames] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ fun classNames(classNames: JsonField>) = apply { this.classNames = classNames.map { it.toMutableList() } } /** - * List of class names indexed by label integer in the dataset. E.g. - * ["Retained", "Exited"] when 0, 1 are in your label column. + * Adds a single [String] to [classNames]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addClassName(className: String) = apply { classNames = @@ -2229,9 +2740,11 @@ private constructor( inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) /** - * Name of the column with the inference ids. This is useful if you want to update - * rows at a later point in time. If not provided, a unique id is generated by - * Openlayer. + * Sets [Builder.inferenceIdColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.inferenceIdColumnName] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { this.inferenceIdColumnName = inferenceIdColumnName @@ -2245,8 +2758,11 @@ private constructor( labelColumnName(JsonField.of(labelColumnName)) /** - * Name of the column with the labels. The data in this column must be - * **zero-indexed integers**, matching the list provided in `classNames`. + * Sets [Builder.labelColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.labelColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ fun labelColumnName(labelColumnName: JsonField) = apply { this.labelColumnName = labelColumnName @@ -2256,7 +2772,13 @@ private constructor( fun latencyColumnName(latencyColumnName: String) = latencyColumnName(JsonField.of(latencyColumnName)) - /** Name of the column with the latencies. */ + /** + * Sets [Builder.latencyColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.latencyColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun latencyColumnName(latencyColumnName: JsonField) = apply { this.latencyColumnName = latencyColumnName } @@ -2268,7 +2790,13 @@ private constructor( fun predictionsColumnName(predictionsColumnName: String) = predictionsColumnName(JsonField.of(predictionsColumnName)) - /** Name of the column with the model's predictions as **zero-indexed integers**. */ + /** + * Sets [Builder.predictionsColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.predictionsColumnName] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun predictionsColumnName(predictionsColumnName: JsonField) = apply { this.predictionsColumnName = predictionsColumnName } @@ -2281,8 +2809,11 @@ private constructor( predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) /** - * Name of the column with the model's predictions as **lists of class - * probabilities**. + * Sets [Builder.predictionScoresColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.predictionScoresColumnName] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ fun predictionScoresColumnName(predictionScoresColumnName: JsonField) = apply { @@ -2293,7 +2824,13 @@ private constructor( fun textColumnName(textColumnName: String) = textColumnName(JsonField.of(textColumnName)) - /** Name of the column with the text data. */ + /** + * Sets [Builder.textColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.textColumnName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun textColumnName(textColumnName: JsonField) = apply { this.textColumnName = textColumnName } @@ -2306,8 +2843,11 @@ private constructor( timestampColumnName(JsonField.of(timestampColumnName)) /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If - * not provided, the upload timestamp is used. + * Sets [Builder.timestampColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.timestampColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ fun timestampColumnName(timestampColumnName: JsonField) = apply { this.timestampColumnName = timestampColumnName diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt index 1f2bbb17..004ade87 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt @@ -28,8 +28,17 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun success(): Success = success.getRequired("success") + /** + * Returns the raw JSON value of [success]. + * + * Unlike [success], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("success") @ExcludeMissing fun _success(): JsonField = success @JsonAnyGetter @@ -76,6 +85,12 @@ private constructor( fun success(success: Success) = success(JsonField.of(success)) + /** + * Sets [Builder.success] to an arbitrary JSON value. + * + * You should usually call [Builder.success] with a well-typed [Success] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun success(success: JsonField) = apply { this.success = success } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt index efa8c5fb..c9f87af9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt @@ -17,6 +17,7 @@ import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -38,8 +39,17 @@ private constructor( fun _row(): JsonValue = body._row() + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun config(): Optional = body.config() + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ fun _config(): JsonField = body._config() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -80,8 +90,17 @@ private constructor( @JsonProperty("row") @ExcludeMissing fun _row(): JsonValue = row + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun config(): Optional = Optional.ofNullable(config.getNullable("config")) + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("config") @ExcludeMissing fun _config(): JsonField = config @JsonAnyGetter @@ -132,8 +151,16 @@ private constructor( fun config(config: Config?) = config(JsonField.ofNullable(config)) + /** Alias for calling [Builder.config] with `config.orElse(null)`. */ fun config(config: Optional) = config(config.getOrNull()) + /** + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [Config] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun config(config: JsonField) = apply { this.config = config } fun additionalProperties(additionalProperties: Map) = apply { @@ -224,8 +251,15 @@ private constructor( fun config(config: Config?) = apply { body.config(config) } + /** Alias for calling [Builder.config] with `config.orElse(null)`. */ fun config(config: Optional) = config(config.getOrNull()) + /** + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [Config] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun config(config: JsonField) = apply { body.config(config) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { @@ -378,58 +412,98 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the column with the ground truths. */ + /** + * Name of the column with the ground truths. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun groundTruthColumnName(): Optional = Optional.ofNullable(groundTruthColumnName.getNullable("groundTruthColumnName")) - /** Name of the column with human feedback. */ + /** + * Name of the column with human feedback. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun humanFeedbackColumnName(): Optional = Optional.ofNullable(humanFeedbackColumnName.getNullable("humanFeedbackColumnName")) /** * Name of the column with the inference ids. This is useful if you want to update rows at a * later point in time. If not provided, a unique id is generated by Openlayer. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun inferenceIdColumnName(): Optional = Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) - /** Name of the column with the latencies. */ + /** + * Name of the column with the latencies. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) /** * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not * provided, the upload timestamp is used. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun timestampColumnName(): Optional = Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) - /** Name of the column with the ground truths. */ + /** + * Returns the raw JSON value of [groundTruthColumnName]. + * + * Unlike [groundTruthColumnName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("groundTruthColumnName") @ExcludeMissing fun _groundTruthColumnName(): JsonField = groundTruthColumnName - /** Name of the column with human feedback. */ + /** + * Returns the raw JSON value of [humanFeedbackColumnName]. + * + * Unlike [humanFeedbackColumnName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("humanFeedbackColumnName") @ExcludeMissing fun _humanFeedbackColumnName(): JsonField = humanFeedbackColumnName /** - * Name of the column with the inference ids. This is useful if you want to update rows at a - * later point in time. If not provided, a unique id is generated by Openlayer. + * Returns the raw JSON value of [inferenceIdColumnName]. + * + * Unlike [inferenceIdColumnName], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("inferenceIdColumnName") @ExcludeMissing fun _inferenceIdColumnName(): JsonField = inferenceIdColumnName - /** Name of the column with the latencies. */ + /** + * Returns the raw JSON value of [latencyColumnName]. + * + * Unlike [latencyColumnName], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("latencyColumnName") @ExcludeMissing fun _latencyColumnName(): JsonField = latencyColumnName /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not - * provided, the upload timestamp is used. + * Returns the raw JSON value of [timestampColumnName]. + * + * Unlike [timestampColumnName], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("timestampColumnName") @ExcludeMissing @@ -486,11 +560,20 @@ private constructor( fun groundTruthColumnName(groundTruthColumnName: String?) = groundTruthColumnName(JsonField.ofNullable(groundTruthColumnName)) - /** Name of the column with the ground truths. */ + /** + * Alias for calling [Builder.groundTruthColumnName] with + * `groundTruthColumnName.orElse(null)`. + */ fun groundTruthColumnName(groundTruthColumnName: Optional) = groundTruthColumnName(groundTruthColumnName.getOrNull()) - /** Name of the column with the ground truths. */ + /** + * Sets [Builder.groundTruthColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.groundTruthColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun groundTruthColumnName(groundTruthColumnName: JsonField) = apply { this.groundTruthColumnName = groundTruthColumnName } @@ -499,11 +582,20 @@ private constructor( fun humanFeedbackColumnName(humanFeedbackColumnName: String?) = humanFeedbackColumnName(JsonField.ofNullable(humanFeedbackColumnName)) - /** Name of the column with human feedback. */ + /** + * Alias for calling [Builder.humanFeedbackColumnName] with + * `humanFeedbackColumnName.orElse(null)`. + */ fun humanFeedbackColumnName(humanFeedbackColumnName: Optional) = humanFeedbackColumnName(humanFeedbackColumnName.getOrNull()) - /** Name of the column with human feedback. */ + /** + * Sets [Builder.humanFeedbackColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.humanFeedbackColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun humanFeedbackColumnName(humanFeedbackColumnName: JsonField) = apply { this.humanFeedbackColumnName = humanFeedbackColumnName } @@ -516,15 +608,18 @@ private constructor( inferenceIdColumnName(JsonField.ofNullable(inferenceIdColumnName)) /** - * Name of the column with the inference ids. This is useful if you want to update rows - * at a later point in time. If not provided, a unique id is generated by Openlayer. + * Alias for calling [Builder.inferenceIdColumnName] with + * `inferenceIdColumnName.orElse(null)`. */ fun inferenceIdColumnName(inferenceIdColumnName: Optional) = inferenceIdColumnName(inferenceIdColumnName.getOrNull()) /** - * Name of the column with the inference ids. This is useful if you want to update rows - * at a later point in time. If not provided, a unique id is generated by Openlayer. + * Sets [Builder.inferenceIdColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.inferenceIdColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { this.inferenceIdColumnName = inferenceIdColumnName @@ -534,11 +629,19 @@ private constructor( fun latencyColumnName(latencyColumnName: String?) = latencyColumnName(JsonField.ofNullable(latencyColumnName)) - /** Name of the column with the latencies. */ + /** + * Alias for calling [Builder.latencyColumnName] with `latencyColumnName.orElse(null)`. + */ fun latencyColumnName(latencyColumnName: Optional) = latencyColumnName(latencyColumnName.getOrNull()) - /** Name of the column with the latencies. */ + /** + * Sets [Builder.latencyColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.latencyColumnName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun latencyColumnName(latencyColumnName: JsonField) = apply { this.latencyColumnName = latencyColumnName } @@ -551,15 +654,18 @@ private constructor( timestampColumnName(JsonField.ofNullable(timestampColumnName)) /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not - * provided, the upload timestamp is used. + * Alias for calling [Builder.timestampColumnName] with + * `timestampColumnName.orElse(null)`. */ fun timestampColumnName(timestampColumnName: Optional) = timestampColumnName(timestampColumnName.getOrNull()) /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not - * provided, the upload timestamp is used. + * Sets [Builder.timestampColumnName] to an arbitrary JSON value. + * + * You should usually call [Builder.timestampColumnName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ fun timestampColumnName(timestampColumnName: JsonField) = apply { this.timestampColumnName = timestampColumnName diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt index d3608e12..1f3ca3e2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt @@ -28,8 +28,17 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun success(): Success = success.getRequired("success") + /** + * Returns the raw JSON value of [success]. + * + * Unlike [success], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("success") @ExcludeMissing fun _success(): JsonField = success @JsonAnyGetter @@ -76,6 +85,12 @@ private constructor( fun success(success: Success) = success(JsonField.of(success)) + /** + * Sets [Builder.success] to an arbitrary JSON value. + * + * You should usually call [Builder.success] with a well-typed [Success] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun success(success: JsonField) = apply { this.success = success } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt index 1347b00f..26636297 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt @@ -115,19 +115,27 @@ private constructor( /** The page to return in a paginated query. */ fun page(page: Long?) = apply { this.page = page } - /** The page to return in a paginated query. */ + /** + * Alias for [Builder.page]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun page(page: Long) = page(page as Long?) - /** The page to return in a paginated query. */ + /** Alias for calling [Builder.page] with `page.orElse(null)`. */ fun page(page: Optional) = page(page.getOrNull()) /** Maximum number of items to return per page. */ fun perPage(perPage: Long?) = apply { this.perPage = perPage } - /** Maximum number of items to return per page. */ + /** + * Alias for [Builder.perPage]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun perPage(perPage: Long) = perPage(perPage as Long?) - /** Maximum number of items to return per page. */ + /** Alias for calling [Builder.perPage] with `perPage.orElse(null)`. */ fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) /** @@ -136,10 +144,7 @@ private constructor( */ fun status(status: Status?) = apply { this.status = status } - /** - * Filter list of test results by status. Available statuses are `running`, `passing`, - * `failing`, `skipped`, and `error`. - */ + /** Alias for calling [Builder.status] with `status.orElse(null)`. */ fun status(status: Optional) = status(status.getOrNull()) /** @@ -148,10 +153,7 @@ private constructor( */ fun type(type: Type?) = apply { this.type = type } - /** - * Filter objects by test type. Available types are `integrity`, `consistency`, - * `performance`, `fairness`, and `robustness`. - */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt index 5dc49bee..50c7cfa7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt @@ -42,8 +42,17 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun items(): List = items.getRequired("items") + /** + * Returns the raw JSON value of [items]. + * + * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items @JsonAnyGetter @@ -90,10 +99,22 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) + /** + * Sets [Builder.items] to an arbitrary JSON value. + * + * You should usually call [Builder.items] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun items(items: JsonField>) = apply { this.items = items.map { it.toMutableList() } } + /** + * Adds a single [Item] to [items]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addItem(item: Item) = apply { items = (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } @@ -162,87 +183,191 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Project version (commit) id. */ + /** + * Project version (commit) id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The creation date. */ + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The data end date. */ + /** + * The data end date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun dateDataEnds(): Optional = Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) - /** The data start date. */ + /** + * The data start date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun dateDataStarts(): Optional = Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) - /** The last updated date. */ + /** + * The last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The inference pipeline id. */ + /** + * The inference pipeline id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun inferencePipelineId(): Optional = Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) - /** The project version (commit) id. */ + /** + * The project version (commit) id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun projectVersionId(): Optional = Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) - /** The status of the test. */ + /** + * The status of the test. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun status(): Status = status.getRequired("status") - /** The status message. */ + /** + * The status message. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun goal(): Optional = Optional.ofNullable(goal.getNullable("goal")) - /** The test id. */ + /** + * The test id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun goalId(): Optional = Optional.ofNullable(goalId.getNullable("goalId")) - /** Project version (commit) id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The data end date. */ + /** + * Returns the raw JSON value of [dateDataEnds]. + * + * Unlike [dateDataEnds], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateDataEnds") @ExcludeMissing fun _dateDataEnds(): JsonField = dateDataEnds - /** The data start date. */ + /** + * Returns the raw JSON value of [dateDataStarts]. + * + * Unlike [dateDataStarts], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateDataStarts") @ExcludeMissing fun _dateDataStarts(): JsonField = dateDataStarts - /** The last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The inference pipeline id. */ + /** + * Returns the raw JSON value of [inferencePipelineId]. + * + * Unlike [inferencePipelineId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("inferencePipelineId") @ExcludeMissing fun _inferencePipelineId(): JsonField = inferencePipelineId - /** The project version (commit) id. */ + /** + * Returns the raw JSON value of [projectVersionId]. + * + * Unlike [projectVersionId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("projectVersionId") @ExcludeMissing fun _projectVersionId(): JsonField = projectVersionId - /** The status of the test. */ + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The status message. */ + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage(): JsonField = statusMessage + /** + * Returns the raw JSON value of [goal]. + * + * Unlike [goal], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("goal") @ExcludeMissing fun _goal(): JsonField = goal - /** The test id. */ + /** + * Returns the raw JSON value of [goalId]. + * + * Unlike [goalId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("goalId") @ExcludeMissing fun _goalId(): JsonField = goalId @JsonAnyGetter @@ -328,13 +453,25 @@ private constructor( /** Project version (commit) id. */ fun id(id: String) = id(JsonField.of(id)) - /** Project version (commit) id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -343,11 +480,17 @@ private constructor( fun dateDataEnds(dateDataEnds: OffsetDateTime?) = dateDataEnds(JsonField.ofNullable(dateDataEnds)) - /** The data end date. */ + /** Alias for calling [Builder.dateDataEnds] with `dateDataEnds.orElse(null)`. */ fun dateDataEnds(dateDataEnds: Optional) = dateDataEnds(dateDataEnds.getOrNull()) - /** The data end date. */ + /** + * Sets [Builder.dateDataEnds] to an arbitrary JSON value. + * + * You should usually call [Builder.dateDataEnds] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateDataEnds(dateDataEnds: JsonField) = apply { this.dateDataEnds = dateDataEnds } @@ -356,11 +499,17 @@ private constructor( fun dateDataStarts(dateDataStarts: OffsetDateTime?) = dateDataStarts(JsonField.ofNullable(dateDataStarts)) - /** The data start date. */ + /** Alias for calling [Builder.dateDataStarts] with `dateDataStarts.orElse(null)`. */ fun dateDataStarts(dateDataStarts: Optional) = dateDataStarts(dateDataStarts.getOrNull()) - /** The data start date. */ + /** + * Sets [Builder.dateDataStarts] to an arbitrary JSON value. + * + * You should usually call [Builder.dateDataStarts] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateDataStarts(dateDataStarts: JsonField) = apply { this.dateDataStarts = dateDataStarts } @@ -368,7 +517,13 @@ private constructor( /** The last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -377,11 +532,20 @@ private constructor( fun inferencePipelineId(inferencePipelineId: String?) = inferencePipelineId(JsonField.ofNullable(inferencePipelineId)) - /** The inference pipeline id. */ + /** + * Alias for calling [Builder.inferencePipelineId] with + * `inferencePipelineId.orElse(null)`. + */ fun inferencePipelineId(inferencePipelineId: Optional) = inferencePipelineId(inferencePipelineId.getOrNull()) - /** The inference pipeline id. */ + /** + * Sets [Builder.inferencePipelineId] to an arbitrary JSON value. + * + * You should usually call [Builder.inferencePipelineId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun inferencePipelineId(inferencePipelineId: JsonField) = apply { this.inferencePipelineId = inferencePipelineId } @@ -390,11 +554,19 @@ private constructor( fun projectVersionId(projectVersionId: String?) = projectVersionId(JsonField.ofNullable(projectVersionId)) - /** The project version (commit) id. */ + /** + * Alias for calling [Builder.projectVersionId] with `projectVersionId.orElse(null)`. + */ fun projectVersionId(projectVersionId: Optional) = projectVersionId(projectVersionId.getOrNull()) - /** The project version (commit) id. */ + /** + * Sets [Builder.projectVersionId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectVersionId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectVersionId(projectVersionId: JsonField) = apply { this.projectVersionId = projectVersionId } @@ -402,33 +574,58 @@ private constructor( /** The status of the test. */ fun status(status: Status) = status(JsonField.of(status)) - /** The status of the test. */ + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun status(status: JsonField) = apply { this.status = status } /** The status message. */ fun statusMessage(statusMessage: String?) = statusMessage(JsonField.ofNullable(statusMessage)) - /** The status message. */ + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ fun statusMessage(statusMessage: Optional) = statusMessage(statusMessage.getOrNull()) - /** The status message. */ + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } fun goal(goal: Goal) = goal(JsonField.of(goal)) + /** + * Sets [Builder.goal] to an arbitrary JSON value. + * + * You should usually call [Builder.goal] with a well-typed [Goal] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun goal(goal: JsonField) = apply { this.goal = goal } /** The test id. */ fun goalId(goalId: String?) = goalId(JsonField.ofNullable(goalId)) - /** The test id. */ + /** Alias for calling [Builder.goalId] with `goalId.orElse(null)`. */ fun goalId(goalId: Optional) = goalId(goalId.getOrNull()) - /** The test id. */ + /** + * Sets [Builder.goalId] to an arbitrary JSON value. + * + * You should usually call [Builder.goalId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun goalId(goalId: JsonField) = apply { this.goalId = goalId } fun additionalProperties(additionalProperties: Map) = apply { @@ -662,170 +859,385 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The test id. */ + /** + * The test id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun id(): String = id.getRequired("id") - /** The number of comments on the test. */ + /** + * The number of comments on the test. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun commentCount(): Long = commentCount.getRequired("commentCount") - /** The test creator id. */ + /** + * The test creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The date the test was archived. */ + /** + * The date the test was archived. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun dateArchived(): Optional = Optional.ofNullable(dateArchived.getNullable("dateArchived")) - /** The creation date. */ + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The last updated date. */ + /** + * The last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The test description. */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonValue = description - /** The test name. */ + /** + * The test name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun name(): String = name.getRequired("name") - /** The test number. */ + /** + * The test number. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun number(): Long = number.getRequired("number") - /** The project version (commit) id where the test was created. */ + /** + * The project version (commit) id where the test was created. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun originProjectVersionId(): Optional = Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) - /** The test subtype. */ + /** + * The test subtype. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun subtype(): String = subtype.getRequired("subtype") - /** Whether the test is suggested or user-created. */ + /** + * Whether the test is suggested or user-created. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun suggested(): Boolean = suggested.getRequired("suggested") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun thresholds(): List = thresholds.getRequired("thresholds") - /** The test type. */ + /** + * The test type. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): String = type.getRequired("type") - /** Whether the test is archived. */ + /** + * Whether the test is archived. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) - /** The delay window in seconds. Only applies to tests that use production data. */ + /** + * The delay window in seconds. Only applies to tests that use production data. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun delayWindow(): Optional = Optional.ofNullable(delayWindow.getNullable("delayWindow")) - /** The evaluation window in seconds. Only applies to tests that use production data. */ + /** + * The evaluation window in seconds. Only applies to tests that use production data. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun evaluationWindow(): Optional = Optional.ofNullable(evaluationWindow.getNullable("evaluationWindow")) - /** Whether the test uses an ML model. */ + /** + * Whether the test uses an ML model. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun usesMlModel(): Optional = Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) - /** Whether the test uses production data (monitoring mode only). */ + /** + * Whether the test uses production data (monitoring mode only). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun usesProductionData(): Optional = Optional.ofNullable(usesProductionData.getNullable("usesProductionData")) - /** Whether the test uses a reference dataset (monitoring mode only). */ + /** + * Whether the test uses a reference dataset (monitoring mode only). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun usesReferenceDataset(): Optional = Optional.ofNullable(usesReferenceDataset.getNullable("usesReferenceDataset")) - /** Whether the test uses a training dataset. */ + /** + * Whether the test uses a training dataset. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun usesTrainingDataset(): Optional = Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) - /** Whether the test uses a validation dataset. */ + /** + * Whether the test uses a validation dataset. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun usesValidationDataset(): Optional = Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) - /** The test id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The number of comments on the test. */ + /** + * Returns the raw JSON value of [commentCount]. + * + * Unlike [commentCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("commentCount") @ExcludeMissing fun _commentCount(): JsonField = commentCount - /** The test creator id. */ + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId - /** The date the test was archived. */ + /** + * Returns the raw JSON value of [dateArchived]. + * + * Unlike [dateArchived], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived(): JsonField = dateArchived - /** The creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The test name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The test number. */ + /** + * Returns the raw JSON value of [number]. + * + * Unlike [number], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("number") @ExcludeMissing fun _number(): JsonField = number - /** The project version (commit) id where the test was created. */ + /** + * Returns the raw JSON value of [originProjectVersionId]. + * + * Unlike [originProjectVersionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("originProjectVersionId") @ExcludeMissing fun _originProjectVersionId(): JsonField = originProjectVersionId - /** The test subtype. */ + /** + * Returns the raw JSON value of [subtype]. + * + * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype - /** Whether the test is suggested or user-created. */ + /** + * Returns the raw JSON value of [suggested]. + * + * Unlike [suggested], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("suggested") @ExcludeMissing fun _suggested(): JsonField = suggested + /** + * Returns the raw JSON value of [thresholds]. + * + * Unlike [thresholds], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("thresholds") @ExcludeMissing fun _thresholds(): JsonField> = thresholds - /** The test type. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - /** Whether the test is archived. */ + /** + * Returns the raw JSON value of [archived]. + * + * Unlike [archived], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived - /** The delay window in seconds. Only applies to tests that use production data. */ + /** + * Returns the raw JSON value of [delayWindow]. + * + * Unlike [delayWindow], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("delayWindow") @ExcludeMissing fun _delayWindow(): JsonField = delayWindow - /** The evaluation window in seconds. Only applies to tests that use production data. */ + /** + * Returns the raw JSON value of [evaluationWindow]. + * + * Unlike [evaluationWindow], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("evaluationWindow") @ExcludeMissing fun _evaluationWindow(): JsonField = evaluationWindow - /** Whether the test uses an ML model. */ + /** + * Returns the raw JSON value of [usesMlModel]. + * + * Unlike [usesMlModel], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("usesMlModel") @ExcludeMissing fun _usesMlModel(): JsonField = usesMlModel - /** Whether the test uses production data (monitoring mode only). */ + /** + * Returns the raw JSON value of [usesProductionData]. + * + * Unlike [usesProductionData], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("usesProductionData") @ExcludeMissing fun _usesProductionData(): JsonField = usesProductionData - /** Whether the test uses a reference dataset (monitoring mode only). */ + /** + * Returns the raw JSON value of [usesReferenceDataset]. + * + * Unlike [usesReferenceDataset], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("usesReferenceDataset") @ExcludeMissing fun _usesReferenceDataset(): JsonField = usesReferenceDataset - /** Whether the test uses a training dataset. */ + /** + * Returns the raw JSON value of [usesTrainingDataset]. + * + * Unlike [usesTrainingDataset], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("usesTrainingDataset") @ExcludeMissing fun _usesTrainingDataset(): JsonField = usesTrainingDataset - /** Whether the test uses a validation dataset. */ + /** + * Returns the raw JSON value of [usesValidationDataset]. + * + * Unlike [usesValidationDataset], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("usesValidationDataset") @ExcludeMissing fun _usesValidationDataset(): JsonField = usesValidationDataset @@ -950,13 +1362,25 @@ private constructor( /** The test id. */ fun id(id: String) = id(JsonField.of(id)) - /** The test id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** The number of comments on the test. */ fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) - /** The number of comments on the test. */ + /** + * Sets [Builder.commentCount] to an arbitrary JSON value. + * + * You should usually call [Builder.commentCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun commentCount(commentCount: JsonField) = apply { this.commentCount = commentCount } @@ -964,21 +1388,33 @@ private constructor( /** The test creator id. */ fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The test creator id. */ + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) - /** The test creator id. */ + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The date the test was archived. */ fun dateArchived(dateArchived: OffsetDateTime?) = dateArchived(JsonField.ofNullable(dateArchived)) - /** The date the test was archived. */ + /** Alias for calling [Builder.dateArchived] with `dateArchived.orElse(null)`. */ fun dateArchived(dateArchived: Optional) = dateArchived(dateArchived.getOrNull()) - /** The date the test was archived. */ + /** + * Sets [Builder.dateArchived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateArchived] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun dateArchived(dateArchived: JsonField) = apply { this.dateArchived = dateArchived } @@ -987,7 +1423,13 @@ private constructor( fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -996,7 +1438,13 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -1007,24 +1455,45 @@ private constructor( /** The test name. */ fun name(name: String) = name(JsonField.of(name)) - /** The test name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** The test number. */ fun number(number: Long) = number(JsonField.of(number)) - /** The test number. */ + /** + * Sets [Builder.number] to an arbitrary JSON value. + * + * You should usually call [Builder.number] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun number(number: JsonField) = apply { this.number = number } /** The project version (commit) id where the test was created. */ fun originProjectVersionId(originProjectVersionId: String?) = originProjectVersionId(JsonField.ofNullable(originProjectVersionId)) - /** The project version (commit) id where the test was created. */ + /** + * Alias for calling [Builder.originProjectVersionId] with + * `originProjectVersionId.orElse(null)`. + */ fun originProjectVersionId(originProjectVersionId: Optional) = originProjectVersionId(originProjectVersionId.getOrNull()) - /** The project version (commit) id where the test was created. */ + /** + * Sets [Builder.originProjectVersionId] to an arbitrary JSON value. + * + * You should usually call [Builder.originProjectVersionId] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun originProjectVersionId(originProjectVersionId: JsonField) = apply { this.originProjectVersionId = originProjectVersionId } @@ -1032,21 +1501,45 @@ private constructor( /** The test subtype. */ fun subtype(subtype: String) = subtype(JsonField.of(subtype)) - /** The test subtype. */ + /** + * Sets [Builder.subtype] to an arbitrary JSON value. + * + * You should usually call [Builder.subtype] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun subtype(subtype: JsonField) = apply { this.subtype = subtype } /** Whether the test is suggested or user-created. */ fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) - /** Whether the test is suggested or user-created. */ + /** + * Sets [Builder.suggested] to an arbitrary JSON value. + * + * You should usually call [Builder.suggested] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun suggested(suggested: JsonField) = apply { this.suggested = suggested } fun thresholds(thresholds: List) = thresholds(JsonField.of(thresholds)) + /** + * Sets [Builder.thresholds] to an arbitrary JSON value. + * + * You should usually call [Builder.thresholds] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun thresholds(thresholds: JsonField>) = apply { this.thresholds = thresholds.map { it.toMutableList() } } + /** + * Adds a single [Threshold] to [thresholds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addThreshold(threshold: Threshold) = apply { thresholds = (thresholds ?: JsonField.of(mutableListOf())).also { @@ -1057,27 +1550,49 @@ private constructor( /** The test type. */ fun type(type: String) = type(JsonField.of(type)) - /** The test type. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } /** Whether the test is archived. */ fun archived(archived: Boolean) = archived(JsonField.of(archived)) - /** Whether the test is archived. */ + /** + * Sets [Builder.archived] to an arbitrary JSON value. + * + * You should usually call [Builder.archived] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun archived(archived: JsonField) = apply { this.archived = archived } /** The delay window in seconds. Only applies to tests that use production data. */ fun delayWindow(delayWindow: Double?) = delayWindow(JsonField.ofNullable(delayWindow)) - /** The delay window in seconds. Only applies to tests that use production data. */ + /** + * Alias for [Builder.delayWindow]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun delayWindow(delayWindow: Double) = delayWindow(delayWindow as Double?) - /** The delay window in seconds. Only applies to tests that use production data. */ + /** Alias for calling [Builder.delayWindow] with `delayWindow.orElse(null)`. */ fun delayWindow(delayWindow: Optional) = delayWindow(delayWindow.getOrNull()) - /** The delay window in seconds. Only applies to tests that use production data. */ + /** + * Sets [Builder.delayWindow] to an arbitrary JSON value. + * + * You should usually call [Builder.delayWindow] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun delayWindow(delayWindow: JsonField) = apply { this.delayWindow = delayWindow } @@ -1089,19 +1604,26 @@ private constructor( evaluationWindow(JsonField.ofNullable(evaluationWindow)) /** - * The evaluation window in seconds. Only applies to tests that use production data. + * Alias for [Builder.evaluationWindow]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun evaluationWindow(evaluationWindow: Double) = evaluationWindow(evaluationWindow as Double?) /** - * The evaluation window in seconds. Only applies to tests that use production data. + * Alias for calling [Builder.evaluationWindow] with + * `evaluationWindow.orElse(null)`. */ fun evaluationWindow(evaluationWindow: Optional) = evaluationWindow(evaluationWindow.getOrNull()) /** - * The evaluation window in seconds. Only applies to tests that use production data. + * Sets [Builder.evaluationWindow] to an arbitrary JSON value. + * + * You should usually call [Builder.evaluationWindow] with a well-typed [Double] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ fun evaluationWindow(evaluationWindow: JsonField) = apply { this.evaluationWindow = evaluationWindow @@ -1110,7 +1632,13 @@ private constructor( /** Whether the test uses an ML model. */ fun usesMlModel(usesMlModel: Boolean) = usesMlModel(JsonField.of(usesMlModel)) - /** Whether the test uses an ML model. */ + /** + * Sets [Builder.usesMlModel] to an arbitrary JSON value. + * + * You should usually call [Builder.usesMlModel] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun usesMlModel(usesMlModel: JsonField) = apply { this.usesMlModel = usesMlModel } @@ -1119,7 +1647,13 @@ private constructor( fun usesProductionData(usesProductionData: Boolean) = usesProductionData(JsonField.of(usesProductionData)) - /** Whether the test uses production data (monitoring mode only). */ + /** + * Sets [Builder.usesProductionData] to an arbitrary JSON value. + * + * You should usually call [Builder.usesProductionData] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun usesProductionData(usesProductionData: JsonField) = apply { this.usesProductionData = usesProductionData } @@ -1128,7 +1662,13 @@ private constructor( fun usesReferenceDataset(usesReferenceDataset: Boolean) = usesReferenceDataset(JsonField.of(usesReferenceDataset)) - /** Whether the test uses a reference dataset (monitoring mode only). */ + /** + * Sets [Builder.usesReferenceDataset] to an arbitrary JSON value. + * + * You should usually call [Builder.usesReferenceDataset] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun usesReferenceDataset(usesReferenceDataset: JsonField) = apply { this.usesReferenceDataset = usesReferenceDataset } @@ -1137,7 +1677,13 @@ private constructor( fun usesTrainingDataset(usesTrainingDataset: Boolean) = usesTrainingDataset(JsonField.of(usesTrainingDataset)) - /** Whether the test uses a training dataset. */ + /** + * Sets [Builder.usesTrainingDataset] to an arbitrary JSON value. + * + * You should usually call [Builder.usesTrainingDataset] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun usesTrainingDataset(usesTrainingDataset: JsonField) = apply { this.usesTrainingDataset = usesTrainingDataset } @@ -1146,7 +1692,13 @@ private constructor( fun usesValidationDataset(usesValidationDataset: Boolean) = usesValidationDataset(JsonField.of(usesValidationDataset)) - /** Whether the test uses a validation dataset. */ + /** + * Sets [Builder.usesValidationDataset] to an arbitrary JSON value. + * + * You should usually call [Builder.usesValidationDataset] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun usesValidationDataset(usesValidationDataset: JsonField) = apply { this.usesValidationDataset = usesValidationDataset } @@ -1224,44 +1776,94 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The insight name to be evaluated. */ + /** + * The insight name to be evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun insightName(): Optional = Optional.ofNullable(insightName.getNullable("insightName")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun insightParameters(): Optional> = Optional.ofNullable(insightParameters.getNullable("insightParameters")) - /** The measurement to be evaluated. */ + /** + * The measurement to be evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun measurement(): Optional = Optional.ofNullable(measurement.getNullable("measurement")) - /** The operator to be used for the evaluation. */ + /** + * The operator to be used for the evaluation. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) - /** The value to be compared. */ + /** + * The value to be compared. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun value(): Optional = Optional.ofNullable(value.getNullable("value")) - /** The insight name to be evaluated. */ + /** + * Returns the raw JSON value of [insightName]. + * + * Unlike [insightName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("insightName") @ExcludeMissing fun _insightName(): JsonField = insightName + /** + * Returns the raw JSON value of [insightParameters]. + * + * Unlike [insightParameters], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("insightParameters") @ExcludeMissing fun _insightParameters(): JsonField> = insightParameters - /** The measurement to be evaluated. */ + /** + * Returns the raw JSON value of [measurement]. + * + * Unlike [measurement], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("measurement") @ExcludeMissing fun _measurement(): JsonField = measurement - /** The operator to be used for the evaluation. */ + /** + * Returns the raw JSON value of [operator]. + * + * Unlike [operator], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("operator") @ExcludeMissing fun _operator(): JsonField = operator - /** The value to be compared. */ + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value @JsonAnyGetter @@ -1314,7 +1916,13 @@ private constructor( /** The insight name to be evaluated. */ fun insightName(insightName: String) = insightName(JsonField.of(insightName)) - /** The insight name to be evaluated. */ + /** + * Sets [Builder.insightName] to an arbitrary JSON value. + * + * You should usually call [Builder.insightName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun insightName(insightName: JsonField) = apply { this.insightName = insightName } @@ -1322,10 +1930,22 @@ private constructor( fun insightParameters(insightParameters: List) = insightParameters(JsonField.of(insightParameters)) + /** + * Sets [Builder.insightParameters] to an arbitrary JSON value. + * + * You should usually call [Builder.insightParameters] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun insightParameters(insightParameters: JsonField>) = apply { this.insightParameters = insightParameters.map { it.toMutableList() } } + /** + * Adds a single [JsonValue] to [insightParameters]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addInsightParameter(insightParameter: JsonValue) = apply { insightParameters = (insightParameters ?: JsonField.of(mutableListOf())).also { @@ -1336,7 +1956,13 @@ private constructor( /** The measurement to be evaluated. */ fun measurement(measurement: String) = measurement(JsonField.of(measurement)) - /** The measurement to be evaluated. */ + /** + * Sets [Builder.measurement] to an arbitrary JSON value. + * + * You should usually call [Builder.measurement] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun measurement(measurement: JsonField) = apply { this.measurement = measurement } @@ -1344,25 +1970,37 @@ private constructor( /** The operator to be used for the evaluation. */ fun operator(operator: String) = operator(JsonField.of(operator)) - /** The operator to be used for the evaluation. */ + /** + * Sets [Builder.operator] to an arbitrary JSON value. + * + * You should usually call [Builder.operator] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun operator(operator: JsonField) = apply { this.operator = operator } /** The value to be compared. */ fun value(value: Value) = value(JsonField.of(value)) - /** The value to be compared. */ + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [Value] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun value(value: JsonField) = apply { this.value = value } - /** The value to be compared. */ + /** Alias for calling [value] with `Value.ofNumber(number)`. */ fun value(number: Double) = value(Value.ofNumber(number)) - /** The value to be compared. */ + /** Alias for calling [value] with `Value.ofBool(bool)`. */ fun value(bool: Boolean) = value(Value.ofBool(bool)) - /** The value to be compared. */ + /** Alias for calling [value] with `Value.ofString(string)`. */ fun value(string: String) = value(Value.ofString(string)) - /** The value to be compared. */ + /** Alias for calling [value] with `Value.ofStrings(strings)`. */ fun valueOfStrings(strings: List) = value(Value.ofStrings(strings)) fun additionalProperties(additionalProperties: Map) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt index 67a74d7a..0c6b92e7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt @@ -32,98 +32,245 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = body.id() - /** The project creator id. */ + /** + * The project creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun creatorId(): Optional = body.creatorId() - /** The project creation date. */ + /** + * The project creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = body.dateCreated() - /** The project last updated date. */ + /** + * The project last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = body.dateUpdated() - /** The number of tests in the development mode of the project. */ + /** + * The number of tests in the development mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun developmentGoalCount(): Long = body.developmentGoalCount() - /** The total number of tests in the project. */ + /** + * The total number of tests in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun goalCount(): Long = body.goalCount() - /** The number of inference pipelines in the project. */ + /** + * The number of inference pipelines in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun inferencePipelineCount(): Long = body.inferencePipelineCount() - /** Links to the project. */ + /** + * Links to the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun links(): Links = body.links() - /** The number of tests in the monitoring mode of the project. */ + /** + * The number of tests in the monitoring mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun monitoringGoalCount(): Long = body.monitoringGoalCount() - /** The project name. */ + /** + * The project name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** The source of the project. */ + /** + * The source of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun source(): Optional = body.source() - /** The task type of the project. */ + /** + * The task type of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun taskType(): TaskType = body.taskType() - /** The number of versions (commits) in the project. */ + /** + * The number of versions (commits) in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun versionCount(): Long = body.versionCount() - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun workspaceId(): Optional = body.workspaceId() - /** The project description. */ + /** + * The project description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun gitRepo(): Optional = body.gitRepo() - /** The project id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ fun _id(): JsonField = body._id() - /** The project creator id. */ + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _creatorId(): JsonField = body._creatorId() - /** The project creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ fun _dateCreated(): JsonField = body._dateCreated() - /** The project last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ fun _dateUpdated(): JsonField = body._dateUpdated() - /** The number of tests in the development mode of the project. */ + /** + * Returns the raw JSON value of [developmentGoalCount]. + * + * Unlike [developmentGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _developmentGoalCount(): JsonField = body._developmentGoalCount() - /** The total number of tests in the project. */ + /** + * Returns the raw JSON value of [goalCount]. + * + * Unlike [goalCount], this method doesn't throw if the JSON field has an unexpected type. + */ fun _goalCount(): JsonField = body._goalCount() - /** The number of inference pipelines in the project. */ + /** + * Returns the raw JSON value of [inferencePipelineCount]. + * + * Unlike [inferencePipelineCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ fun _inferencePipelineCount(): JsonField = body._inferencePipelineCount() - /** Links to the project. */ + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ fun _links(): JsonField = body._links() - /** The number of tests in the monitoring mode of the project. */ + /** + * Returns the raw JSON value of [monitoringGoalCount]. + * + * Unlike [monitoringGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _monitoringGoalCount(): JsonField = body._monitoringGoalCount() - /** The project name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** The source of the project. */ + /** + * Returns the raw JSON value of [source]. + * + * Unlike [source], this method doesn't throw if the JSON field has an unexpected type. + */ fun _source(): JsonField = body._source() - /** The task type of the project. */ + /** + * Returns the raw JSON value of [taskType]. + * + * Unlike [taskType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _taskType(): JsonField = body._taskType() - /** The number of versions (commits) in the project. */ + /** + * Returns the raw JSON value of [versionCount]. + * + * Unlike [versionCount], this method doesn't throw if the JSON field has an unexpected type. + */ fun _versionCount(): JsonField = body._versionCount() - /** The workspace id. */ + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _workspaceId(): JsonField = body._workspaceId() - /** The project description. */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() + /** + * Returns the raw JSON value of [gitRepo]. + * + * Unlike [gitRepo], this method doesn't throw if the JSON field has an unexpected type. + */ fun _gitRepo(): JsonField = body._gitRepo() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -192,117 +339,265 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The project creator id. */ + /** + * The project creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The project creation date. */ + /** + * The project creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The project last updated date. */ + /** + * The project last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The number of tests in the development mode of the project. */ + /** + * The number of tests in the development mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") - /** The total number of tests in the project. */ + /** + * The total number of tests in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun goalCount(): Long = goalCount.getRequired("goalCount") - /** The number of inference pipelines in the project. */ + /** + * The number of inference pipelines in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun inferencePipelineCount(): Long = inferencePipelineCount.getRequired("inferencePipelineCount") - /** Links to the project. */ + /** + * Links to the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun links(): Links = links.getRequired("links") - /** The number of tests in the monitoring mode of the project. */ + /** + * The number of tests in the monitoring mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") - /** The project name. */ + /** + * The project name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The source of the project. */ + /** + * The source of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) - /** The task type of the project. */ + /** + * The task type of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun taskType(): TaskType = taskType.getRequired("taskType") - /** The number of versions (commits) in the project. */ + /** + * The number of versions (commits) in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun versionCount(): Long = versionCount.getRequired("versionCount") - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The project description. */ + /** + * The project description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) - /** The project id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The project creator id. */ + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId - /** The project creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The project last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The number of tests in the development mode of the project. */ + /** + * Returns the raw JSON value of [developmentGoalCount]. + * + * Unlike [developmentGoalCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("developmentGoalCount") @ExcludeMissing fun _developmentGoalCount(): JsonField = developmentGoalCount - /** The total number of tests in the project. */ + /** + * Returns the raw JSON value of [goalCount]. + * + * Unlike [goalCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount - /** The number of inference pipelines in the project. */ + /** + * Returns the raw JSON value of [inferencePipelineCount]. + * + * Unlike [inferencePipelineCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("inferencePipelineCount") @ExcludeMissing fun _inferencePipelineCount(): JsonField = inferencePipelineCount - /** Links to the project. */ + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links - /** The number of tests in the monitoring mode of the project. */ + /** + * Returns the raw JSON value of [monitoringGoalCount]. + * + * Unlike [monitoringGoalCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("monitoringGoalCount") @ExcludeMissing fun _monitoringGoalCount(): JsonField = monitoringGoalCount - /** The project name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The source of the project. */ + /** + * Returns the raw JSON value of [source]. + * + * Unlike [source], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source - /** The task type of the project. */ + /** + * Returns the raw JSON value of [taskType]. + * + * Unlike [taskType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("taskType") @ExcludeMissing fun _taskType(): JsonField = taskType - /** The number of versions (commits) in the project. */ + /** + * Returns the raw JSON value of [versionCount]. + * + * Unlike [versionCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("versionCount") @ExcludeMissing fun _versionCount(): JsonField = versionCount - /** The workspace id. */ + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId - /** The project description. */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + /** + * Returns the raw JSON value of [gitRepo]. + * + * Unlike [gitRepo], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo @JsonAnyGetter @@ -408,22 +703,40 @@ private constructor( /** The project id. */ fun id(id: String) = id(JsonField.of(id)) - /** The project id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The project creator id. */ fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The project creator id. */ + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) - /** The project creator id. */ + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The project creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -431,7 +744,13 @@ private constructor( /** The project last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The project last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -440,7 +759,13 @@ private constructor( fun developmentGoalCount(developmentGoalCount: Long) = developmentGoalCount(JsonField.of(developmentGoalCount)) - /** The number of tests in the development mode of the project. */ + /** + * Sets [Builder.developmentGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.developmentGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun developmentGoalCount(developmentGoalCount: JsonField) = apply { this.developmentGoalCount = developmentGoalCount } @@ -448,14 +773,26 @@ private constructor( /** The total number of tests in the project. */ fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) - /** The total number of tests in the project. */ + /** + * Sets [Builder.goalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.goalCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } /** The number of inference pipelines in the project. */ fun inferencePipelineCount(inferencePipelineCount: Long) = inferencePipelineCount(JsonField.of(inferencePipelineCount)) - /** The number of inference pipelines in the project. */ + /** + * Sets [Builder.inferencePipelineCount] to an arbitrary JSON value. + * + * You should usually call [Builder.inferencePipelineCount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { this.inferencePipelineCount = inferencePipelineCount } @@ -463,14 +800,26 @@ private constructor( /** Links to the project. */ fun links(links: Links) = links(JsonField.of(links)) - /** Links to the project. */ + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun links(links: JsonField) = apply { this.links = links } /** The number of tests in the monitoring mode of the project. */ fun monitoringGoalCount(monitoringGoalCount: Long) = monitoringGoalCount(JsonField.of(monitoringGoalCount)) - /** The number of tests in the monitoring mode of the project. */ + /** + * Sets [Builder.monitoringGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.monitoringGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { this.monitoringGoalCount = monitoringGoalCount } @@ -478,28 +827,52 @@ private constructor( /** The project name. */ fun name(name: String) = name(JsonField.of(name)) - /** The project name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The source of the project. */ fun source(source: Source?) = source(JsonField.ofNullable(source)) - /** The source of the project. */ + /** Alias for calling [Builder.source] with `source.orElse(null)`. */ fun source(source: Optional) = source(source.getOrNull()) - /** The source of the project. */ + /** + * Sets [Builder.source] to an arbitrary JSON value. + * + * You should usually call [Builder.source] with a well-typed [Source] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun source(source: JsonField) = apply { this.source = source } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) - /** The task type of the project. */ + /** + * Sets [Builder.taskType] to an arbitrary JSON value. + * + * You should usually call [Builder.taskType] with a well-typed [TaskType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun taskType(taskType: JsonField) = apply { this.taskType = taskType } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) - /** The number of versions (commits) in the project. */ + /** + * Sets [Builder.versionCount] to an arbitrary JSON value. + * + * You should usually call [Builder.versionCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun versionCount(versionCount: JsonField) = apply { this.versionCount = versionCount } @@ -507,10 +880,16 @@ private constructor( /** The workspace id. */ fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) - /** The workspace id. */ + /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) - /** The workspace id. */ + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } @@ -518,18 +897,32 @@ private constructor( /** The project description. */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** The project description. */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** The project description. */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) + /** Alias for calling [Builder.gitRepo] with `gitRepo.orElse(null)`. */ fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) + /** + * Sets [Builder.gitRepo] to an arbitrary JSON value. + * + * You should usually call [Builder.gitRepo] with a well-typed [GitRepo] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { @@ -637,22 +1030,39 @@ private constructor( /** The project id. */ fun id(id: String) = apply { body.id(id) } - /** The project id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { body.id(id) } /** The project creator id. */ fun creatorId(creatorId: String?) = apply { body.creatorId(creatorId) } - /** The project creator id. */ + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) - /** The project creator id. */ + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun creatorId(creatorId: JsonField) = apply { body.creatorId(creatorId) } /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = apply { body.dateCreated(dateCreated) } - /** The project creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { body.dateCreated(dateCreated) } @@ -660,7 +1070,13 @@ private constructor( /** The project last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = apply { body.dateUpdated(dateUpdated) } - /** The project last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { body.dateUpdated(dateUpdated) } @@ -670,7 +1086,13 @@ private constructor( body.developmentGoalCount(developmentGoalCount) } - /** The number of tests in the development mode of the project. */ + /** + * Sets [Builder.developmentGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.developmentGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun developmentGoalCount(developmentGoalCount: JsonField) = apply { body.developmentGoalCount(developmentGoalCount) } @@ -678,7 +1100,12 @@ private constructor( /** The total number of tests in the project. */ fun goalCount(goalCount: Long) = apply { body.goalCount(goalCount) } - /** The total number of tests in the project. */ + /** + * Sets [Builder.goalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.goalCount] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun goalCount(goalCount: JsonField) = apply { body.goalCount(goalCount) } /** The number of inference pipelines in the project. */ @@ -686,7 +1113,13 @@ private constructor( body.inferencePipelineCount(inferencePipelineCount) } - /** The number of inference pipelines in the project. */ + /** + * Sets [Builder.inferencePipelineCount] to an arbitrary JSON value. + * + * You should usually call [Builder.inferencePipelineCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { body.inferencePipelineCount(inferencePipelineCount) } @@ -694,7 +1127,12 @@ private constructor( /** Links to the project. */ fun links(links: Links) = apply { body.links(links) } - /** Links to the project. */ + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun links(links: JsonField) = apply { body.links(links) } /** The number of tests in the monitoring mode of the project. */ @@ -702,7 +1140,13 @@ private constructor( body.monitoringGoalCount(monitoringGoalCount) } - /** The number of tests in the monitoring mode of the project. */ + /** + * Sets [Builder.monitoringGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.monitoringGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { body.monitoringGoalCount(monitoringGoalCount) } @@ -710,52 +1154,93 @@ private constructor( /** The project name. */ fun name(name: String) = apply { body.name(name) } - /** The project name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** The source of the project. */ fun source(source: Source?) = apply { body.source(source) } - /** The source of the project. */ + /** Alias for calling [Builder.source] with `source.orElse(null)`. */ fun source(source: Optional) = source(source.getOrNull()) - /** The source of the project. */ + /** + * Sets [Builder.source] to an arbitrary JSON value. + * + * You should usually call [Builder.source] with a well-typed [Source] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun source(source: JsonField) = apply { body.source(source) } /** The task type of the project. */ fun taskType(taskType: TaskType) = apply { body.taskType(taskType) } - /** The task type of the project. */ + /** + * Sets [Builder.taskType] to an arbitrary JSON value. + * + * You should usually call [Builder.taskType] with a well-typed [TaskType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun taskType(taskType: JsonField) = apply { body.taskType(taskType) } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = apply { body.versionCount(versionCount) } - /** The number of versions (commits) in the project. */ + /** + * Sets [Builder.versionCount] to an arbitrary JSON value. + * + * You should usually call [Builder.versionCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun versionCount(versionCount: JsonField) = apply { body.versionCount(versionCount) } /** The workspace id. */ fun workspaceId(workspaceId: String?) = apply { body.workspaceId(workspaceId) } - /** The workspace id. */ + /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) - /** The workspace id. */ + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun workspaceId(workspaceId: JsonField) = apply { body.workspaceId(workspaceId) } /** The project description. */ fun description(description: String?) = apply { body.description(description) } - /** The project description. */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** The project description. */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } fun gitRepo(gitRepo: GitRepo?) = apply { body.gitRepo(gitRepo) } + /** Alias for calling [Builder.gitRepo] with `gitRepo.orElse(null)`. */ fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) + /** + * Sets [Builder.gitRepo] to an arbitrary JSON value. + * + * You should usually call [Builder.gitRepo] with a well-typed [GitRepo] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun gitRepo(gitRepo: JsonField) = apply { body.gitRepo(gitRepo) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { @@ -893,8 +1378,17 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun app(): String = app.getRequired("app") + /** + * Returns the raw JSON value of [app]. + * + * Unlike [app], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @@ -941,6 +1435,13 @@ private constructor( fun app(app: String) = app(JsonField.of(app)) + /** + * Sets [Builder.app] to an arbitrary JSON value. + * + * You should usually call [Builder.app] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { @@ -1243,58 +1744,168 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateConnected(): OffsetDateTime = dateConnected.getRequired("dateConnected") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun gitId(): Long = gitId.getRequired("gitId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun private_(): Boolean = private_.getRequired("private") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("projectId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun slug(): String = slug.getRequired("slug") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun url(): String = url.getRequired("url") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [dateConnected]. + * + * Unlike [dateConnected], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected(): JsonField = dateConnected + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated + /** + * Returns the raw JSON value of [gitAccountId]. + * + * Unlike [gitAccountId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId(): JsonField = gitAccountId + /** + * Returns the raw JSON value of [gitId]. + * + * Unlike [gitId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gitId") @ExcludeMissing fun _gitId(): JsonField = gitId + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [private_]. + * + * Unlike [private_], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("private") @ExcludeMissing fun _private_(): JsonField = private_ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url + /** + * Returns the raw JSON value of [branch]. + * + * Unlike [branch], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch + /** + * Returns the raw JSON value of [rootDir]. + * + * Unlike [rootDir], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir @JsonAnyGetter @@ -1383,57 +1994,141 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) + /** + * Sets [Builder.dateConnected] to an arbitrary JSON value. + * + * You should usually call [Builder.dateConnected] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateConnected(dateConnected: JsonField) = apply { this.dateConnected = dateConnected } fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) + /** + * Sets [Builder.gitAccountId] to an arbitrary JSON value. + * + * You should usually call [Builder.gitAccountId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitAccountId(gitAccountId: JsonField) = apply { this.gitAccountId = gitAccountId } fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) + /** + * Sets [Builder.gitId] to an arbitrary JSON value. + * + * You should usually call [Builder.gitId] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun gitId(gitId: JsonField) = apply { this.gitId = gitId } fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } fun private_(private_: Boolean) = private_(JsonField.of(private_)) + /** + * Sets [Builder.private_] to an arbitrary JSON value. + * + * You should usually call [Builder.private_] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun private_(private_: JsonField) = apply { this.private_ = private_ } fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } fun slug(slug: String) = slug(JsonField.of(slug)) + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } fun url(url: String) = url(JsonField.of(url)) + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun url(url: JsonField) = apply { this.url = url } fun branch(branch: String) = branch(JsonField.of(branch)) + /** + * Sets [Builder.branch] to an arbitrary JSON value. + * + * You should usually call [Builder.branch] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun branch(branch: JsonField) = apply { this.branch = branch } fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) + /** + * Sets [Builder.rootDir] to an arbitrary JSON value. + * + * You should usually call [Builder.rootDir] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt index 20e763dc..905c710c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt @@ -70,113 +70,260 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The project creator id. */ + /** + * The project creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The project creation date. */ + /** + * The project creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The project last updated date. */ + /** + * The project last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The number of tests in the development mode of the project. */ + /** + * The number of tests in the development mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") - /** The total number of tests in the project. */ + /** + * The total number of tests in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun goalCount(): Long = goalCount.getRequired("goalCount") - /** The number of inference pipelines in the project. */ + /** + * The number of inference pipelines in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun inferencePipelineCount(): Long = inferencePipelineCount.getRequired("inferencePipelineCount") - /** Links to the project. */ + /** + * Links to the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun links(): Links = links.getRequired("links") - /** The number of tests in the monitoring mode of the project. */ + /** + * The number of tests in the monitoring mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") - /** The project name. */ + /** + * The project name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The source of the project. */ + /** + * The source of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) - /** The task type of the project. */ + /** + * The task type of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun taskType(): TaskType = taskType.getRequired("taskType") - /** The number of versions (commits) in the project. */ + /** + * The number of versions (commits) in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun versionCount(): Long = versionCount.getRequired("versionCount") - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The project description. */ + /** + * The project description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) - /** The project id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The project creator id. */ + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId - /** The project creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The project last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The number of tests in the development mode of the project. */ + /** + * Returns the raw JSON value of [developmentGoalCount]. + * + * Unlike [developmentGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("developmentGoalCount") @ExcludeMissing fun _developmentGoalCount(): JsonField = developmentGoalCount - /** The total number of tests in the project. */ + /** + * Returns the raw JSON value of [goalCount]. + * + * Unlike [goalCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount - /** The number of inference pipelines in the project. */ + /** + * Returns the raw JSON value of [inferencePipelineCount]. + * + * Unlike [inferencePipelineCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("inferencePipelineCount") @ExcludeMissing fun _inferencePipelineCount(): JsonField = inferencePipelineCount - /** Links to the project. */ + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links - /** The number of tests in the monitoring mode of the project. */ + /** + * Returns the raw JSON value of [monitoringGoalCount]. + * + * Unlike [monitoringGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("monitoringGoalCount") @ExcludeMissing fun _monitoringGoalCount(): JsonField = monitoringGoalCount - /** The project name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The source of the project. */ + /** + * Returns the raw JSON value of [source]. + * + * Unlike [source], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source - /** The task type of the project. */ + /** + * Returns the raw JSON value of [taskType]. + * + * Unlike [taskType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("taskType") @ExcludeMissing fun _taskType(): JsonField = taskType - /** The number of versions (commits) in the project. */ + /** + * Returns the raw JSON value of [versionCount]. + * + * Unlike [versionCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("versionCount") @ExcludeMissing fun _versionCount(): JsonField = versionCount - /** The workspace id. */ + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId - /** The project description. */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + /** + * Returns the raw JSON value of [gitRepo]. + * + * Unlike [gitRepo], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo @JsonAnyGetter @@ -282,22 +429,39 @@ private constructor( /** The project id. */ fun id(id: String) = id(JsonField.of(id)) - /** The project id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** The project creator id. */ fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The project creator id. */ + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) - /** The project creator id. */ + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The project creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -305,7 +469,13 @@ private constructor( /** The project last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The project last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -314,7 +484,13 @@ private constructor( fun developmentGoalCount(developmentGoalCount: Long) = developmentGoalCount(JsonField.of(developmentGoalCount)) - /** The number of tests in the development mode of the project. */ + /** + * Sets [Builder.developmentGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.developmentGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun developmentGoalCount(developmentGoalCount: JsonField) = apply { this.developmentGoalCount = developmentGoalCount } @@ -322,14 +498,25 @@ private constructor( /** The total number of tests in the project. */ fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) - /** The total number of tests in the project. */ + /** + * Sets [Builder.goalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.goalCount] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } /** The number of inference pipelines in the project. */ fun inferencePipelineCount(inferencePipelineCount: Long) = inferencePipelineCount(JsonField.of(inferencePipelineCount)) - /** The number of inference pipelines in the project. */ + /** + * Sets [Builder.inferencePipelineCount] to an arbitrary JSON value. + * + * You should usually call [Builder.inferencePipelineCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { this.inferencePipelineCount = inferencePipelineCount } @@ -337,14 +524,25 @@ private constructor( /** Links to the project. */ fun links(links: Links) = links(JsonField.of(links)) - /** Links to the project. */ + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun links(links: JsonField) = apply { this.links = links } /** The number of tests in the monitoring mode of the project. */ fun monitoringGoalCount(monitoringGoalCount: Long) = monitoringGoalCount(JsonField.of(monitoringGoalCount)) - /** The number of tests in the monitoring mode of the project. */ + /** + * Sets [Builder.monitoringGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.monitoringGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { this.monitoringGoalCount = monitoringGoalCount } @@ -352,52 +550,93 @@ private constructor( /** The project name. */ fun name(name: String) = name(JsonField.of(name)) - /** The project name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** The source of the project. */ fun source(source: Source?) = source(JsonField.ofNullable(source)) - /** The source of the project. */ + /** Alias for calling [Builder.source] with `source.orElse(null)`. */ fun source(source: Optional) = source(source.getOrNull()) - /** The source of the project. */ + /** + * Sets [Builder.source] to an arbitrary JSON value. + * + * You should usually call [Builder.source] with a well-typed [Source] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun source(source: JsonField) = apply { this.source = source } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) - /** The task type of the project. */ + /** + * Sets [Builder.taskType] to an arbitrary JSON value. + * + * You should usually call [Builder.taskType] with a well-typed [TaskType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun taskType(taskType: JsonField) = apply { this.taskType = taskType } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) - /** The number of versions (commits) in the project. */ + /** + * Sets [Builder.versionCount] to an arbitrary JSON value. + * + * You should usually call [Builder.versionCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun versionCount(versionCount: JsonField) = apply { this.versionCount = versionCount } /** The workspace id. */ fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) - /** The workspace id. */ + /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) - /** The workspace id. */ + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } /** The project description. */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** The project description. */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** The project description. */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { this.description = description } fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) + /** Alias for calling [Builder.gitRepo] with `gitRepo.orElse(null)`. */ fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) + /** + * Sets [Builder.gitRepo] to an arbitrary JSON value. + * + * You should usually call [Builder.gitRepo] with a well-typed [GitRepo] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { @@ -451,8 +690,17 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun app(): String = app.getRequired("app") + /** + * Returns the raw JSON value of [app]. + * + * Unlike [app], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @@ -499,6 +747,13 @@ private constructor( fun app(app: String) = app(JsonField.of(app)) + /** + * Sets [Builder.app] to an arbitrary JSON value. + * + * You should usually call [Builder.app] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { @@ -801,58 +1056,168 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateConnected(): OffsetDateTime = dateConnected.getRequired("dateConnected") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun gitId(): Long = gitId.getRequired("gitId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun private_(): Boolean = private_.getRequired("private") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("projectId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun slug(): String = slug.getRequired("slug") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun url(): String = url.getRequired("url") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [dateConnected]. + * + * Unlike [dateConnected], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected(): JsonField = dateConnected + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated + /** + * Returns the raw JSON value of [gitAccountId]. + * + * Unlike [gitAccountId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId(): JsonField = gitAccountId + /** + * Returns the raw JSON value of [gitId]. + * + * Unlike [gitId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gitId") @ExcludeMissing fun _gitId(): JsonField = gitId + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [private_]. + * + * Unlike [private_], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("private") @ExcludeMissing fun _private_(): JsonField = private_ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url + /** + * Returns the raw JSON value of [branch]. + * + * Unlike [branch], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch + /** + * Returns the raw JSON value of [rootDir]. + * + * Unlike [rootDir], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir @JsonAnyGetter @@ -941,57 +1306,141 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) + /** + * Sets [Builder.dateConnected] to an arbitrary JSON value. + * + * You should usually call [Builder.dateConnected] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateConnected(dateConnected: JsonField) = apply { this.dateConnected = dateConnected } fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) + /** + * Sets [Builder.gitAccountId] to an arbitrary JSON value. + * + * You should usually call [Builder.gitAccountId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitAccountId(gitAccountId: JsonField) = apply { this.gitAccountId = gitAccountId } fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) + /** + * Sets [Builder.gitId] to an arbitrary JSON value. + * + * You should usually call [Builder.gitId] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun gitId(gitId: JsonField) = apply { this.gitId = gitId } fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } fun private_(private_: Boolean) = private_(JsonField.of(private_)) + /** + * Sets [Builder.private_] to an arbitrary JSON value. + * + * You should usually call [Builder.private_] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun private_(private_: JsonField) = apply { this.private_ = private_ } fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } fun slug(slug: String) = slug(JsonField.of(slug)) + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } fun url(url: String) = url(JsonField.of(url)) + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun url(url: JsonField) = apply { this.url = url } fun branch(branch: String) = branch(JsonField.of(branch)) + /** + * Sets [Builder.branch] to an arbitrary JSON value. + * + * You should usually call [Builder.branch] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun branch(branch: JsonField) = apply { this.branch = branch } fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) + /** + * Sets [Builder.rootDir] to an arbitrary JSON value. + * + * You should usually call [Builder.rootDir] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt index 321c813f..f4f25a60 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt @@ -87,31 +87,39 @@ private constructor( /** Filter list of items by project name. */ fun name(name: String?) = apply { this.name = name } - /** Filter list of items by project name. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) /** The page to return in a paginated query. */ fun page(page: Long?) = apply { this.page = page } - /** The page to return in a paginated query. */ + /** + * Alias for [Builder.page]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun page(page: Long) = page(page as Long?) - /** The page to return in a paginated query. */ + /** Alias for calling [Builder.page] with `page.orElse(null)`. */ fun page(page: Optional) = page(page.getOrNull()) /** Maximum number of items to return per page. */ fun perPage(perPage: Long?) = apply { this.perPage = perPage } - /** Maximum number of items to return per page. */ + /** + * Alias for [Builder.perPage]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun perPage(perPage: Long) = perPage(perPage as Long?) - /** Maximum number of items to return per page. */ + /** Alias for calling [Builder.perPage] with `perPage.orElse(null)`. */ fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) /** Filter list of items by task type. */ fun taskType(taskType: TaskType?) = apply { this.taskType = taskType } - /** Filter list of items by task type. */ + /** Alias for calling [Builder.taskType] with `taskType.orElse(null)`. */ fun taskType(taskType: Optional) = taskType(taskType.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt index b22668ba..8da10652 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt @@ -32,8 +32,17 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun items(): List = items.getRequired("items") + /** + * Returns the raw JSON value of [items]. + * + * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items @JsonAnyGetter @@ -80,10 +89,22 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) + /** + * Sets [Builder.items] to an arbitrary JSON value. + * + * You should usually call [Builder.items] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun items(items: JsonField>) = apply { this.items = items.map { it.toMutableList() } } + /** + * Adds a single [Item] to [items]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addItem(item: Item) = apply { items = (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } @@ -169,117 +190,265 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The project creator id. */ + /** + * The project creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The project creation date. */ + /** + * The project creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The project last updated date. */ + /** + * The project last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The number of tests in the development mode of the project. */ + /** + * The number of tests in the development mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") - /** The total number of tests in the project. */ + /** + * The total number of tests in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun goalCount(): Long = goalCount.getRequired("goalCount") - /** The number of inference pipelines in the project. */ + /** + * The number of inference pipelines in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun inferencePipelineCount(): Long = inferencePipelineCount.getRequired("inferencePipelineCount") - /** Links to the project. */ + /** + * Links to the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun links(): Links = links.getRequired("links") - /** The number of tests in the monitoring mode of the project. */ + /** + * The number of tests in the monitoring mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") - /** The project name. */ + /** + * The project name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The source of the project. */ + /** + * The source of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) - /** The task type of the project. */ + /** + * The task type of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun taskType(): TaskType = taskType.getRequired("taskType") - /** The number of versions (commits) in the project. */ + /** + * The number of versions (commits) in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun versionCount(): Long = versionCount.getRequired("versionCount") - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The project description. */ + /** + * The project description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) - /** The project id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The project creator id. */ + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId - /** The project creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The project last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The number of tests in the development mode of the project. */ + /** + * Returns the raw JSON value of [developmentGoalCount]. + * + * Unlike [developmentGoalCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("developmentGoalCount") @ExcludeMissing fun _developmentGoalCount(): JsonField = developmentGoalCount - /** The total number of tests in the project. */ + /** + * Returns the raw JSON value of [goalCount]. + * + * Unlike [goalCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount - /** The number of inference pipelines in the project. */ + /** + * Returns the raw JSON value of [inferencePipelineCount]. + * + * Unlike [inferencePipelineCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("inferencePipelineCount") @ExcludeMissing fun _inferencePipelineCount(): JsonField = inferencePipelineCount - /** Links to the project. */ + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links - /** The number of tests in the monitoring mode of the project. */ + /** + * Returns the raw JSON value of [monitoringGoalCount]. + * + * Unlike [monitoringGoalCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("monitoringGoalCount") @ExcludeMissing fun _monitoringGoalCount(): JsonField = monitoringGoalCount - /** The project name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The source of the project. */ + /** + * Returns the raw JSON value of [source]. + * + * Unlike [source], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source - /** The task type of the project. */ + /** + * Returns the raw JSON value of [taskType]. + * + * Unlike [taskType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("taskType") @ExcludeMissing fun _taskType(): JsonField = taskType - /** The number of versions (commits) in the project. */ + /** + * Returns the raw JSON value of [versionCount]. + * + * Unlike [versionCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("versionCount") @ExcludeMissing fun _versionCount(): JsonField = versionCount - /** The workspace id. */ + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId - /** The project description. */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + /** + * Returns the raw JSON value of [gitRepo]. + * + * Unlike [gitRepo], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo @JsonAnyGetter @@ -385,22 +554,40 @@ private constructor( /** The project id. */ fun id(id: String) = id(JsonField.of(id)) - /** The project id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The project creator id. */ fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The project creator id. */ + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) - /** The project creator id. */ + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The project creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -408,7 +595,13 @@ private constructor( /** The project last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The project last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -417,7 +610,13 @@ private constructor( fun developmentGoalCount(developmentGoalCount: Long) = developmentGoalCount(JsonField.of(developmentGoalCount)) - /** The number of tests in the development mode of the project. */ + /** + * Sets [Builder.developmentGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.developmentGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun developmentGoalCount(developmentGoalCount: JsonField) = apply { this.developmentGoalCount = developmentGoalCount } @@ -425,14 +624,26 @@ private constructor( /** The total number of tests in the project. */ fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) - /** The total number of tests in the project. */ + /** + * Sets [Builder.goalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.goalCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } /** The number of inference pipelines in the project. */ fun inferencePipelineCount(inferencePipelineCount: Long) = inferencePipelineCount(JsonField.of(inferencePipelineCount)) - /** The number of inference pipelines in the project. */ + /** + * Sets [Builder.inferencePipelineCount] to an arbitrary JSON value. + * + * You should usually call [Builder.inferencePipelineCount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { this.inferencePipelineCount = inferencePipelineCount } @@ -440,14 +651,26 @@ private constructor( /** Links to the project. */ fun links(links: Links) = links(JsonField.of(links)) - /** Links to the project. */ + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun links(links: JsonField) = apply { this.links = links } /** The number of tests in the monitoring mode of the project. */ fun monitoringGoalCount(monitoringGoalCount: Long) = monitoringGoalCount(JsonField.of(monitoringGoalCount)) - /** The number of tests in the monitoring mode of the project. */ + /** + * Sets [Builder.monitoringGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.monitoringGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { this.monitoringGoalCount = monitoringGoalCount } @@ -455,28 +678,52 @@ private constructor( /** The project name. */ fun name(name: String) = name(JsonField.of(name)) - /** The project name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The source of the project. */ fun source(source: Source?) = source(JsonField.ofNullable(source)) - /** The source of the project. */ + /** Alias for calling [Builder.source] with `source.orElse(null)`. */ fun source(source: Optional) = source(source.getOrNull()) - /** The source of the project. */ + /** + * Sets [Builder.source] to an arbitrary JSON value. + * + * You should usually call [Builder.source] with a well-typed [Source] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun source(source: JsonField) = apply { this.source = source } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) - /** The task type of the project. */ + /** + * Sets [Builder.taskType] to an arbitrary JSON value. + * + * You should usually call [Builder.taskType] with a well-typed [TaskType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun taskType(taskType: JsonField) = apply { this.taskType = taskType } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) - /** The number of versions (commits) in the project. */ + /** + * Sets [Builder.versionCount] to an arbitrary JSON value. + * + * You should usually call [Builder.versionCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun versionCount(versionCount: JsonField) = apply { this.versionCount = versionCount } @@ -484,10 +731,16 @@ private constructor( /** The workspace id. */ fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) - /** The workspace id. */ + /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) - /** The workspace id. */ + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } @@ -495,18 +748,32 @@ private constructor( /** The project description. */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** The project description. */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** The project description. */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) + /** Alias for calling [Builder.gitRepo] with `gitRepo.orElse(null)`. */ fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) + /** + * Sets [Builder.gitRepo] to an arbitrary JSON value. + * + * You should usually call [Builder.gitRepo] with a well-typed [GitRepo] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { @@ -562,8 +829,18 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun app(): String = app.getRequired("app") + /** + * Returns the raw JSON value of [app]. + * + * Unlike [app], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @@ -610,6 +887,13 @@ private constructor( fun app(app: String) = app(JsonField.of(app)) + /** + * Sets [Builder.app] to an arbitrary JSON value. + * + * You should usually call [Builder.app] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { @@ -924,60 +1208,183 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun id(): String = id.getRequired("id") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun dateConnected(): OffsetDateTime = dateConnected.getRequired("dateConnected") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun gitId(): Long = gitId.getRequired("gitId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun name(): String = name.getRequired("name") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun private_(): Boolean = private_.getRequired("private") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun projectId(): String = projectId.getRequired("projectId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun slug(): String = slug.getRequired("slug") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun url(): String = url.getRequired("url") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [dateConnected]. + * + * Unlike [dateConnected], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected(): JsonField = dateConnected + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated + /** + * Returns the raw JSON value of [gitAccountId]. + * + * Unlike [gitAccountId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId(): JsonField = gitAccountId + /** + * Returns the raw JSON value of [gitId]. + * + * Unlike [gitId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gitId") @ExcludeMissing fun _gitId(): JsonField = gitId + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [private_]. + * + * Unlike [private_], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("private") @ExcludeMissing fun _private_(): JsonField = private_ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url + /** + * Returns the raw JSON value of [branch]. + * + * Unlike [branch], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch + /** + * Returns the raw JSON value of [rootDir]. + * + * Unlike [rootDir], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir @JsonAnyGetter @@ -1066,11 +1473,25 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) + /** + * Sets [Builder.dateConnected] to an arbitrary JSON value. + * + * You should usually call [Builder.dateConnected] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun dateConnected(dateConnected: JsonField) = apply { this.dateConnected = dateConnected } @@ -1078,46 +1499,116 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) + /** + * Sets [Builder.gitAccountId] to an arbitrary JSON value. + * + * You should usually call [Builder.gitAccountId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun gitAccountId(gitAccountId: JsonField) = apply { this.gitAccountId = gitAccountId } fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) + /** + * Sets [Builder.gitId] to an arbitrary JSON value. + * + * You should usually call [Builder.gitId] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitId(gitId: JsonField) = apply { this.gitId = gitId } fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun private_(private_: Boolean) = private_(JsonField.of(private_)) + /** + * Sets [Builder.private_] to an arbitrary JSON value. + * + * You should usually call [Builder.private_] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun private_(private_: JsonField) = apply { this.private_ = private_ } fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } fun slug(slug: String) = slug(JsonField.of(slug)) + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } fun url(url: String) = url(JsonField.of(url)) + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun url(url: JsonField) = apply { this.url = url } fun branch(branch: String) = branch(JsonField.of(branch)) + /** + * Sets [Builder.branch] to an arbitrary JSON value. + * + * You should usually call [Builder.branch] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun branch(branch: JsonField) = apply { this.branch = branch } fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) + /** + * Sets [Builder.rootDir] to an arbitrary JSON value. + * + * You should usually call [Builder.rootDir] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt index 50df3663..3bc7d1f8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt @@ -35,110 +35,263 @@ private constructor( fun projectId(): String = projectId - /** The project version (commit) id. */ + /** + * The project version (commit) id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = body.id() - /** The details of a commit (project version). */ + /** + * The details of a commit (project version). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun commit(): Commit = body.commit() - /** The commit archive date. */ + /** + * The commit archive date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dateArchived(): Optional = body.dateArchived() - /** The project version (commit) creation date. */ + /** + * The project version (commit) creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = body.dateCreated() - /** The number of tests that are failing for the commit. */ + /** + * The number of tests that are failing for the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun failingGoalCount(): Long = body.failingGoalCount() - /** The model id. */ + /** + * The model id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun mlModelId(): Optional = body.mlModelId() - /** The number of tests that are passing for the commit. */ + /** + * The number of tests that are passing for the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun passingGoalCount(): Long = body.passingGoalCount() - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = body.projectId() /** * The commit status. Initially, the commit is `queued`, then, it switches to `running`. * Finally, it can be `paused`, `failed`, or `completed`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun status(): Status = body.status() - /** The commit status message. */ + /** + * The commit status message. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun statusMessage(): Optional = body.statusMessage() - /** The storage URI where the commit bundle is stored. */ + /** + * The storage URI where the commit bundle is stored. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun storageUri(): String = body.storageUri() - /** The total number of tests for the commit. */ + /** + * The total number of tests for the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun totalGoalCount(): Long = body.totalGoalCount() - /** The training dataset id. */ + /** + * The training dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun trainingDatasetId(): Optional = body.trainingDatasetId() - /** The validation dataset id. */ + /** + * The validation dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun validationDatasetId(): Optional = body.validationDatasetId() - /** Whether the commit is archived. */ + /** + * Whether the commit is archived. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun archived(): Optional = body.archived() - /** The deployment status associated with the commit's model. */ + /** + * The deployment status associated with the commit's model. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun deploymentStatus(): Optional = body.deploymentStatus() + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun links(): Optional = body.links() - /** The project version (commit) id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ fun _id(): JsonField = body._id() - /** The details of a commit (project version). */ + /** + * Returns the raw JSON value of [commit]. + * + * Unlike [commit], this method doesn't throw if the JSON field has an unexpected type. + */ fun _commit(): JsonField = body._commit() - /** The commit archive date. */ + /** + * Returns the raw JSON value of [dateArchived]. + * + * Unlike [dateArchived], this method doesn't throw if the JSON field has an unexpected type. + */ fun _dateArchived(): JsonField = body._dateArchived() - /** The project version (commit) creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ fun _dateCreated(): JsonField = body._dateCreated() - /** The number of tests that are failing for the commit. */ + /** + * Returns the raw JSON value of [failingGoalCount]. + * + * Unlike [failingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _failingGoalCount(): JsonField = body._failingGoalCount() - /** The model id. */ + /** + * Returns the raw JSON value of [mlModelId]. + * + * Unlike [mlModelId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _mlModelId(): JsonField = body._mlModelId() - /** The number of tests that are passing for the commit. */ + /** + * Returns the raw JSON value of [passingGoalCount]. + * + * Unlike [passingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _passingGoalCount(): JsonField = body._passingGoalCount() - /** The project id. */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _projectId(): JsonField = body._projectId() /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. */ fun _status(): JsonField = body._status() - /** The commit status message. */ + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected type. + */ fun _statusMessage(): JsonField = body._statusMessage() - /** The storage URI where the commit bundle is stored. */ + /** + * Returns the raw JSON value of [storageUri]. + * + * Unlike [storageUri], this method doesn't throw if the JSON field has an unexpected type. + */ fun _storageUri(): JsonField = body._storageUri() - /** The total number of tests for the commit. */ + /** + * Returns the raw JSON value of [totalGoalCount]. + * + * Unlike [totalGoalCount], this method doesn't throw if the JSON field has an unexpected type. + */ fun _totalGoalCount(): JsonField = body._totalGoalCount() - /** The training dataset id. */ + /** + * Returns the raw JSON value of [trainingDatasetId]. + * + * Unlike [trainingDatasetId], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _trainingDatasetId(): JsonField = body._trainingDatasetId() - /** The validation dataset id. */ + /** + * Returns the raw JSON value of [validationDatasetId]. + * + * Unlike [validationDatasetId], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _validationDatasetId(): JsonField = body._validationDatasetId() - /** Whether the commit is archived. */ + /** + * Returns the raw JSON value of [archived]. + * + * Unlike [archived], this method doesn't throw if the JSON field has an unexpected type. + */ fun _archived(): JsonField = body._archived() - /** The deployment status associated with the commit's model. */ + /** + * Returns the raw JSON value of [deploymentStatus]. + * + * Unlike [deploymentStatus], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _deploymentStatus(): JsonField = body._deploymentStatus() + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ fun _links(): JsonField = body._links() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -217,135 +370,291 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The project version (commit) id. */ + /** + * The project version (commit) id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The details of a commit (project version). */ + /** + * The details of a commit (project version). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun commit(): Commit = commit.getRequired("commit") - /** The commit archive date. */ + /** + * The commit archive date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun dateArchived(): Optional = Optional.ofNullable(dateArchived.getNullable("dateArchived")) - /** The project version (commit) creation date. */ + /** + * The project version (commit) creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The number of tests that are failing for the commit. */ + /** + * The number of tests that are failing for the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") - /** The model id. */ + /** + * The model id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) - /** The number of tests that are passing for the commit. */ + /** + * The number of tests that are passing for the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("projectId") /** * The commit status. Initially, the commit is `queued`, then, it switches to `running`. * Finally, it can be `paused`, `failed`, or `completed`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun status(): Status = status.getRequired("status") - /** The commit status message. */ + /** + * The commit status message. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) - /** The storage URI where the commit bundle is stored. */ + /** + * The storage URI where the commit bundle is stored. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun storageUri(): String = storageUri.getRequired("storageUri") - /** The total number of tests for the commit. */ + /** + * The total number of tests for the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") - /** The training dataset id. */ + /** + * The training dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun trainingDatasetId(): Optional = Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) - /** The validation dataset id. */ + /** + * The validation dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun validationDatasetId(): Optional = Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) - /** Whether the commit is archived. */ + /** + * Whether the commit is archived. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) - /** The deployment status associated with the commit's model. */ + /** + * The deployment status associated with the commit's model. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun deploymentStatus(): Optional = Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun links(): Optional = Optional.ofNullable(links.getNullable("links")) - /** The project version (commit) id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The details of a commit (project version). */ + /** + * Returns the raw JSON value of [commit]. + * + * Unlike [commit], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("commit") @ExcludeMissing fun _commit(): JsonField = commit - /** The commit archive date. */ + /** + * Returns the raw JSON value of [dateArchived]. + * + * Unlike [dateArchived], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived(): JsonField = dateArchived - /** The project version (commit) creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The number of tests that are failing for the commit. */ + /** + * Returns the raw JSON value of [failingGoalCount]. + * + * Unlike [failingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount(): JsonField = failingGoalCount - /** The model id. */ + /** + * Returns the raw JSON value of [mlModelId]. + * + * Unlike [mlModelId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId(): JsonField = mlModelId - /** The number of tests that are passing for the commit. */ + /** + * Returns the raw JSON value of [passingGoalCount]. + * + * Unlike [passingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount(): JsonField = passingGoalCount - /** The project id. */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The commit status message. */ + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage(): JsonField = statusMessage - /** The storage URI where the commit bundle is stored. */ + /** + * Returns the raw JSON value of [storageUri]. + * + * Unlike [storageUri], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("storageUri") @ExcludeMissing fun _storageUri(): JsonField = storageUri - /** The total number of tests for the commit. */ + /** + * Returns the raw JSON value of [totalGoalCount]. + * + * Unlike [totalGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount(): JsonField = totalGoalCount - /** The training dataset id. */ + /** + * Returns the raw JSON value of [trainingDatasetId]. + * + * Unlike [trainingDatasetId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("trainingDatasetId") @ExcludeMissing fun _trainingDatasetId(): JsonField = trainingDatasetId - /** The validation dataset id. */ + /** + * Returns the raw JSON value of [validationDatasetId]. + * + * Unlike [validationDatasetId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("validationDatasetId") @ExcludeMissing fun _validationDatasetId(): JsonField = validationDatasetId - /** Whether the commit is archived. */ + /** + * Returns the raw JSON value of [archived]. + * + * Unlike [archived], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived - /** The deployment status associated with the commit's model. */ + /** + * Returns the raw JSON value of [deploymentStatus]. + * + * Unlike [deploymentStatus], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("deploymentStatus") @ExcludeMissing fun _deploymentStatus(): JsonField = deploymentStatus + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links @JsonAnyGetter @@ -454,24 +763,42 @@ private constructor( /** The project version (commit) id. */ fun id(id: String) = id(JsonField.of(id)) - /** The project version (commit) id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The details of a commit (project version). */ fun commit(commit: Commit) = commit(JsonField.of(commit)) - /** The details of a commit (project version). */ + /** + * Sets [Builder.commit] to an arbitrary JSON value. + * + * You should usually call [Builder.commit] with a well-typed [Commit] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun commit(commit: JsonField) = apply { this.commit = commit } /** The commit archive date. */ fun dateArchived(dateArchived: OffsetDateTime?) = dateArchived(JsonField.ofNullable(dateArchived)) - /** The commit archive date. */ + /** Alias for calling [Builder.dateArchived] with `dateArchived.orElse(null)`. */ fun dateArchived(dateArchived: Optional) = dateArchived(dateArchived.getOrNull()) - /** The commit archive date. */ + /** + * Sets [Builder.dateArchived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateArchived] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateArchived(dateArchived: JsonField) = apply { this.dateArchived = dateArchived } @@ -479,7 +806,13 @@ private constructor( /** The project version (commit) creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The project version (commit) creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -488,7 +821,13 @@ private constructor( fun failingGoalCount(failingGoalCount: Long) = failingGoalCount(JsonField.of(failingGoalCount)) - /** The number of tests that are failing for the commit. */ + /** + * Sets [Builder.failingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun failingGoalCount(failingGoalCount: JsonField) = apply { this.failingGoalCount = failingGoalCount } @@ -496,17 +835,29 @@ private constructor( /** The model id. */ fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) - /** The model id. */ + /** Alias for calling [Builder.mlModelId] with `mlModelId.orElse(null)`. */ fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) - /** The model id. */ + /** + * Sets [Builder.mlModelId] to an arbitrary JSON value. + * + * You should usually call [Builder.mlModelId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } /** The number of tests that are passing for the commit. */ fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) - /** The number of tests that are passing for the commit. */ + /** + * Sets [Builder.passingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun passingGoalCount(passingGoalCount: JsonField) = apply { this.passingGoalCount = passingGoalCount } @@ -514,7 +865,13 @@ private constructor( /** The project id. */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** The project id. */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** @@ -524,8 +881,11 @@ private constructor( fun status(status: Status) = status(JsonField.of(status)) /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun status(status: JsonField) = apply { this.status = status } @@ -533,11 +893,17 @@ private constructor( fun statusMessage(statusMessage: String?) = statusMessage(JsonField.ofNullable(statusMessage)) - /** The commit status message. */ + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ fun statusMessage(statusMessage: Optional) = statusMessage(statusMessage.getOrNull()) - /** The commit status message. */ + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } @@ -545,13 +911,25 @@ private constructor( /** The storage URI where the commit bundle is stored. */ fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) - /** The storage URI where the commit bundle is stored. */ + /** + * Sets [Builder.storageUri] to an arbitrary JSON value. + * + * You should usually call [Builder.storageUri] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } /** The total number of tests for the commit. */ fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - /** The total number of tests for the commit. */ + /** + * Sets [Builder.totalGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun totalGoalCount(totalGoalCount: JsonField) = apply { this.totalGoalCount = totalGoalCount } @@ -560,11 +938,19 @@ private constructor( fun trainingDatasetId(trainingDatasetId: String?) = trainingDatasetId(JsonField.ofNullable(trainingDatasetId)) - /** The training dataset id. */ + /** + * Alias for calling [Builder.trainingDatasetId] with `trainingDatasetId.orElse(null)`. + */ fun trainingDatasetId(trainingDatasetId: Optional) = trainingDatasetId(trainingDatasetId.getOrNull()) - /** The training dataset id. */ + /** + * Sets [Builder.trainingDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.trainingDatasetId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun trainingDatasetId(trainingDatasetId: JsonField) = apply { this.trainingDatasetId = trainingDatasetId } @@ -573,11 +959,20 @@ private constructor( fun validationDatasetId(validationDatasetId: String?) = validationDatasetId(JsonField.ofNullable(validationDatasetId)) - /** The validation dataset id. */ + /** + * Alias for calling [Builder.validationDatasetId] with + * `validationDatasetId.orElse(null)`. + */ fun validationDatasetId(validationDatasetId: Optional) = validationDatasetId(validationDatasetId.getOrNull()) - /** The validation dataset id. */ + /** + * Sets [Builder.validationDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.validationDatasetId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun validationDatasetId(validationDatasetId: JsonField) = apply { this.validationDatasetId = validationDatasetId } @@ -585,26 +980,49 @@ private constructor( /** Whether the commit is archived. */ fun archived(archived: Boolean?) = archived(JsonField.ofNullable(archived)) - /** Whether the commit is archived. */ + /** + * Alias for [Builder.archived]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun archived(archived: Boolean) = archived(archived as Boolean?) - /** Whether the commit is archived. */ + /** Alias for calling [Builder.archived] with `archived.orElse(null)`. */ fun archived(archived: Optional) = archived(archived.getOrNull()) - /** Whether the commit is archived. */ + /** + * Sets [Builder.archived] to an arbitrary JSON value. + * + * You should usually call [Builder.archived] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun archived(archived: JsonField) = apply { this.archived = archived } /** The deployment status associated with the commit's model. */ fun deploymentStatus(deploymentStatus: String) = deploymentStatus(JsonField.of(deploymentStatus)) - /** The deployment status associated with the commit's model. */ + /** + * Sets [Builder.deploymentStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.deploymentStatus] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun deploymentStatus(deploymentStatus: JsonField) = apply { this.deploymentStatus = deploymentStatus } fun links(links: Links) = links(JsonField.of(links)) + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun links(links: JsonField) = apply { this.links = links } fun additionalProperties(additionalProperties: Map) = apply { @@ -718,23 +1136,39 @@ private constructor( /** The project version (commit) id. */ fun id(id: String) = apply { body.id(id) } - /** The project version (commit) id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { body.id(id) } /** The details of a commit (project version). */ fun commit(commit: Commit) = apply { body.commit(commit) } - /** The details of a commit (project version). */ + /** + * Sets [Builder.commit] to an arbitrary JSON value. + * + * You should usually call [Builder.commit] with a well-typed [Commit] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun commit(commit: JsonField) = apply { body.commit(commit) } /** The commit archive date. */ fun dateArchived(dateArchived: OffsetDateTime?) = apply { body.dateArchived(dateArchived) } - /** The commit archive date. */ + /** Alias for calling [Builder.dateArchived] with `dateArchived.orElse(null)`. */ fun dateArchived(dateArchived: Optional) = dateArchived(dateArchived.getOrNull()) - /** The commit archive date. */ + /** + * Sets [Builder.dateArchived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateArchived] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dateArchived(dateArchived: JsonField) = apply { body.dateArchived(dateArchived) } @@ -742,7 +1176,13 @@ private constructor( /** The project version (commit) creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = apply { body.dateCreated(dateCreated) } - /** The project version (commit) creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { body.dateCreated(dateCreated) } @@ -752,7 +1192,13 @@ private constructor( body.failingGoalCount(failingGoalCount) } - /** The number of tests that are failing for the commit. */ + /** + * Sets [Builder.failingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun failingGoalCount(failingGoalCount: JsonField) = apply { body.failingGoalCount(failingGoalCount) } @@ -760,10 +1206,16 @@ private constructor( /** The model id. */ fun mlModelId(mlModelId: String?) = apply { body.mlModelId(mlModelId) } - /** The model id. */ + /** Alias for calling [Builder.mlModelId] with `mlModelId.orElse(null)`. */ fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) - /** The model id. */ + /** + * Sets [Builder.mlModelId] to an arbitrary JSON value. + * + * You should usually call [Builder.mlModelId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun mlModelId(mlModelId: JsonField) = apply { body.mlModelId(mlModelId) } /** The number of tests that are passing for the commit. */ @@ -771,7 +1223,13 @@ private constructor( body.passingGoalCount(passingGoalCount) } - /** The number of tests that are passing for the commit. */ + /** + * Sets [Builder.passingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun passingGoalCount(passingGoalCount: JsonField) = apply { body.passingGoalCount(passingGoalCount) } @@ -779,7 +1237,13 @@ private constructor( /** The project id. */ fun projectId(projectId: String) = apply { body.projectId(projectId) } - /** The project id. */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } /** @@ -789,19 +1253,27 @@ private constructor( fun status(status: Status) = apply { body.status(status) } /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun status(status: JsonField) = apply { body.status(status) } /** The commit status message. */ fun statusMessage(statusMessage: String?) = apply { body.statusMessage(statusMessage) } - /** The commit status message. */ + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ fun statusMessage(statusMessage: Optional) = statusMessage(statusMessage.getOrNull()) - /** The commit status message. */ + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun statusMessage(statusMessage: JsonField) = apply { body.statusMessage(statusMessage) } @@ -809,13 +1281,25 @@ private constructor( /** The storage URI where the commit bundle is stored. */ fun storageUri(storageUri: String) = apply { body.storageUri(storageUri) } - /** The storage URI where the commit bundle is stored. */ + /** + * Sets [Builder.storageUri] to an arbitrary JSON value. + * + * You should usually call [Builder.storageUri] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun storageUri(storageUri: JsonField) = apply { body.storageUri(storageUri) } /** The total number of tests for the commit. */ fun totalGoalCount(totalGoalCount: Long) = apply { body.totalGoalCount(totalGoalCount) } - /** The total number of tests for the commit. */ + /** + * Sets [Builder.totalGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun totalGoalCount(totalGoalCount: JsonField) = apply { body.totalGoalCount(totalGoalCount) } @@ -825,11 +1309,17 @@ private constructor( body.trainingDatasetId(trainingDatasetId) } - /** The training dataset id. */ + /** Alias for calling [Builder.trainingDatasetId] with `trainingDatasetId.orElse(null)`. */ fun trainingDatasetId(trainingDatasetId: Optional) = trainingDatasetId(trainingDatasetId.getOrNull()) - /** The training dataset id. */ + /** + * Sets [Builder.trainingDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.trainingDatasetId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun trainingDatasetId(trainingDatasetId: JsonField) = apply { body.trainingDatasetId(trainingDatasetId) } @@ -839,11 +1329,19 @@ private constructor( body.validationDatasetId(validationDatasetId) } - /** The validation dataset id. */ + /** + * Alias for calling [Builder.validationDatasetId] with `validationDatasetId.orElse(null)`. + */ fun validationDatasetId(validationDatasetId: Optional) = validationDatasetId(validationDatasetId.getOrNull()) - /** The validation dataset id. */ + /** + * Sets [Builder.validationDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.validationDatasetId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun validationDatasetId(validationDatasetId: JsonField) = apply { body.validationDatasetId(validationDatasetId) } @@ -851,13 +1349,23 @@ private constructor( /** Whether the commit is archived. */ fun archived(archived: Boolean?) = apply { body.archived(archived) } - /** Whether the commit is archived. */ + /** + * Alias for [Builder.archived]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun archived(archived: Boolean) = archived(archived as Boolean?) - /** Whether the commit is archived. */ + /** Alias for calling [Builder.archived] with `archived.orElse(null)`. */ fun archived(archived: Optional) = archived(archived.getOrNull()) - /** Whether the commit is archived. */ + /** + * Sets [Builder.archived] to an arbitrary JSON value. + * + * You should usually call [Builder.archived] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun archived(archived: JsonField) = apply { body.archived(archived) } /** The deployment status associated with the commit's model. */ @@ -865,13 +1373,25 @@ private constructor( body.deploymentStatus(deploymentStatus) } - /** The deployment status associated with the commit's model. */ + /** + * Sets [Builder.deploymentStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.deploymentStatus] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun deploymentStatus(deploymentStatus: JsonField) = apply { body.deploymentStatus(deploymentStatus) } fun links(links: Links) = apply { body.links(links) } + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun links(links: JsonField) = apply { body.links(links) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { @@ -1043,94 +1563,207 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The commit id. */ + /** + * The commit id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The author id of the commit. */ + /** + * The author id of the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun authorId(): String = authorId.getRequired("authorId") - /** The size of the commit bundle in bytes. */ + /** + * The size of the commit bundle in bytes. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun fileSize(): Optional = Optional.ofNullable(fileSize.getNullable("fileSize")) - /** The commit message. */ + /** + * The commit message. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun message(): String = message.getRequired("message") - /** The model id. */ + /** + * The model id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) - /** The storage URI where the commit bundle is stored. */ + /** + * The storage URI where the commit bundle is stored. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun storageUri(): String = storageUri.getRequired("storageUri") - /** The training dataset id. */ + /** + * The training dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun trainingDatasetId(): Optional = Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) - /** The validation dataset id. */ + /** + * The validation dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun validationDatasetId(): Optional = Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) - /** The commit creation date. */ + /** + * The commit creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun dateCreated(): Optional = Optional.ofNullable(dateCreated.getNullable("dateCreated")) - /** The ref of the corresponding git commit. */ + /** + * The ref of the corresponding git commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun gitCommitRef(): Optional = Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) - /** The SHA of the corresponding git commit. */ + /** + * The SHA of the corresponding git commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun gitCommitSha(): Optional = Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) - /** The URL of the corresponding git commit. */ + /** + * The URL of the corresponding git commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun gitCommitUrl(): Optional = Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) - /** The commit id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The author id of the commit. */ + /** + * Returns the raw JSON value of [authorId]. + * + * Unlike [authorId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("authorId") @ExcludeMissing fun _authorId(): JsonField = authorId - /** The size of the commit bundle in bytes. */ + /** + * Returns the raw JSON value of [fileSize]. + * + * Unlike [fileSize], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("fileSize") @ExcludeMissing fun _fileSize(): JsonField = fileSize - /** The commit message. */ + /** + * Returns the raw JSON value of [message]. + * + * Unlike [message], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("message") @ExcludeMissing fun _message(): JsonField = message - /** The model id. */ + /** + * Returns the raw JSON value of [mlModelId]. + * + * Unlike [mlModelId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId(): JsonField = mlModelId - /** The storage URI where the commit bundle is stored. */ + /** + * Returns the raw JSON value of [storageUri]. + * + * Unlike [storageUri], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("storageUri") @ExcludeMissing fun _storageUri(): JsonField = storageUri - /** The training dataset id. */ + /** + * Returns the raw JSON value of [trainingDatasetId]. + * + * Unlike [trainingDatasetId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("trainingDatasetId") @ExcludeMissing fun _trainingDatasetId(): JsonField = trainingDatasetId - /** The validation dataset id. */ + /** + * Returns the raw JSON value of [validationDatasetId]. + * + * Unlike [validationDatasetId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("validationDatasetId") @ExcludeMissing fun _validationDatasetId(): JsonField = validationDatasetId - /** The commit creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The ref of the corresponding git commit. */ + /** + * Returns the raw JSON value of [gitCommitRef]. + * + * Unlike [gitCommitRef], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitCommitRef") @ExcludeMissing fun _gitCommitRef(): JsonField = gitCommitRef - /** The SHA of the corresponding git commit. */ + /** + * Returns the raw JSON value of [gitCommitSha]. + * + * Unlike [gitCommitSha], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitCommitSha") @ExcludeMissing fun _gitCommitSha(): JsonField = gitCommitSha - /** The URL of the corresponding git commit. */ + /** + * Returns the raw JSON value of [gitCommitUrl]. + * + * Unlike [gitCommitUrl], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitCommitUrl") @ExcludeMissing fun _gitCommitUrl(): JsonField = gitCommitUrl @@ -1220,57 +1853,105 @@ private constructor( /** The commit id. */ fun id(id: String) = id(JsonField.of(id)) - /** The commit id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The author id of the commit. */ fun authorId(authorId: String) = authorId(JsonField.of(authorId)) - /** The author id of the commit. */ + /** + * Sets [Builder.authorId] to an arbitrary JSON value. + * + * You should usually call [Builder.authorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun authorId(authorId: JsonField) = apply { this.authorId = authorId } /** The size of the commit bundle in bytes. */ fun fileSize(fileSize: Long?) = fileSize(JsonField.ofNullable(fileSize)) - /** The size of the commit bundle in bytes. */ + /** + * Alias for [Builder.fileSize]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun fileSize(fileSize: Long) = fileSize(fileSize as Long?) - /** The size of the commit bundle in bytes. */ + /** Alias for calling [Builder.fileSize] with `fileSize.orElse(null)`. */ fun fileSize(fileSize: Optional) = fileSize(fileSize.getOrNull()) - /** The size of the commit bundle in bytes. */ + /** + * Sets [Builder.fileSize] to an arbitrary JSON value. + * + * You should usually call [Builder.fileSize] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun fileSize(fileSize: JsonField) = apply { this.fileSize = fileSize } /** The commit message. */ fun message(message: String) = message(JsonField.of(message)) - /** The commit message. */ + /** + * Sets [Builder.message] to an arbitrary JSON value. + * + * You should usually call [Builder.message] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun message(message: JsonField) = apply { this.message = message } /** The model id. */ fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) - /** The model id. */ + /** Alias for calling [Builder.mlModelId] with `mlModelId.orElse(null)`. */ fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) - /** The model id. */ + /** + * Sets [Builder.mlModelId] to an arbitrary JSON value. + * + * You should usually call [Builder.mlModelId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } /** The storage URI where the commit bundle is stored. */ fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) - /** The storage URI where the commit bundle is stored. */ + /** + * Sets [Builder.storageUri] to an arbitrary JSON value. + * + * You should usually call [Builder.storageUri] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: String?) = trainingDatasetId(JsonField.ofNullable(trainingDatasetId)) - /** The training dataset id. */ + /** + * Alias for calling [Builder.trainingDatasetId] with `trainingDatasetId.orElse(null)`. + */ fun trainingDatasetId(trainingDatasetId: Optional) = trainingDatasetId(trainingDatasetId.getOrNull()) - /** The training dataset id. */ + /** + * Sets [Builder.trainingDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.trainingDatasetId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun trainingDatasetId(trainingDatasetId: JsonField) = apply { this.trainingDatasetId = trainingDatasetId } @@ -1279,11 +1960,20 @@ private constructor( fun validationDatasetId(validationDatasetId: String?) = validationDatasetId(JsonField.ofNullable(validationDatasetId)) - /** The validation dataset id. */ + /** + * Alias for calling [Builder.validationDatasetId] with + * `validationDatasetId.orElse(null)`. + */ fun validationDatasetId(validationDatasetId: Optional) = validationDatasetId(validationDatasetId.getOrNull()) - /** The validation dataset id. */ + /** + * Sets [Builder.validationDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.validationDatasetId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun validationDatasetId(validationDatasetId: JsonField) = apply { this.validationDatasetId = validationDatasetId } @@ -1291,7 +1981,13 @@ private constructor( /** The commit creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The commit creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -1299,7 +1995,13 @@ private constructor( /** The ref of the corresponding git commit. */ fun gitCommitRef(gitCommitRef: String) = gitCommitRef(JsonField.of(gitCommitRef)) - /** The ref of the corresponding git commit. */ + /** + * Sets [Builder.gitCommitRef] to an arbitrary JSON value. + * + * You should usually call [Builder.gitCommitRef] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitCommitRef(gitCommitRef: JsonField) = apply { this.gitCommitRef = gitCommitRef } @@ -1307,7 +2009,13 @@ private constructor( /** The SHA of the corresponding git commit. */ fun gitCommitSha(gitCommitSha: Long) = gitCommitSha(JsonField.of(gitCommitSha)) - /** The SHA of the corresponding git commit. */ + /** + * Sets [Builder.gitCommitSha] to an arbitrary JSON value. + * + * You should usually call [Builder.gitCommitSha] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitCommitSha(gitCommitSha: JsonField) = apply { this.gitCommitSha = gitCommitSha } @@ -1315,7 +2023,13 @@ private constructor( /** The URL of the corresponding git commit. */ fun gitCommitUrl(gitCommitUrl: String) = gitCommitUrl(JsonField.of(gitCommitUrl)) - /** The URL of the corresponding git commit. */ + /** + * Sets [Builder.gitCommitUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.gitCommitUrl] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitCommitUrl(gitCommitUrl: JsonField) = apply { this.gitCommitUrl = gitCommitUrl } @@ -1512,8 +2226,17 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun app(): String = app.getRequired("app") + /** + * Returns the raw JSON value of [app]. + * + * Unlike [app], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @@ -1560,6 +2283,13 @@ private constructor( fun app(app: String) = app(JsonField.of(app)) + /** + * Sets [Builder.app] to an arbitrary JSON value. + * + * You should usually call [Builder.app] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt index 5ea76e58..87773c0e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt @@ -75,133 +75,286 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The project version (commit) id. */ + /** + * The project version (commit) id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The details of a commit (project version). */ + /** + * The details of a commit (project version). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun commit(): Commit = commit.getRequired("commit") - /** The commit archive date. */ + /** + * The commit archive date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dateArchived(): Optional = Optional.ofNullable(dateArchived.getNullable("dateArchived")) - /** The project version (commit) creation date. */ + /** + * The project version (commit) creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The number of tests that are failing for the commit. */ + /** + * The number of tests that are failing for the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") - /** The model id. */ + /** + * The model id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) - /** The number of tests that are passing for the commit. */ + /** + * The number of tests that are passing for the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("projectId") /** * The commit status. Initially, the commit is `queued`, then, it switches to `running`. * Finally, it can be `paused`, `failed`, or `completed`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun status(): Status = status.getRequired("status") - /** The commit status message. */ + /** + * The commit status message. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) - /** The storage URI where the commit bundle is stored. */ + /** + * The storage URI where the commit bundle is stored. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun storageUri(): String = storageUri.getRequired("storageUri") - /** The total number of tests for the commit. */ + /** + * The total number of tests for the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") - /** The training dataset id. */ + /** + * The training dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun trainingDatasetId(): Optional = Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) - /** The validation dataset id. */ + /** + * The validation dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun validationDatasetId(): Optional = Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) - /** Whether the commit is archived. */ + /** + * Whether the commit is archived. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) - /** The deployment status associated with the commit's model. */ + /** + * The deployment status associated with the commit's model. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun deploymentStatus(): Optional = Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun links(): Optional = Optional.ofNullable(links.getNullable("links")) - /** The project version (commit) id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The details of a commit (project version). */ + /** + * Returns the raw JSON value of [commit]. + * + * Unlike [commit], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("commit") @ExcludeMissing fun _commit(): JsonField = commit - /** The commit archive date. */ + /** + * Returns the raw JSON value of [dateArchived]. + * + * Unlike [dateArchived], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived(): JsonField = dateArchived - /** The project version (commit) creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The number of tests that are failing for the commit. */ + /** + * Returns the raw JSON value of [failingGoalCount]. + * + * Unlike [failingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount(): JsonField = failingGoalCount - /** The model id. */ + /** + * Returns the raw JSON value of [mlModelId]. + * + * Unlike [mlModelId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId(): JsonField = mlModelId - /** The number of tests that are passing for the commit. */ + /** + * Returns the raw JSON value of [passingGoalCount]. + * + * Unlike [passingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount(): JsonField = passingGoalCount - /** The project id. */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The commit status message. */ + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage(): JsonField = statusMessage - /** The storage URI where the commit bundle is stored. */ + /** + * Returns the raw JSON value of [storageUri]. + * + * Unlike [storageUri], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("storageUri") @ExcludeMissing fun _storageUri(): JsonField = storageUri - /** The total number of tests for the commit. */ + /** + * Returns the raw JSON value of [totalGoalCount]. + * + * Unlike [totalGoalCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount(): JsonField = totalGoalCount - /** The training dataset id. */ + /** + * Returns the raw JSON value of [trainingDatasetId]. + * + * Unlike [trainingDatasetId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("trainingDatasetId") @ExcludeMissing fun _trainingDatasetId(): JsonField = trainingDatasetId - /** The validation dataset id. */ + /** + * Returns the raw JSON value of [validationDatasetId]. + * + * Unlike [validationDatasetId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("validationDatasetId") @ExcludeMissing fun _validationDatasetId(): JsonField = validationDatasetId - /** Whether the commit is archived. */ + /** + * Returns the raw JSON value of [archived]. + * + * Unlike [archived], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived - /** The deployment status associated with the commit's model. */ + /** + * Returns the raw JSON value of [deploymentStatus]. + * + * Unlike [deploymentStatus], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("deploymentStatus") @ExcludeMissing fun _deploymentStatus(): JsonField = deploymentStatus + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links @JsonAnyGetter @@ -310,24 +463,40 @@ private constructor( /** The project version (commit) id. */ fun id(id: String) = id(JsonField.of(id)) - /** The project version (commit) id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** The details of a commit (project version). */ fun commit(commit: Commit) = commit(JsonField.of(commit)) - /** The details of a commit (project version). */ + /** + * Sets [Builder.commit] to an arbitrary JSON value. + * + * You should usually call [Builder.commit] with a well-typed [Commit] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun commit(commit: JsonField) = apply { this.commit = commit } /** The commit archive date. */ fun dateArchived(dateArchived: OffsetDateTime?) = dateArchived(JsonField.ofNullable(dateArchived)) - /** The commit archive date. */ + /** Alias for calling [Builder.dateArchived] with `dateArchived.orElse(null)`. */ fun dateArchived(dateArchived: Optional) = dateArchived(dateArchived.getOrNull()) - /** The commit archive date. */ + /** + * Sets [Builder.dateArchived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateArchived] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dateArchived(dateArchived: JsonField) = apply { this.dateArchived = dateArchived } @@ -335,7 +504,13 @@ private constructor( /** The project version (commit) creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The project version (commit) creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -344,7 +519,13 @@ private constructor( fun failingGoalCount(failingGoalCount: Long) = failingGoalCount(JsonField.of(failingGoalCount)) - /** The number of tests that are failing for the commit. */ + /** + * Sets [Builder.failingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun failingGoalCount(failingGoalCount: JsonField) = apply { this.failingGoalCount = failingGoalCount } @@ -352,17 +533,29 @@ private constructor( /** The model id. */ fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) - /** The model id. */ + /** Alias for calling [Builder.mlModelId] with `mlModelId.orElse(null)`. */ fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) - /** The model id. */ + /** + * Sets [Builder.mlModelId] to an arbitrary JSON value. + * + * You should usually call [Builder.mlModelId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } /** The number of tests that are passing for the commit. */ fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) - /** The number of tests that are passing for the commit. */ + /** + * Sets [Builder.passingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun passingGoalCount(passingGoalCount: JsonField) = apply { this.passingGoalCount = passingGoalCount } @@ -370,7 +563,13 @@ private constructor( /** The project id. */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** The project id. */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** @@ -380,8 +579,10 @@ private constructor( fun status(status: Status) = status(JsonField.of(status)) /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun status(status: JsonField) = apply { this.status = status } @@ -389,11 +590,17 @@ private constructor( fun statusMessage(statusMessage: String?) = statusMessage(JsonField.ofNullable(statusMessage)) - /** The commit status message. */ + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ fun statusMessage(statusMessage: Optional) = statusMessage(statusMessage.getOrNull()) - /** The commit status message. */ + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } @@ -401,13 +608,25 @@ private constructor( /** The storage URI where the commit bundle is stored. */ fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) - /** The storage URI where the commit bundle is stored. */ + /** + * Sets [Builder.storageUri] to an arbitrary JSON value. + * + * You should usually call [Builder.storageUri] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } /** The total number of tests for the commit. */ fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - /** The total number of tests for the commit. */ + /** + * Sets [Builder.totalGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun totalGoalCount(totalGoalCount: JsonField) = apply { this.totalGoalCount = totalGoalCount } @@ -416,11 +635,17 @@ private constructor( fun trainingDatasetId(trainingDatasetId: String?) = trainingDatasetId(JsonField.ofNullable(trainingDatasetId)) - /** The training dataset id. */ + /** Alias for calling [Builder.trainingDatasetId] with `trainingDatasetId.orElse(null)`. */ fun trainingDatasetId(trainingDatasetId: Optional) = trainingDatasetId(trainingDatasetId.getOrNull()) - /** The training dataset id. */ + /** + * Sets [Builder.trainingDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.trainingDatasetId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun trainingDatasetId(trainingDatasetId: JsonField) = apply { this.trainingDatasetId = trainingDatasetId } @@ -429,11 +654,19 @@ private constructor( fun validationDatasetId(validationDatasetId: String?) = validationDatasetId(JsonField.ofNullable(validationDatasetId)) - /** The validation dataset id. */ + /** + * Alias for calling [Builder.validationDatasetId] with `validationDatasetId.orElse(null)`. + */ fun validationDatasetId(validationDatasetId: Optional) = validationDatasetId(validationDatasetId.getOrNull()) - /** The validation dataset id. */ + /** + * Sets [Builder.validationDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.validationDatasetId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun validationDatasetId(validationDatasetId: JsonField) = apply { this.validationDatasetId = validationDatasetId } @@ -441,26 +674,48 @@ private constructor( /** Whether the commit is archived. */ fun archived(archived: Boolean?) = archived(JsonField.ofNullable(archived)) - /** Whether the commit is archived. */ + /** + * Alias for [Builder.archived]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun archived(archived: Boolean) = archived(archived as Boolean?) - /** Whether the commit is archived. */ + /** Alias for calling [Builder.archived] with `archived.orElse(null)`. */ fun archived(archived: Optional) = archived(archived.getOrNull()) - /** Whether the commit is archived. */ + /** + * Sets [Builder.archived] to an arbitrary JSON value. + * + * You should usually call [Builder.archived] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun archived(archived: JsonField) = apply { this.archived = archived } /** The deployment status associated with the commit's model. */ fun deploymentStatus(deploymentStatus: String) = deploymentStatus(JsonField.of(deploymentStatus)) - /** The deployment status associated with the commit's model. */ + /** + * Sets [Builder.deploymentStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.deploymentStatus] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun deploymentStatus(deploymentStatus: JsonField) = apply { this.deploymentStatus = deploymentStatus } fun links(links: Links) = links(JsonField.of(links)) + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun links(links: JsonField) = apply { this.links = links } fun additionalProperties(additionalProperties: Map) = apply { @@ -548,94 +803,207 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The commit id. */ + /** + * The commit id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The author id of the commit. */ + /** + * The author id of the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun authorId(): String = authorId.getRequired("authorId") - /** The size of the commit bundle in bytes. */ + /** + * The size of the commit bundle in bytes. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun fileSize(): Optional = Optional.ofNullable(fileSize.getNullable("fileSize")) - /** The commit message. */ + /** + * The commit message. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun message(): String = message.getRequired("message") - /** The model id. */ + /** + * The model id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) - /** The storage URI where the commit bundle is stored. */ + /** + * The storage URI where the commit bundle is stored. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun storageUri(): String = storageUri.getRequired("storageUri") - /** The training dataset id. */ + /** + * The training dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun trainingDatasetId(): Optional = Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) - /** The validation dataset id. */ + /** + * The validation dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun validationDatasetId(): Optional = Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) - /** The commit creation date. */ + /** + * The commit creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun dateCreated(): Optional = Optional.ofNullable(dateCreated.getNullable("dateCreated")) - /** The ref of the corresponding git commit. */ + /** + * The ref of the corresponding git commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun gitCommitRef(): Optional = Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) - /** The SHA of the corresponding git commit. */ + /** + * The SHA of the corresponding git commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun gitCommitSha(): Optional = Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) - /** The URL of the corresponding git commit. */ + /** + * The URL of the corresponding git commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun gitCommitUrl(): Optional = Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) - /** The commit id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The author id of the commit. */ + /** + * Returns the raw JSON value of [authorId]. + * + * Unlike [authorId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("authorId") @ExcludeMissing fun _authorId(): JsonField = authorId - /** The size of the commit bundle in bytes. */ + /** + * Returns the raw JSON value of [fileSize]. + * + * Unlike [fileSize], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("fileSize") @ExcludeMissing fun _fileSize(): JsonField = fileSize - /** The commit message. */ + /** + * Returns the raw JSON value of [message]. + * + * Unlike [message], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("message") @ExcludeMissing fun _message(): JsonField = message - /** The model id. */ + /** + * Returns the raw JSON value of [mlModelId]. + * + * Unlike [mlModelId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId(): JsonField = mlModelId - /** The storage URI where the commit bundle is stored. */ + /** + * Returns the raw JSON value of [storageUri]. + * + * Unlike [storageUri], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("storageUri") @ExcludeMissing fun _storageUri(): JsonField = storageUri - /** The training dataset id. */ + /** + * Returns the raw JSON value of [trainingDatasetId]. + * + * Unlike [trainingDatasetId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("trainingDatasetId") @ExcludeMissing fun _trainingDatasetId(): JsonField = trainingDatasetId - /** The validation dataset id. */ + /** + * Returns the raw JSON value of [validationDatasetId]. + * + * Unlike [validationDatasetId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("validationDatasetId") @ExcludeMissing fun _validationDatasetId(): JsonField = validationDatasetId - /** The commit creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The ref of the corresponding git commit. */ + /** + * Returns the raw JSON value of [gitCommitRef]. + * + * Unlike [gitCommitRef], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitCommitRef") @ExcludeMissing fun _gitCommitRef(): JsonField = gitCommitRef - /** The SHA of the corresponding git commit. */ + /** + * Returns the raw JSON value of [gitCommitSha]. + * + * Unlike [gitCommitSha], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitCommitSha") @ExcludeMissing fun _gitCommitSha(): JsonField = gitCommitSha - /** The URL of the corresponding git commit. */ + /** + * Returns the raw JSON value of [gitCommitUrl]. + * + * Unlike [gitCommitUrl], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitCommitUrl") @ExcludeMissing fun _gitCommitUrl(): JsonField = gitCommitUrl @@ -725,57 +1093,105 @@ private constructor( /** The commit id. */ fun id(id: String) = id(JsonField.of(id)) - /** The commit id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The author id of the commit. */ fun authorId(authorId: String) = authorId(JsonField.of(authorId)) - /** The author id of the commit. */ + /** + * Sets [Builder.authorId] to an arbitrary JSON value. + * + * You should usually call [Builder.authorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun authorId(authorId: JsonField) = apply { this.authorId = authorId } /** The size of the commit bundle in bytes. */ fun fileSize(fileSize: Long?) = fileSize(JsonField.ofNullable(fileSize)) - /** The size of the commit bundle in bytes. */ + /** + * Alias for [Builder.fileSize]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun fileSize(fileSize: Long) = fileSize(fileSize as Long?) - /** The size of the commit bundle in bytes. */ + /** Alias for calling [Builder.fileSize] with `fileSize.orElse(null)`. */ fun fileSize(fileSize: Optional) = fileSize(fileSize.getOrNull()) - /** The size of the commit bundle in bytes. */ + /** + * Sets [Builder.fileSize] to an arbitrary JSON value. + * + * You should usually call [Builder.fileSize] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun fileSize(fileSize: JsonField) = apply { this.fileSize = fileSize } /** The commit message. */ fun message(message: String) = message(JsonField.of(message)) - /** The commit message. */ + /** + * Sets [Builder.message] to an arbitrary JSON value. + * + * You should usually call [Builder.message] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun message(message: JsonField) = apply { this.message = message } /** The model id. */ fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) - /** The model id. */ + /** Alias for calling [Builder.mlModelId] with `mlModelId.orElse(null)`. */ fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) - /** The model id. */ + /** + * Sets [Builder.mlModelId] to an arbitrary JSON value. + * + * You should usually call [Builder.mlModelId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } /** The storage URI where the commit bundle is stored. */ fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) - /** The storage URI where the commit bundle is stored. */ + /** + * Sets [Builder.storageUri] to an arbitrary JSON value. + * + * You should usually call [Builder.storageUri] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } /** The training dataset id. */ fun trainingDatasetId(trainingDatasetId: String?) = trainingDatasetId(JsonField.ofNullable(trainingDatasetId)) - /** The training dataset id. */ + /** + * Alias for calling [Builder.trainingDatasetId] with `trainingDatasetId.orElse(null)`. + */ fun trainingDatasetId(trainingDatasetId: Optional) = trainingDatasetId(trainingDatasetId.getOrNull()) - /** The training dataset id. */ + /** + * Sets [Builder.trainingDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.trainingDatasetId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun trainingDatasetId(trainingDatasetId: JsonField) = apply { this.trainingDatasetId = trainingDatasetId } @@ -784,11 +1200,20 @@ private constructor( fun validationDatasetId(validationDatasetId: String?) = validationDatasetId(JsonField.ofNullable(validationDatasetId)) - /** The validation dataset id. */ + /** + * Alias for calling [Builder.validationDatasetId] with + * `validationDatasetId.orElse(null)`. + */ fun validationDatasetId(validationDatasetId: Optional) = validationDatasetId(validationDatasetId.getOrNull()) - /** The validation dataset id. */ + /** + * Sets [Builder.validationDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.validationDatasetId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun validationDatasetId(validationDatasetId: JsonField) = apply { this.validationDatasetId = validationDatasetId } @@ -796,7 +1221,13 @@ private constructor( /** The commit creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The commit creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -804,7 +1235,13 @@ private constructor( /** The ref of the corresponding git commit. */ fun gitCommitRef(gitCommitRef: String) = gitCommitRef(JsonField.of(gitCommitRef)) - /** The ref of the corresponding git commit. */ + /** + * Sets [Builder.gitCommitRef] to an arbitrary JSON value. + * + * You should usually call [Builder.gitCommitRef] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitCommitRef(gitCommitRef: JsonField) = apply { this.gitCommitRef = gitCommitRef } @@ -812,7 +1249,13 @@ private constructor( /** The SHA of the corresponding git commit. */ fun gitCommitSha(gitCommitSha: Long) = gitCommitSha(JsonField.of(gitCommitSha)) - /** The SHA of the corresponding git commit. */ + /** + * Sets [Builder.gitCommitSha] to an arbitrary JSON value. + * + * You should usually call [Builder.gitCommitSha] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitCommitSha(gitCommitSha: JsonField) = apply { this.gitCommitSha = gitCommitSha } @@ -820,7 +1263,13 @@ private constructor( /** The URL of the corresponding git commit. */ fun gitCommitUrl(gitCommitUrl: String) = gitCommitUrl(JsonField.of(gitCommitUrl)) - /** The URL of the corresponding git commit. */ + /** + * Sets [Builder.gitCommitUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.gitCommitUrl] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitCommitUrl(gitCommitUrl: JsonField) = apply { this.gitCommitUrl = gitCommitUrl } @@ -1017,8 +1466,17 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun app(): String = app.getRequired("app") + /** + * Returns the raw JSON value of [app]. + * + * Unlike [app], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @@ -1065,6 +1523,13 @@ private constructor( fun app(app: String) = app(JsonField.of(app)) + /** + * Sets [Builder.app] to an arbitrary JSON value. + * + * You should usually call [Builder.app] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt index 0c2fd117..fde2ba6e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt @@ -89,19 +89,27 @@ private constructor( /** The page to return in a paginated query. */ fun page(page: Long?) = apply { this.page = page } - /** The page to return in a paginated query. */ + /** + * Alias for [Builder.page]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun page(page: Long) = page(page as Long?) - /** The page to return in a paginated query. */ + /** Alias for calling [Builder.page] with `page.orElse(null)`. */ fun page(page: Optional) = page(page.getOrNull()) /** Maximum number of items to return per page. */ fun perPage(perPage: Long?) = apply { this.perPage = perPage } - /** Maximum number of items to return per page. */ + /** + * Alias for [Builder.perPage]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun perPage(perPage: Long) = perPage(perPage as Long?) - /** Maximum number of items to return per page. */ + /** Alias for calling [Builder.perPage] with `perPage.orElse(null)`. */ fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt index 9b440605..2a571c5f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt @@ -32,8 +32,17 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun items(): List = items.getRequired("items") + /** + * Returns the raw JSON value of [items]. + * + * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items @JsonAnyGetter @@ -80,10 +89,22 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) + /** + * Sets [Builder.items] to an arbitrary JSON value. + * + * You should usually call [Builder.items] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun items(items: JsonField>) = apply { this.items = items.map { it.toMutableList() } } + /** + * Adds a single [Item] to [items]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addItem(item: Item) = apply { items = (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } @@ -172,135 +193,291 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The project version (commit) id. */ + /** + * The project version (commit) id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The details of a commit (project version). */ + /** + * The details of a commit (project version). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun commit(): Commit = commit.getRequired("commit") - /** The commit archive date. */ + /** + * The commit archive date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun dateArchived(): Optional = Optional.ofNullable(dateArchived.getNullable("dateArchived")) - /** The project version (commit) creation date. */ + /** + * The project version (commit) creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The number of tests that are failing for the commit. */ + /** + * The number of tests that are failing for the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") - /** The model id. */ + /** + * The model id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) - /** The number of tests that are passing for the commit. */ + /** + * The number of tests that are passing for the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("projectId") /** * The commit status. Initially, the commit is `queued`, then, it switches to `running`. * Finally, it can be `paused`, `failed`, or `completed`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun status(): Status = status.getRequired("status") - /** The commit status message. */ + /** + * The commit status message. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) - /** The storage URI where the commit bundle is stored. */ + /** + * The storage URI where the commit bundle is stored. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun storageUri(): String = storageUri.getRequired("storageUri") - /** The total number of tests for the commit. */ + /** + * The total number of tests for the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") - /** The training dataset id. */ + /** + * The training dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun trainingDatasetId(): Optional = Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) - /** The validation dataset id. */ + /** + * The validation dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun validationDatasetId(): Optional = Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) - /** Whether the commit is archived. */ + /** + * Whether the commit is archived. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) - /** The deployment status associated with the commit's model. */ + /** + * The deployment status associated with the commit's model. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun deploymentStatus(): Optional = Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun links(): Optional = Optional.ofNullable(links.getNullable("links")) - /** The project version (commit) id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The details of a commit (project version). */ + /** + * Returns the raw JSON value of [commit]. + * + * Unlike [commit], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("commit") @ExcludeMissing fun _commit(): JsonField = commit - /** The commit archive date. */ + /** + * Returns the raw JSON value of [dateArchived]. + * + * Unlike [dateArchived], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived(): JsonField = dateArchived - /** The project version (commit) creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The number of tests that are failing for the commit. */ + /** + * Returns the raw JSON value of [failingGoalCount]. + * + * Unlike [failingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount(): JsonField = failingGoalCount - /** The model id. */ + /** + * Returns the raw JSON value of [mlModelId]. + * + * Unlike [mlModelId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId(): JsonField = mlModelId - /** The number of tests that are passing for the commit. */ + /** + * Returns the raw JSON value of [passingGoalCount]. + * + * Unlike [passingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount(): JsonField = passingGoalCount - /** The project id. */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The commit status message. */ + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage(): JsonField = statusMessage - /** The storage URI where the commit bundle is stored. */ + /** + * Returns the raw JSON value of [storageUri]. + * + * Unlike [storageUri], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("storageUri") @ExcludeMissing fun _storageUri(): JsonField = storageUri - /** The total number of tests for the commit. */ + /** + * Returns the raw JSON value of [totalGoalCount]. + * + * Unlike [totalGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount(): JsonField = totalGoalCount - /** The training dataset id. */ + /** + * Returns the raw JSON value of [trainingDatasetId]. + * + * Unlike [trainingDatasetId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("trainingDatasetId") @ExcludeMissing fun _trainingDatasetId(): JsonField = trainingDatasetId - /** The validation dataset id. */ + /** + * Returns the raw JSON value of [validationDatasetId]. + * + * Unlike [validationDatasetId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("validationDatasetId") @ExcludeMissing fun _validationDatasetId(): JsonField = validationDatasetId - /** Whether the commit is archived. */ + /** + * Returns the raw JSON value of [archived]. + * + * Unlike [archived], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived - /** The deployment status associated with the commit's model. */ + /** + * Returns the raw JSON value of [deploymentStatus]. + * + * Unlike [deploymentStatus], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("deploymentStatus") @ExcludeMissing fun _deploymentStatus(): JsonField = deploymentStatus + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links @JsonAnyGetter @@ -409,24 +586,42 @@ private constructor( /** The project version (commit) id. */ fun id(id: String) = id(JsonField.of(id)) - /** The project version (commit) id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The details of a commit (project version). */ fun commit(commit: Commit) = commit(JsonField.of(commit)) - /** The details of a commit (project version). */ + /** + * Sets [Builder.commit] to an arbitrary JSON value. + * + * You should usually call [Builder.commit] with a well-typed [Commit] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun commit(commit: JsonField) = apply { this.commit = commit } /** The commit archive date. */ fun dateArchived(dateArchived: OffsetDateTime?) = dateArchived(JsonField.ofNullable(dateArchived)) - /** The commit archive date. */ + /** Alias for calling [Builder.dateArchived] with `dateArchived.orElse(null)`. */ fun dateArchived(dateArchived: Optional) = dateArchived(dateArchived.getOrNull()) - /** The commit archive date. */ + /** + * Sets [Builder.dateArchived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateArchived] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateArchived(dateArchived: JsonField) = apply { this.dateArchived = dateArchived } @@ -434,7 +629,13 @@ private constructor( /** The project version (commit) creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The project version (commit) creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -443,7 +644,13 @@ private constructor( fun failingGoalCount(failingGoalCount: Long) = failingGoalCount(JsonField.of(failingGoalCount)) - /** The number of tests that are failing for the commit. */ + /** + * Sets [Builder.failingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun failingGoalCount(failingGoalCount: JsonField) = apply { this.failingGoalCount = failingGoalCount } @@ -451,17 +658,29 @@ private constructor( /** The model id. */ fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) - /** The model id. */ + /** Alias for calling [Builder.mlModelId] with `mlModelId.orElse(null)`. */ fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) - /** The model id. */ + /** + * Sets [Builder.mlModelId] to an arbitrary JSON value. + * + * You should usually call [Builder.mlModelId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } /** The number of tests that are passing for the commit. */ fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) - /** The number of tests that are passing for the commit. */ + /** + * Sets [Builder.passingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun passingGoalCount(passingGoalCount: JsonField) = apply { this.passingGoalCount = passingGoalCount } @@ -469,7 +688,13 @@ private constructor( /** The project id. */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** The project id. */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** @@ -479,8 +704,11 @@ private constructor( fun status(status: Status) = status(JsonField.of(status)) /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun status(status: JsonField) = apply { this.status = status } @@ -488,11 +716,17 @@ private constructor( fun statusMessage(statusMessage: String?) = statusMessage(JsonField.ofNullable(statusMessage)) - /** The commit status message. */ + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ fun statusMessage(statusMessage: Optional) = statusMessage(statusMessage.getOrNull()) - /** The commit status message. */ + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } @@ -500,13 +734,25 @@ private constructor( /** The storage URI where the commit bundle is stored. */ fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) - /** The storage URI where the commit bundle is stored. */ + /** + * Sets [Builder.storageUri] to an arbitrary JSON value. + * + * You should usually call [Builder.storageUri] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } /** The total number of tests for the commit. */ fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - /** The total number of tests for the commit. */ + /** + * Sets [Builder.totalGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun totalGoalCount(totalGoalCount: JsonField) = apply { this.totalGoalCount = totalGoalCount } @@ -515,11 +761,19 @@ private constructor( fun trainingDatasetId(trainingDatasetId: String?) = trainingDatasetId(JsonField.ofNullable(trainingDatasetId)) - /** The training dataset id. */ + /** + * Alias for calling [Builder.trainingDatasetId] with `trainingDatasetId.orElse(null)`. + */ fun trainingDatasetId(trainingDatasetId: Optional) = trainingDatasetId(trainingDatasetId.getOrNull()) - /** The training dataset id. */ + /** + * Sets [Builder.trainingDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.trainingDatasetId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun trainingDatasetId(trainingDatasetId: JsonField) = apply { this.trainingDatasetId = trainingDatasetId } @@ -528,11 +782,20 @@ private constructor( fun validationDatasetId(validationDatasetId: String?) = validationDatasetId(JsonField.ofNullable(validationDatasetId)) - /** The validation dataset id. */ + /** + * Alias for calling [Builder.validationDatasetId] with + * `validationDatasetId.orElse(null)`. + */ fun validationDatasetId(validationDatasetId: Optional) = validationDatasetId(validationDatasetId.getOrNull()) - /** The validation dataset id. */ + /** + * Sets [Builder.validationDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.validationDatasetId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun validationDatasetId(validationDatasetId: JsonField) = apply { this.validationDatasetId = validationDatasetId } @@ -540,26 +803,49 @@ private constructor( /** Whether the commit is archived. */ fun archived(archived: Boolean?) = archived(JsonField.ofNullable(archived)) - /** Whether the commit is archived. */ + /** + * Alias for [Builder.archived]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun archived(archived: Boolean) = archived(archived as Boolean?) - /** Whether the commit is archived. */ + /** Alias for calling [Builder.archived] with `archived.orElse(null)`. */ fun archived(archived: Optional) = archived(archived.getOrNull()) - /** Whether the commit is archived. */ + /** + * Sets [Builder.archived] to an arbitrary JSON value. + * + * You should usually call [Builder.archived] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun archived(archived: JsonField) = apply { this.archived = archived } /** The deployment status associated with the commit's model. */ fun deploymentStatus(deploymentStatus: String) = deploymentStatus(JsonField.of(deploymentStatus)) - /** The deployment status associated with the commit's model. */ + /** + * Sets [Builder.deploymentStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.deploymentStatus] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun deploymentStatus(deploymentStatus: JsonField) = apply { this.deploymentStatus = deploymentStatus } fun links(links: Links) = links(JsonField.of(links)) + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun links(links: JsonField) = apply { this.links = links } fun additionalProperties(additionalProperties: Map) = apply { @@ -649,97 +935,219 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The commit id. */ + /** + * The commit id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun id(): String = id.getRequired("id") - /** The author id of the commit. */ + /** + * The author id of the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun authorId(): String = authorId.getRequired("authorId") - /** The size of the commit bundle in bytes. */ + /** + * The size of the commit bundle in bytes. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun fileSize(): Optional = Optional.ofNullable(fileSize.getNullable("fileSize")) - /** The commit message. */ + /** + * The commit message. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun message(): String = message.getRequired("message") - /** The model id. */ + /** + * The model id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) - /** The storage URI where the commit bundle is stored. */ + /** + * The storage URI where the commit bundle is stored. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun storageUri(): String = storageUri.getRequired("storageUri") - /** The training dataset id. */ + /** + * The training dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun trainingDatasetId(): Optional = Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) - /** The validation dataset id. */ + /** + * The validation dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun validationDatasetId(): Optional = Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) - /** The commit creation date. */ + /** + * The commit creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun dateCreated(): Optional = Optional.ofNullable(dateCreated.getNullable("dateCreated")) - /** The ref of the corresponding git commit. */ + /** + * The ref of the corresponding git commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun gitCommitRef(): Optional = Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) - /** The SHA of the corresponding git commit. */ + /** + * The SHA of the corresponding git commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun gitCommitSha(): Optional = Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) - /** The URL of the corresponding git commit. */ + /** + * The URL of the corresponding git commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun gitCommitUrl(): Optional = Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) - /** The commit id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The author id of the commit. */ + /** + * Returns the raw JSON value of [authorId]. + * + * Unlike [authorId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("authorId") @ExcludeMissing fun _authorId(): JsonField = authorId - /** The size of the commit bundle in bytes. */ + /** + * Returns the raw JSON value of [fileSize]. + * + * Unlike [fileSize], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("fileSize") @ExcludeMissing fun _fileSize(): JsonField = fileSize - /** The commit message. */ + /** + * Returns the raw JSON value of [message]. + * + * Unlike [message], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("message") @ExcludeMissing fun _message(): JsonField = message - /** The model id. */ + /** + * Returns the raw JSON value of [mlModelId]. + * + * Unlike [mlModelId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId(): JsonField = mlModelId - /** The storage URI where the commit bundle is stored. */ + /** + * Returns the raw JSON value of [storageUri]. + * + * Unlike [storageUri], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("storageUri") @ExcludeMissing fun _storageUri(): JsonField = storageUri - /** The training dataset id. */ + /** + * Returns the raw JSON value of [trainingDatasetId]. + * + * Unlike [trainingDatasetId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("trainingDatasetId") @ExcludeMissing fun _trainingDatasetId(): JsonField = trainingDatasetId - /** The validation dataset id. */ + /** + * Returns the raw JSON value of [validationDatasetId]. + * + * Unlike [validationDatasetId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("validationDatasetId") @ExcludeMissing fun _validationDatasetId(): JsonField = validationDatasetId - /** The commit creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The ref of the corresponding git commit. */ + /** + * Returns the raw JSON value of [gitCommitRef]. + * + * Unlike [gitCommitRef], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitCommitRef") @ExcludeMissing fun _gitCommitRef(): JsonField = gitCommitRef - /** The SHA of the corresponding git commit. */ + /** + * Returns the raw JSON value of [gitCommitSha]. + * + * Unlike [gitCommitSha], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitCommitSha") @ExcludeMissing fun _gitCommitSha(): JsonField = gitCommitSha - /** The URL of the corresponding git commit. */ + /** + * Returns the raw JSON value of [gitCommitUrl]. + * + * Unlike [gitCommitUrl], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitCommitUrl") @ExcludeMissing fun _gitCommitUrl(): JsonField = gitCommitUrl @@ -829,46 +1237,86 @@ private constructor( /** The commit id. */ fun id(id: String) = id(JsonField.of(id)) - /** The commit id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** The author id of the commit. */ fun authorId(authorId: String) = authorId(JsonField.of(authorId)) - /** The author id of the commit. */ + /** + * Sets [Builder.authorId] to an arbitrary JSON value. + * + * You should usually call [Builder.authorId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun authorId(authorId: JsonField) = apply { this.authorId = authorId } /** The size of the commit bundle in bytes. */ fun fileSize(fileSize: Long?) = fileSize(JsonField.ofNullable(fileSize)) - /** The size of the commit bundle in bytes. */ + /** + * Alias for [Builder.fileSize]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun fileSize(fileSize: Long) = fileSize(fileSize as Long?) - /** The size of the commit bundle in bytes. */ + /** Alias for calling [Builder.fileSize] with `fileSize.orElse(null)`. */ fun fileSize(fileSize: Optional) = fileSize(fileSize.getOrNull()) - /** The size of the commit bundle in bytes. */ + /** + * Sets [Builder.fileSize] to an arbitrary JSON value. + * + * You should usually call [Builder.fileSize] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun fileSize(fileSize: JsonField) = apply { this.fileSize = fileSize } /** The commit message. */ fun message(message: String) = message(JsonField.of(message)) - /** The commit message. */ + /** + * Sets [Builder.message] to an arbitrary JSON value. + * + * You should usually call [Builder.message] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun message(message: JsonField) = apply { this.message = message } /** The model id. */ fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) - /** The model id. */ + /** Alias for calling [Builder.mlModelId] with `mlModelId.orElse(null)`. */ fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) - /** The model id. */ + /** + * Sets [Builder.mlModelId] to an arbitrary JSON value. + * + * You should usually call [Builder.mlModelId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } /** The storage URI where the commit bundle is stored. */ fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) - /** The storage URI where the commit bundle is stored. */ + /** + * Sets [Builder.storageUri] to an arbitrary JSON value. + * + * You should usually call [Builder.storageUri] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } @@ -877,11 +1325,20 @@ private constructor( fun trainingDatasetId(trainingDatasetId: String?) = trainingDatasetId(JsonField.ofNullable(trainingDatasetId)) - /** The training dataset id. */ + /** + * Alias for calling [Builder.trainingDatasetId] with + * `trainingDatasetId.orElse(null)`. + */ fun trainingDatasetId(trainingDatasetId: Optional) = trainingDatasetId(trainingDatasetId.getOrNull()) - /** The training dataset id. */ + /** + * Sets [Builder.trainingDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.trainingDatasetId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun trainingDatasetId(trainingDatasetId: JsonField) = apply { this.trainingDatasetId = trainingDatasetId } @@ -890,11 +1347,20 @@ private constructor( fun validationDatasetId(validationDatasetId: String?) = validationDatasetId(JsonField.ofNullable(validationDatasetId)) - /** The validation dataset id. */ + /** + * Alias for calling [Builder.validationDatasetId] with + * `validationDatasetId.orElse(null)`. + */ fun validationDatasetId(validationDatasetId: Optional) = validationDatasetId(validationDatasetId.getOrNull()) - /** The validation dataset id. */ + /** + * Sets [Builder.validationDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.validationDatasetId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun validationDatasetId(validationDatasetId: JsonField) = apply { this.validationDatasetId = validationDatasetId } @@ -903,7 +1369,13 @@ private constructor( fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The commit creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -911,7 +1383,13 @@ private constructor( /** The ref of the corresponding git commit. */ fun gitCommitRef(gitCommitRef: String) = gitCommitRef(JsonField.of(gitCommitRef)) - /** The ref of the corresponding git commit. */ + /** + * Sets [Builder.gitCommitRef] to an arbitrary JSON value. + * + * You should usually call [Builder.gitCommitRef] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun gitCommitRef(gitCommitRef: JsonField) = apply { this.gitCommitRef = gitCommitRef } @@ -919,7 +1397,13 @@ private constructor( /** The SHA of the corresponding git commit. */ fun gitCommitSha(gitCommitSha: Long) = gitCommitSha(JsonField.of(gitCommitSha)) - /** The SHA of the corresponding git commit. */ + /** + * Sets [Builder.gitCommitSha] to an arbitrary JSON value. + * + * You should usually call [Builder.gitCommitSha] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun gitCommitSha(gitCommitSha: JsonField) = apply { this.gitCommitSha = gitCommitSha } @@ -927,7 +1411,13 @@ private constructor( /** The URL of the corresponding git commit. */ fun gitCommitUrl(gitCommitUrl: String) = gitCommitUrl(JsonField.of(gitCommitUrl)) - /** The URL of the corresponding git commit. */ + /** + * Sets [Builder.gitCommitUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.gitCommitUrl] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun gitCommitUrl(gitCommitUrl: JsonField) = apply { this.gitCommitUrl = gitCommitUrl } @@ -1131,8 +1621,18 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun app(): String = app.getRequired("app") + /** + * Returns the raw JSON value of [app]. + * + * Unlike [app], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @@ -1179,6 +1679,13 @@ private constructor( fun app(app: String) = app(JsonField.of(app)) + /** + * Sets [Builder.app] to an arbitrary JSON value. + * + * You should usually call [Builder.app] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt index 611eb28c..02a82df5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt @@ -37,106 +37,273 @@ private constructor( fun projectId(): String = projectId - /** The inference pipeline id. */ + /** + * The inference pipeline id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = body.id() - /** The creation date. */ + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = body.dateCreated() - /** The last test evaluation date. */ + /** + * The last test evaluation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dateLastEvaluated(): Optional = body.dateLastEvaluated() - /** The last data sample received date. */ + /** + * The last data sample received date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dateLastSampleReceived(): Optional = body.dateLastSampleReceived() - /** The next test evaluation date. */ + /** + * The next test evaluation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dateOfNextEvaluation(): Optional = body.dateOfNextEvaluation() - /** The last updated date. */ + /** + * The last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = body.dateUpdated() - /** The inference pipeline description. */ + /** + * The inference pipeline description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** The number of tests failing. */ + /** + * The number of tests failing. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun failingGoalCount(): Long = body.failingGoalCount() + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun links(): Links = body.links() - /** The inference pipeline name. */ + /** + * The inference pipeline name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** The number of tests passing. */ + /** + * The number of tests passing. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun passingGoalCount(): Long = body.passingGoalCount() - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = body.projectId() - /** The status of test evaluation for the inference pipeline. */ + /** + * The status of test evaluation for the inference pipeline. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun status(): Status = body.status() - /** The status message of test evaluation for the inference pipeline. */ + /** + * The status message of test evaluation for the inference pipeline. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun statusMessage(): Optional = body.statusMessage() - /** The total number of tests. */ + /** + * The total number of tests. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun totalGoalCount(): Long = body.totalGoalCount() + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun project(): Optional = body.project() + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun workspace(): Optional = body.workspace() - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun workspaceId(): Optional = body.workspaceId() - /** The inference pipeline id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ fun _id(): JsonField = body._id() - /** The creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ fun _dateCreated(): JsonField = body._dateCreated() - /** The last test evaluation date. */ + /** + * Returns the raw JSON value of [dateLastEvaluated]. + * + * Unlike [dateLastEvaluated], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _dateLastEvaluated(): JsonField = body._dateLastEvaluated() - /** The last data sample received date. */ + /** + * Returns the raw JSON value of [dateLastSampleReceived]. + * + * Unlike [dateLastSampleReceived], this method doesn't throw if the JSON field has an + * unexpected type. + */ fun _dateLastSampleReceived(): JsonField = body._dateLastSampleReceived() - /** The next test evaluation date. */ + /** + * Returns the raw JSON value of [dateOfNextEvaluation]. + * + * Unlike [dateOfNextEvaluation], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _dateOfNextEvaluation(): JsonField = body._dateOfNextEvaluation() - /** The last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ fun _dateUpdated(): JsonField = body._dateUpdated() - /** The inference pipeline description. */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() - /** The number of tests failing. */ + /** + * Returns the raw JSON value of [failingGoalCount]. + * + * Unlike [failingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _failingGoalCount(): JsonField = body._failingGoalCount() + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ fun _links(): JsonField = body._links() - /** The inference pipeline name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** The number of tests passing. */ + /** + * Returns the raw JSON value of [passingGoalCount]. + * + * Unlike [passingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _passingGoalCount(): JsonField = body._passingGoalCount() - /** The project id. */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _projectId(): JsonField = body._projectId() - /** The status of test evaluation for the inference pipeline. */ + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ fun _status(): JsonField = body._status() - /** The status message of test evaluation for the inference pipeline. */ + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected type. + */ fun _statusMessage(): JsonField = body._statusMessage() - /** The total number of tests. */ + /** + * Returns the raw JSON value of [totalGoalCount]. + * + * Unlike [totalGoalCount], this method doesn't throw if the JSON field has an unexpected type. + */ fun _totalGoalCount(): JsonField = body._totalGoalCount() + /** + * Returns the raw JSON value of [project]. + * + * Unlike [project], this method doesn't throw if the JSON field has an unexpected type. + */ fun _project(): JsonField = body._project() + /** + * Returns the raw JSON value of [workspace]. + * + * Unlike [workspace], this method doesn't throw if the JSON field has an unexpected type. + */ fun _workspace(): JsonField = body._workspace() - /** The workspace id. */ + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _workspaceId(): JsonField = body._workspaceId() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -218,135 +385,304 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The inference pipeline id. */ + /** + * The inference pipeline id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The creation date. */ + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The last test evaluation date. */ + /** + * The last test evaluation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun dateLastEvaluated(): Optional = Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) - /** The last data sample received date. */ + /** + * The last data sample received date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun dateLastSampleReceived(): Optional = Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) - /** The next test evaluation date. */ + /** + * The next test evaluation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun dateOfNextEvaluation(): Optional = Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) - /** The last updated date. */ + /** + * The last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The inference pipeline description. */ + /** + * The inference pipeline description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** The number of tests failing. */ + /** + * The number of tests failing. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun links(): Links = links.getRequired("links") - /** The inference pipeline name. */ + /** + * The inference pipeline name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The number of tests passing. */ + /** + * The number of tests passing. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("projectId") - /** The status of test evaluation for the inference pipeline. */ + /** + * The status of test evaluation for the inference pipeline. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun status(): Status = status.getRequired("status") - /** The status message of test evaluation for the inference pipeline. */ + /** + * The status message of test evaluation for the inference pipeline. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) - /** The total number of tests. */ + /** + * The total number of tests. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun project(): Optional = Optional.ofNullable(project.getNullable("project")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun workspace(): Optional = Optional.ofNullable(workspace.getNullable("workspace")) - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The inference pipeline id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The last test evaluation date. */ + /** + * Returns the raw JSON value of [dateLastEvaluated]. + * + * Unlike [dateLastEvaluated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateLastEvaluated") @ExcludeMissing fun _dateLastEvaluated(): JsonField = dateLastEvaluated - /** The last data sample received date. */ + /** + * Returns the raw JSON value of [dateLastSampleReceived]. + * + * Unlike [dateLastSampleReceived], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("dateLastSampleReceived") @ExcludeMissing fun _dateLastSampleReceived(): JsonField = dateLastSampleReceived - /** The next test evaluation date. */ + /** + * Returns the raw JSON value of [dateOfNextEvaluation]. + * + * Unlike [dateOfNextEvaluation], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("dateOfNextEvaluation") @ExcludeMissing fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation - /** The last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The inference pipeline description. */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** The number of tests failing. */ + /** + * Returns the raw JSON value of [failingGoalCount]. + * + * Unlike [failingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount(): JsonField = failingGoalCount + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links - /** The inference pipeline name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The number of tests passing. */ + /** + * Returns the raw JSON value of [passingGoalCount]. + * + * Unlike [passingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount(): JsonField = passingGoalCount - /** The project id. */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId - /** The status of test evaluation for the inference pipeline. */ + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The status message of test evaluation for the inference pipeline. */ + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage(): JsonField = statusMessage - /** The total number of tests. */ + /** + * Returns the raw JSON value of [totalGoalCount]. + * + * Unlike [totalGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount(): JsonField = totalGoalCount + /** + * Returns the raw JSON value of [project]. + * + * Unlike [project], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project") @ExcludeMissing fun _project(): JsonField = project + /** + * Returns the raw JSON value of [workspace]. + * + * Unlike [workspace], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("workspace") @ExcludeMissing fun _workspace(): JsonField = workspace - /** The workspace id. */ + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId @@ -461,13 +797,25 @@ private constructor( /** The inference pipeline id. */ fun id(id: String) = id(JsonField.of(id)) - /** The inference pipeline id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -476,11 +824,19 @@ private constructor( fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) - /** The last test evaluation date. */ + /** + * Alias for calling [Builder.dateLastEvaluated] with `dateLastEvaluated.orElse(null)`. + */ fun dateLastEvaluated(dateLastEvaluated: Optional) = dateLastEvaluated(dateLastEvaluated.getOrNull()) - /** The last test evaluation date. */ + /** + * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastEvaluated] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { this.dateLastEvaluated = dateLastEvaluated } @@ -489,11 +845,20 @@ private constructor( fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime?) = dateLastSampleReceived(JsonField.ofNullable(dateLastSampleReceived)) - /** The last data sample received date. */ + /** + * Alias for calling [Builder.dateLastSampleReceived] with + * `dateLastSampleReceived.orElse(null)`. + */ fun dateLastSampleReceived(dateLastSampleReceived: Optional) = dateLastSampleReceived(dateLastSampleReceived.getOrNull()) - /** The last data sample received date. */ + /** + * Sets [Builder.dateLastSampleReceived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastSampleReceived] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { this.dateLastSampleReceived = dateLastSampleReceived } @@ -502,11 +867,20 @@ private constructor( fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) - /** The next test evaluation date. */ + /** + * Alias for calling [Builder.dateOfNextEvaluation] with + * `dateOfNextEvaluation.orElse(null)`. + */ fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) - /** The next test evaluation date. */ + /** + * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfNextEvaluation] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { this.dateOfNextEvaluation = dateOfNextEvaluation } @@ -514,7 +888,13 @@ private constructor( /** The last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -522,10 +902,16 @@ private constructor( /** The inference pipeline description. */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** The inference pipeline description. */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** The inference pipeline description. */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -534,26 +920,51 @@ private constructor( fun failingGoalCount(failingGoalCount: Long) = failingGoalCount(JsonField.of(failingGoalCount)) - /** The number of tests failing. */ + /** + * Sets [Builder.failingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun failingGoalCount(failingGoalCount: JsonField) = apply { this.failingGoalCount = failingGoalCount } fun links(links: Links) = links(JsonField.of(links)) + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun links(links: JsonField) = apply { this.links = links } /** The inference pipeline name. */ fun name(name: String) = name(JsonField.of(name)) - /** The inference pipeline name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The number of tests passing. */ fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) - /** The number of tests passing. */ + /** + * Sets [Builder.passingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun passingGoalCount(passingGoalCount: JsonField) = apply { this.passingGoalCount = passingGoalCount } @@ -561,24 +972,42 @@ private constructor( /** The project id. */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** The project id. */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** The status of test evaluation for the inference pipeline. */ fun status(status: Status) = status(JsonField.of(status)) - /** The status of test evaluation for the inference pipeline. */ + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun status(status: JsonField) = apply { this.status = status } /** The status message of test evaluation for the inference pipeline. */ fun statusMessage(statusMessage: String?) = statusMessage(JsonField.ofNullable(statusMessage)) - /** The status message of test evaluation for the inference pipeline. */ + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ fun statusMessage(statusMessage: Optional) = statusMessage(statusMessage.getOrNull()) - /** The status message of test evaluation for the inference pipeline. */ + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } @@ -586,27 +1015,55 @@ private constructor( /** The total number of tests. */ fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - /** The total number of tests. */ + /** + * Sets [Builder.totalGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun totalGoalCount(totalGoalCount: JsonField) = apply { this.totalGoalCount = totalGoalCount } fun project(project: Project?) = project(JsonField.ofNullable(project)) + /** Alias for calling [Builder.project] with `project.orElse(null)`. */ fun project(project: Optional) = project(project.getOrNull()) + /** + * Sets [Builder.project] to an arbitrary JSON value. + * + * You should usually call [Builder.project] with a well-typed [Project] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun project(project: JsonField) = apply { this.project = project } fun workspace(workspace: Workspace?) = workspace(JsonField.ofNullable(workspace)) + /** Alias for calling [Builder.workspace] with `workspace.orElse(null)`. */ fun workspace(workspace: Optional) = workspace(workspace.getOrNull()) + /** + * Sets [Builder.workspace] to an arbitrary JSON value. + * + * You should usually call [Builder.workspace] with a well-typed [Workspace] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun workspace(workspace: JsonField) = apply { this.workspace = workspace } /** The workspace id. */ fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) - /** The workspace id. */ + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } @@ -725,13 +1182,24 @@ private constructor( /** The inference pipeline id. */ fun id(id: String) = apply { body.id(id) } - /** The inference pipeline id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { body.id(id) } /** The creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = apply { body.dateCreated(dateCreated) } - /** The creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { body.dateCreated(dateCreated) } @@ -741,11 +1209,17 @@ private constructor( body.dateLastEvaluated(dateLastEvaluated) } - /** The last test evaluation date. */ + /** Alias for calling [Builder.dateLastEvaluated] with `dateLastEvaluated.orElse(null)`. */ fun dateLastEvaluated(dateLastEvaluated: Optional) = dateLastEvaluated(dateLastEvaluated.getOrNull()) - /** The last test evaluation date. */ + /** + * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastEvaluated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { body.dateLastEvaluated(dateLastEvaluated) } @@ -755,11 +1229,20 @@ private constructor( body.dateLastSampleReceived(dateLastSampleReceived) } - /** The last data sample received date. */ + /** + * Alias for calling [Builder.dateLastSampleReceived] with + * `dateLastSampleReceived.orElse(null)`. + */ fun dateLastSampleReceived(dateLastSampleReceived: Optional) = dateLastSampleReceived(dateLastSampleReceived.getOrNull()) - /** The last data sample received date. */ + /** + * Sets [Builder.dateLastSampleReceived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastSampleReceived] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { body.dateLastSampleReceived(dateLastSampleReceived) } @@ -769,11 +1252,20 @@ private constructor( body.dateOfNextEvaluation(dateOfNextEvaluation) } - /** The next test evaluation date. */ + /** + * Alias for calling [Builder.dateOfNextEvaluation] with + * `dateOfNextEvaluation.orElse(null)`. + */ fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) - /** The next test evaluation date. */ + /** + * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfNextEvaluation] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { body.dateOfNextEvaluation(dateOfNextEvaluation) } @@ -781,7 +1273,13 @@ private constructor( /** The last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = apply { body.dateUpdated(dateUpdated) } - /** The last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { body.dateUpdated(dateUpdated) } @@ -789,10 +1287,16 @@ private constructor( /** The inference pipeline description. */ fun description(description: String?) = apply { body.description(description) } - /** The inference pipeline description. */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** The inference pipeline description. */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } /** The number of tests failing. */ @@ -800,19 +1304,36 @@ private constructor( body.failingGoalCount(failingGoalCount) } - /** The number of tests failing. */ + /** + * Sets [Builder.failingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun failingGoalCount(failingGoalCount: JsonField) = apply { body.failingGoalCount(failingGoalCount) } fun links(links: Links) = apply { body.links(links) } + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun links(links: JsonField) = apply { body.links(links) } /** The inference pipeline name. */ fun name(name: String) = apply { body.name(name) } - /** The inference pipeline name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** The number of tests passing. */ @@ -820,7 +1341,13 @@ private constructor( body.passingGoalCount(passingGoalCount) } - /** The number of tests passing. */ + /** + * Sets [Builder.passingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun passingGoalCount(passingGoalCount: JsonField) = apply { body.passingGoalCount(passingGoalCount) } @@ -828,23 +1355,40 @@ private constructor( /** The project id. */ fun projectId(projectId: String) = apply { body.projectId(projectId) } - /** The project id. */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } /** The status of test evaluation for the inference pipeline. */ fun status(status: Status) = apply { body.status(status) } - /** The status of test evaluation for the inference pipeline. */ + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun status(status: JsonField) = apply { body.status(status) } /** The status message of test evaluation for the inference pipeline. */ fun statusMessage(statusMessage: String?) = apply { body.statusMessage(statusMessage) } - /** The status message of test evaluation for the inference pipeline. */ + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ fun statusMessage(statusMessage: Optional) = statusMessage(statusMessage.getOrNull()) - /** The status message of test evaluation for the inference pipeline. */ + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun statusMessage(statusMessage: JsonField) = apply { body.statusMessage(statusMessage) } @@ -852,27 +1396,54 @@ private constructor( /** The total number of tests. */ fun totalGoalCount(totalGoalCount: Long) = apply { body.totalGoalCount(totalGoalCount) } - /** The total number of tests. */ + /** + * Sets [Builder.totalGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun totalGoalCount(totalGoalCount: JsonField) = apply { body.totalGoalCount(totalGoalCount) } fun project(project: Project?) = apply { body.project(project) } + /** Alias for calling [Builder.project] with `project.orElse(null)`. */ fun project(project: Optional) = project(project.getOrNull()) + /** + * Sets [Builder.project] to an arbitrary JSON value. + * + * You should usually call [Builder.project] with a well-typed [Project] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun project(project: JsonField) = apply { body.project(project) } fun workspace(workspace: Workspace?) = apply { body.workspace(workspace) } + /** Alias for calling [Builder.workspace] with `workspace.orElse(null)`. */ fun workspace(workspace: Optional) = workspace(workspace.getOrNull()) + /** + * Sets [Builder.workspace] to an arbitrary JSON value. + * + * You should usually call [Builder.workspace] with a well-typed [Workspace] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun workspace(workspace: JsonField) = apply { body.workspace(workspace) } /** The workspace id. */ fun workspaceId(workspaceId: String) = apply { body.workspaceId(workspaceId) } - /** The workspace id. */ + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun workspaceId(workspaceId: JsonField) = apply { body.workspaceId(workspaceId) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { @@ -1010,8 +1581,17 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun app(): String = app.getRequired("app") + /** + * Returns the raw JSON value of [app]. + * + * Unlike [app], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @@ -1058,6 +1638,13 @@ private constructor( fun app(app: String) = app(JsonField.of(app)) + /** + * Sets [Builder.app] to an arbitrary JSON value. + * + * You should usually call [Builder.app] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { @@ -1279,117 +1866,265 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The project creator id. */ + /** + * The project creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The project creation date. */ + /** + * The project creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The project last updated date. */ + /** + * The project last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The number of tests in the development mode of the project. */ + /** + * The number of tests in the development mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") - /** The total number of tests in the project. */ + /** + * The total number of tests in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun goalCount(): Long = goalCount.getRequired("goalCount") - /** The number of inference pipelines in the project. */ + /** + * The number of inference pipelines in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun inferencePipelineCount(): Long = inferencePipelineCount.getRequired("inferencePipelineCount") - /** Links to the project. */ + /** + * Links to the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun links(): Links = links.getRequired("links") - /** The number of tests in the monitoring mode of the project. */ + /** + * The number of tests in the monitoring mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") - /** The project name. */ + /** + * The project name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The source of the project. */ + /** + * The source of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) - /** The task type of the project. */ + /** + * The task type of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun taskType(): TaskType = taskType.getRequired("taskType") - /** The number of versions (commits) in the project. */ + /** + * The number of versions (commits) in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun versionCount(): Long = versionCount.getRequired("versionCount") - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The project description. */ + /** + * The project description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) - /** The project id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The project creator id. */ + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId - /** The project creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The project last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The number of tests in the development mode of the project. */ + /** + * Returns the raw JSON value of [developmentGoalCount]. + * + * Unlike [developmentGoalCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("developmentGoalCount") @ExcludeMissing fun _developmentGoalCount(): JsonField = developmentGoalCount - /** The total number of tests in the project. */ + /** + * Returns the raw JSON value of [goalCount]. + * + * Unlike [goalCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount - /** The number of inference pipelines in the project. */ + /** + * Returns the raw JSON value of [inferencePipelineCount]. + * + * Unlike [inferencePipelineCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("inferencePipelineCount") @ExcludeMissing fun _inferencePipelineCount(): JsonField = inferencePipelineCount - /** Links to the project. */ + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links - /** The number of tests in the monitoring mode of the project. */ + /** + * Returns the raw JSON value of [monitoringGoalCount]. + * + * Unlike [monitoringGoalCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("monitoringGoalCount") @ExcludeMissing fun _monitoringGoalCount(): JsonField = monitoringGoalCount - /** The project name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The source of the project. */ + /** + * Returns the raw JSON value of [source]. + * + * Unlike [source], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source - /** The task type of the project. */ + /** + * Returns the raw JSON value of [taskType]. + * + * Unlike [taskType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("taskType") @ExcludeMissing fun _taskType(): JsonField = taskType - /** The number of versions (commits) in the project. */ + /** + * Returns the raw JSON value of [versionCount]. + * + * Unlike [versionCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("versionCount") @ExcludeMissing fun _versionCount(): JsonField = versionCount - /** The workspace id. */ + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId - /** The project description. */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + /** + * Returns the raw JSON value of [gitRepo]. + * + * Unlike [gitRepo], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo @JsonAnyGetter @@ -1495,22 +2230,40 @@ private constructor( /** The project id. */ fun id(id: String) = id(JsonField.of(id)) - /** The project id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The project creator id. */ fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The project creator id. */ + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) - /** The project creator id. */ + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The project creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -1518,7 +2271,13 @@ private constructor( /** The project last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The project last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -1527,7 +2286,13 @@ private constructor( fun developmentGoalCount(developmentGoalCount: Long) = developmentGoalCount(JsonField.of(developmentGoalCount)) - /** The number of tests in the development mode of the project. */ + /** + * Sets [Builder.developmentGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.developmentGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun developmentGoalCount(developmentGoalCount: JsonField) = apply { this.developmentGoalCount = developmentGoalCount } @@ -1535,14 +2300,26 @@ private constructor( /** The total number of tests in the project. */ fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) - /** The total number of tests in the project. */ + /** + * Sets [Builder.goalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.goalCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } /** The number of inference pipelines in the project. */ fun inferencePipelineCount(inferencePipelineCount: Long) = inferencePipelineCount(JsonField.of(inferencePipelineCount)) - /** The number of inference pipelines in the project. */ + /** + * Sets [Builder.inferencePipelineCount] to an arbitrary JSON value. + * + * You should usually call [Builder.inferencePipelineCount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { this.inferencePipelineCount = inferencePipelineCount } @@ -1550,14 +2327,26 @@ private constructor( /** Links to the project. */ fun links(links: Links) = links(JsonField.of(links)) - /** Links to the project. */ + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun links(links: JsonField) = apply { this.links = links } /** The number of tests in the monitoring mode of the project. */ fun monitoringGoalCount(monitoringGoalCount: Long) = monitoringGoalCount(JsonField.of(monitoringGoalCount)) - /** The number of tests in the monitoring mode of the project. */ + /** + * Sets [Builder.monitoringGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.monitoringGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { this.monitoringGoalCount = monitoringGoalCount } @@ -1565,28 +2354,52 @@ private constructor( /** The project name. */ fun name(name: String) = name(JsonField.of(name)) - /** The project name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The source of the project. */ fun source(source: Source?) = source(JsonField.ofNullable(source)) - /** The source of the project. */ + /** Alias for calling [Builder.source] with `source.orElse(null)`. */ fun source(source: Optional) = source(source.getOrNull()) - /** The source of the project. */ + /** + * Sets [Builder.source] to an arbitrary JSON value. + * + * You should usually call [Builder.source] with a well-typed [Source] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun source(source: JsonField) = apply { this.source = source } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) - /** The task type of the project. */ + /** + * Sets [Builder.taskType] to an arbitrary JSON value. + * + * You should usually call [Builder.taskType] with a well-typed [TaskType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun taskType(taskType: JsonField) = apply { this.taskType = taskType } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) - /** The number of versions (commits) in the project. */ + /** + * Sets [Builder.versionCount] to an arbitrary JSON value. + * + * You should usually call [Builder.versionCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun versionCount(versionCount: JsonField) = apply { this.versionCount = versionCount } @@ -1594,10 +2407,16 @@ private constructor( /** The workspace id. */ fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) - /** The workspace id. */ + /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) - /** The workspace id. */ + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } @@ -1605,18 +2424,32 @@ private constructor( /** The project description. */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** The project description. */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** The project description. */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) + /** Alias for calling [Builder.gitRepo] with `gitRepo.orElse(null)`. */ fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) + /** + * Sets [Builder.gitRepo] to an arbitrary JSON value. + * + * You should usually call [Builder.gitRepo] with a well-typed [GitRepo] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { @@ -1672,8 +2505,18 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun app(): String = app.getRequired("app") + /** + * Returns the raw JSON value of [app]. + * + * Unlike [app], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @@ -1720,6 +2563,13 @@ private constructor( fun app(app: String) = app(JsonField.of(app)) + /** + * Sets [Builder.app] to an arbitrary JSON value. + * + * You should usually call [Builder.app] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { @@ -2034,60 +2884,183 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun id(): String = id.getRequired("id") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun dateConnected(): OffsetDateTime = dateConnected.getRequired("dateConnected") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun gitId(): Long = gitId.getRequired("gitId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun name(): String = name.getRequired("name") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun private_(): Boolean = private_.getRequired("private") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun projectId(): String = projectId.getRequired("projectId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun slug(): String = slug.getRequired("slug") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun url(): String = url.getRequired("url") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [dateConnected]. + * + * Unlike [dateConnected], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected(): JsonField = dateConnected + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated + /** + * Returns the raw JSON value of [gitAccountId]. + * + * Unlike [gitAccountId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId(): JsonField = gitAccountId + /** + * Returns the raw JSON value of [gitId]. + * + * Unlike [gitId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gitId") @ExcludeMissing fun _gitId(): JsonField = gitId + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [private_]. + * + * Unlike [private_], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("private") @ExcludeMissing fun _private_(): JsonField = private_ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url + /** + * Returns the raw JSON value of [branch]. + * + * Unlike [branch], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch + /** + * Returns the raw JSON value of [rootDir]. + * + * Unlike [rootDir], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir @JsonAnyGetter @@ -2176,11 +3149,25 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) + /** + * Sets [Builder.dateConnected] to an arbitrary JSON value. + * + * You should usually call [Builder.dateConnected] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun dateConnected(dateConnected: JsonField) = apply { this.dateConnected = dateConnected } @@ -2188,46 +3175,116 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) + /** + * Sets [Builder.gitAccountId] to an arbitrary JSON value. + * + * You should usually call [Builder.gitAccountId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun gitAccountId(gitAccountId: JsonField) = apply { this.gitAccountId = gitAccountId } fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) + /** + * Sets [Builder.gitId] to an arbitrary JSON value. + * + * You should usually call [Builder.gitId] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitId(gitId: JsonField) = apply { this.gitId = gitId } fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun private_(private_: Boolean) = private_(JsonField.of(private_)) + /** + * Sets [Builder.private_] to an arbitrary JSON value. + * + * You should usually call [Builder.private_] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun private_(private_: JsonField) = apply { this.private_ = private_ } fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } fun slug(slug: String) = slug(JsonField.of(slug)) + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } fun url(url: String) = url(JsonField.of(url)) + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun url(url: JsonField) = apply { this.url = url } fun branch(branch: String) = branch(JsonField.of(branch)) + /** + * Sets [Builder.branch] to an arbitrary JSON value. + * + * You should usually call [Builder.branch] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun branch(branch: JsonField) = apply { this.branch = branch } fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) + /** + * Sets [Builder.rootDir] to an arbitrary JSON value. + * + * You should usually call [Builder.rootDir] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun additionalProperties(additionalProperties: Map) = apply { @@ -2360,120 +3417,270 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The workspace creator id. */ + /** + * The workspace creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The workspace creation date. */ + /** + * The workspace creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The workspace last updated date. */ + /** + * The workspace last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The number of invites in the workspace. */ + /** + * The number of invites in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun inviteCount(): Long = inviteCount.getRequired("inviteCount") - /** The number of members in the workspace. */ + /** + * The number of members in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun memberCount(): Long = memberCount.getRequired("memberCount") - /** The workspace name. */ + /** + * The workspace name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The end date of the current billing period. */ + /** + * The end date of the current billing period. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun periodEndDate(): Optional = Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) - /** The start date of the current billing period. */ + /** + * The start date of the current billing period. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun periodStartDate(): Optional = Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) - /** The number of projects in the workspace. */ + /** + * The number of projects in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectCount(): Long = projectCount.getRequired("projectCount") - /** The workspace slug. */ + /** + * The workspace slug. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun slug(): String = slug.getRequired("slug") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun status(): Status = status.getRequired("status") - /** The workspace invite code. */ + /** + * The workspace invite code. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun inviteCode(): Optional = Optional.ofNullable(inviteCode.getNullable("inviteCode")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun monthlyUsage(): Optional> = Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) - /** Whether the workspace only allows SAML authentication. */ + /** + * Whether the workspace only allows SAML authentication. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun samlOnlyAccess(): Optional = Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun wildcardDomains(): Optional> = Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) - /** The workspace id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The workspace creator id. */ + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId - /** The workspace creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The workspace last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The number of invites in the workspace. */ + /** + * Returns the raw JSON value of [inviteCount]. + * + * Unlike [inviteCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("inviteCount") @ExcludeMissing fun _inviteCount(): JsonField = inviteCount - /** The number of members in the workspace. */ + /** + * Returns the raw JSON value of [memberCount]. + * + * Unlike [memberCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("memberCount") @ExcludeMissing fun _memberCount(): JsonField = memberCount - /** The workspace name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The end date of the current billing period. */ + /** + * Returns the raw JSON value of [periodEndDate]. + * + * Unlike [periodEndDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("periodEndDate") @ExcludeMissing fun _periodEndDate(): JsonField = periodEndDate - /** The start date of the current billing period. */ + /** + * Returns the raw JSON value of [periodStartDate]. + * + * Unlike [periodStartDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("periodStartDate") @ExcludeMissing fun _periodStartDate(): JsonField = periodStartDate - /** The number of projects in the workspace. */ + /** + * Returns the raw JSON value of [projectCount]. + * + * Unlike [projectCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("projectCount") @ExcludeMissing fun _projectCount(): JsonField = projectCount - /** The workspace slug. */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The workspace invite code. */ + /** + * Returns the raw JSON value of [inviteCode]. + * + * Unlike [inviteCode], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("inviteCode") @ExcludeMissing fun _inviteCode(): JsonField = inviteCode + /** + * Returns the raw JSON value of [monthlyUsage]. + * + * Unlike [monthlyUsage], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("monthlyUsage") @ExcludeMissing fun _monthlyUsage(): JsonField> = monthlyUsage - /** Whether the workspace only allows SAML authentication. */ + /** + * Returns the raw JSON value of [samlOnlyAccess]. + * + * Unlike [samlOnlyAccess], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("samlOnlyAccess") @ExcludeMissing fun _samlOnlyAccess(): JsonField = samlOnlyAccess + /** + * Returns the raw JSON value of [wildcardDomains]. + * + * Unlike [wildcardDomains], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("wildcardDomains") @ExcludeMissing fun _wildcardDomains(): JsonField> = wildcardDomains @@ -2579,22 +3786,40 @@ private constructor( /** The workspace id. */ fun id(id: String) = id(JsonField.of(id)) - /** The workspace id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The workspace creator id. */ fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The workspace creator id. */ + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) - /** The workspace creator id. */ + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The workspace creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The workspace creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -2602,7 +3827,13 @@ private constructor( /** The workspace last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The workspace last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -2610,30 +3841,54 @@ private constructor( /** The number of invites in the workspace. */ fun inviteCount(inviteCount: Long) = inviteCount(JsonField.of(inviteCount)) - /** The number of invites in the workspace. */ + /** + * Sets [Builder.inviteCount] to an arbitrary JSON value. + * + * You should usually call [Builder.inviteCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun inviteCount(inviteCount: JsonField) = apply { this.inviteCount = inviteCount } /** The number of members in the workspace. */ fun memberCount(memberCount: Long) = memberCount(JsonField.of(memberCount)) - /** The number of members in the workspace. */ + /** + * Sets [Builder.memberCount] to an arbitrary JSON value. + * + * You should usually call [Builder.memberCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun memberCount(memberCount: JsonField) = apply { this.memberCount = memberCount } /** The workspace name. */ fun name(name: String) = name(JsonField.of(name)) - /** The workspace name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: OffsetDateTime?) = periodEndDate(JsonField.ofNullable(periodEndDate)) - /** The end date of the current billing period. */ + /** Alias for calling [Builder.periodEndDate] with `periodEndDate.orElse(null)`. */ fun periodEndDate(periodEndDate: Optional) = periodEndDate(periodEndDate.getOrNull()) - /** The end date of the current billing period. */ + /** + * Sets [Builder.periodEndDate] to an arbitrary JSON value. + * + * You should usually call [Builder.periodEndDate] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun periodEndDate(periodEndDate: JsonField) = apply { this.periodEndDate = periodEndDate } @@ -2642,11 +3897,17 @@ private constructor( fun periodStartDate(periodStartDate: OffsetDateTime?) = periodStartDate(JsonField.ofNullable(periodStartDate)) - /** The start date of the current billing period. */ + /** Alias for calling [Builder.periodStartDate] with `periodStartDate.orElse(null)`. */ fun periodStartDate(periodStartDate: Optional) = periodStartDate(periodStartDate.getOrNull()) - /** The start date of the current billing period. */ + /** + * Sets [Builder.periodStartDate] to an arbitrary JSON value. + * + * You should usually call [Builder.periodStartDate] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun periodStartDate(periodStartDate: JsonField) = apply { this.periodStartDate = periodStartDate } @@ -2654,7 +3915,13 @@ private constructor( /** The number of projects in the workspace. */ fun projectCount(projectCount: Long) = projectCount(JsonField.of(projectCount)) - /** The number of projects in the workspace. */ + /** + * Sets [Builder.projectCount] to an arbitrary JSON value. + * + * You should usually call [Builder.projectCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectCount(projectCount: JsonField) = apply { this.projectCount = projectCount } @@ -2662,26 +3929,57 @@ private constructor( /** The workspace slug. */ fun slug(slug: String) = slug(JsonField.of(slug)) - /** The workspace slug. */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } fun status(status: Status) = status(JsonField.of(status)) + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun status(status: JsonField) = apply { this.status = status } /** The workspace invite code. */ fun inviteCode(inviteCode: String) = inviteCode(JsonField.of(inviteCode)) - /** The workspace invite code. */ + /** + * Sets [Builder.inviteCode] to an arbitrary JSON value. + * + * You should usually call [Builder.inviteCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun inviteCode(inviteCode: JsonField) = apply { this.inviteCode = inviteCode } fun monthlyUsage(monthlyUsage: List) = monthlyUsage(JsonField.of(monthlyUsage)) + /** + * Sets [Builder.monthlyUsage] to an arbitrary JSON value. + * + * You should usually call [Builder.monthlyUsage] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun monthlyUsage(monthlyUsage: JsonField>) = apply { this.monthlyUsage = monthlyUsage.map { it.toMutableList() } } + /** + * Adds a single [MonthlyUsage] to [Builder.monthlyUsage]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMonthlyUsage(monthlyUsage: MonthlyUsage) = apply { this.monthlyUsage = (this.monthlyUsage ?: JsonField.of(mutableListOf())).also { @@ -2693,7 +3991,13 @@ private constructor( fun samlOnlyAccess(samlOnlyAccess: Boolean) = samlOnlyAccess(JsonField.of(samlOnlyAccess)) - /** Whether the workspace only allows SAML authentication. */ + /** + * Sets [Builder.samlOnlyAccess] to an arbitrary JSON value. + * + * You should usually call [Builder.samlOnlyAccess] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun samlOnlyAccess(samlOnlyAccess: JsonField) = apply { this.samlOnlyAccess = samlOnlyAccess } @@ -2701,10 +4005,22 @@ private constructor( fun wildcardDomains(wildcardDomains: List) = wildcardDomains(JsonField.of(wildcardDomains)) + /** + * Sets [Builder.wildcardDomains] to an arbitrary JSON value. + * + * You should usually call [Builder.wildcardDomains] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun wildcardDomains(wildcardDomains: JsonField>) = apply { this.wildcardDomains = wildcardDomains.map { it.toMutableList() } } + /** + * Adds a single [String] to [wildcardDomains]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addWildcardDomain(wildcardDomain: String) = apply { wildcardDomains = (wildcardDomains ?: JsonField.of(mutableListOf())).also { @@ -2908,23 +4224,53 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun executionTimeMs(): Optional = Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun monthYear(): Optional = Optional.ofNullable(monthYear.getNullable("monthYear")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun predictionCount(): Optional = Optional.ofNullable(predictionCount.getNullable("predictionCount")) + /** + * Returns the raw JSON value of [executionTimeMs]. + * + * Unlike [executionTimeMs], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("executionTimeMs") @ExcludeMissing fun _executionTimeMs(): JsonField = executionTimeMs + /** + * Returns the raw JSON value of [monthYear]. + * + * Unlike [monthYear], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("monthYear") @ExcludeMissing fun _monthYear(): JsonField = monthYear + /** + * Returns the raw JSON value of [predictionCount]. + * + * Unlike [predictionCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("predictionCount") @ExcludeMissing fun _predictionCount(): JsonField = predictionCount @@ -2973,18 +4319,40 @@ private constructor( fun executionTimeMs(executionTimeMs: Long?) = executionTimeMs(JsonField.ofNullable(executionTimeMs)) + /** + * Alias for [Builder.executionTimeMs]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun executionTimeMs(executionTimeMs: Long) = executionTimeMs(executionTimeMs as Long?) + /** + * Alias for calling [Builder.executionTimeMs] with `executionTimeMs.orElse(null)`. + */ fun executionTimeMs(executionTimeMs: Optional) = executionTimeMs(executionTimeMs.getOrNull()) + /** + * Sets [Builder.executionTimeMs] to an arbitrary JSON value. + * + * You should usually call [Builder.executionTimeMs] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun executionTimeMs(executionTimeMs: JsonField) = apply { this.executionTimeMs = executionTimeMs } fun monthYear(monthYear: LocalDate) = monthYear(JsonField.of(monthYear)) + /** + * Sets [Builder.monthYear] to an arbitrary JSON value. + * + * You should usually call [Builder.monthYear] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun monthYear(monthYear: JsonField) = apply { this.monthYear = monthYear } @@ -2992,6 +4360,13 @@ private constructor( fun predictionCount(predictionCount: Long) = predictionCount(JsonField.of(predictionCount)) + /** + * Sets [Builder.predictionCount] to an arbitrary JSON value. + * + * You should usually call [Builder.predictionCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun predictionCount(predictionCount: JsonField) = apply { this.predictionCount = predictionCount } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt index 5200f704..73ceafa1 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt @@ -78,130 +78,297 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The inference pipeline id. */ + /** + * The inference pipeline id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The creation date. */ + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The last test evaluation date. */ + /** + * The last test evaluation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dateLastEvaluated(): Optional = Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) - /** The last data sample received date. */ + /** + * The last data sample received date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dateLastSampleReceived(): Optional = Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) - /** The next test evaluation date. */ + /** + * The next test evaluation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dateOfNextEvaluation(): Optional = Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) - /** The last updated date. */ + /** + * The last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The inference pipeline description. */ + /** + * The inference pipeline description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** The number of tests failing. */ + /** + * The number of tests failing. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun links(): Links = links.getRequired("links") - /** The inference pipeline name. */ + /** + * The inference pipeline name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The number of tests passing. */ + /** + * The number of tests passing. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("projectId") - /** The status of test evaluation for the inference pipeline. */ + /** + * The status of test evaluation for the inference pipeline. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun status(): Status = status.getRequired("status") - /** The status message of test evaluation for the inference pipeline. */ + /** + * The status message of test evaluation for the inference pipeline. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) - /** The total number of tests. */ + /** + * The total number of tests. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun project(): Optional = Optional.ofNullable(project.getNullable("project")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun workspace(): Optional = Optional.ofNullable(workspace.getNullable("workspace")) - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The inference pipeline id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The last test evaluation date. */ + /** + * Returns the raw JSON value of [dateLastEvaluated]. + * + * Unlike [dateLastEvaluated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateLastEvaluated") @ExcludeMissing fun _dateLastEvaluated(): JsonField = dateLastEvaluated - /** The last data sample received date. */ + /** + * Returns the raw JSON value of [dateLastSampleReceived]. + * + * Unlike [dateLastSampleReceived], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("dateLastSampleReceived") @ExcludeMissing fun _dateLastSampleReceived(): JsonField = dateLastSampleReceived - /** The next test evaluation date. */ + /** + * Returns the raw JSON value of [dateOfNextEvaluation]. + * + * Unlike [dateOfNextEvaluation], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateOfNextEvaluation") @ExcludeMissing fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation - /** The last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The inference pipeline description. */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** The number of tests failing. */ + /** + * Returns the raw JSON value of [failingGoalCount]. + * + * Unlike [failingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount(): JsonField = failingGoalCount + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links - /** The inference pipeline name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The number of tests passing. */ + /** + * Returns the raw JSON value of [passingGoalCount]. + * + * Unlike [passingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount(): JsonField = passingGoalCount - /** The project id. */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId - /** The status of test evaluation for the inference pipeline. */ + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The status message of test evaluation for the inference pipeline. */ + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage(): JsonField = statusMessage - /** The total number of tests. */ + /** + * Returns the raw JSON value of [totalGoalCount]. + * + * Unlike [totalGoalCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount(): JsonField = totalGoalCount + /** + * Returns the raw JSON value of [project]. + * + * Unlike [project], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project") @ExcludeMissing fun _project(): JsonField = project + /** + * Returns the raw JSON value of [workspace]. + * + * Unlike [workspace], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("workspace") @ExcludeMissing fun _workspace(): JsonField = workspace - /** The workspace id. */ + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId @JsonAnyGetter @@ -317,13 +484,24 @@ private constructor( /** The inference pipeline id. */ fun id(id: String) = id(JsonField.of(id)) - /** The inference pipeline id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** The creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -332,11 +510,17 @@ private constructor( fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) - /** The last test evaluation date. */ + /** Alias for calling [Builder.dateLastEvaluated] with `dateLastEvaluated.orElse(null)`. */ fun dateLastEvaluated(dateLastEvaluated: Optional) = dateLastEvaluated(dateLastEvaluated.getOrNull()) - /** The last test evaluation date. */ + /** + * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastEvaluated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { this.dateLastEvaluated = dateLastEvaluated } @@ -345,11 +529,20 @@ private constructor( fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime?) = dateLastSampleReceived(JsonField.ofNullable(dateLastSampleReceived)) - /** The last data sample received date. */ + /** + * Alias for calling [Builder.dateLastSampleReceived] with + * `dateLastSampleReceived.orElse(null)`. + */ fun dateLastSampleReceived(dateLastSampleReceived: Optional) = dateLastSampleReceived(dateLastSampleReceived.getOrNull()) - /** The last data sample received date. */ + /** + * Sets [Builder.dateLastSampleReceived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastSampleReceived] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { this.dateLastSampleReceived = dateLastSampleReceived } @@ -358,11 +551,20 @@ private constructor( fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) - /** The next test evaluation date. */ + /** + * Alias for calling [Builder.dateOfNextEvaluation] with + * `dateOfNextEvaluation.orElse(null)`. + */ fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) - /** The next test evaluation date. */ + /** + * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfNextEvaluation] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { this.dateOfNextEvaluation = dateOfNextEvaluation } @@ -370,7 +572,13 @@ private constructor( /** The last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -378,36 +586,65 @@ private constructor( /** The inference pipeline description. */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** The inference pipeline description. */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** The inference pipeline description. */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { this.description = description } /** The number of tests failing. */ fun failingGoalCount(failingGoalCount: Long) = failingGoalCount(JsonField.of(failingGoalCount)) - /** The number of tests failing. */ + /** + * Sets [Builder.failingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun failingGoalCount(failingGoalCount: JsonField) = apply { this.failingGoalCount = failingGoalCount } fun links(links: Links) = links(JsonField.of(links)) + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun links(links: JsonField) = apply { this.links = links } /** The inference pipeline name. */ fun name(name: String) = name(JsonField.of(name)) - /** The inference pipeline name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** The number of tests passing. */ fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) - /** The number of tests passing. */ + /** + * Sets [Builder.passingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun passingGoalCount(passingGoalCount: JsonField) = apply { this.passingGoalCount = passingGoalCount } @@ -415,24 +652,41 @@ private constructor( /** The project id. */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** The project id. */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** The status of test evaluation for the inference pipeline. */ fun status(status: Status) = status(JsonField.of(status)) - /** The status of test evaluation for the inference pipeline. */ + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun status(status: JsonField) = apply { this.status = status } /** The status message of test evaluation for the inference pipeline. */ fun statusMessage(statusMessage: String?) = statusMessage(JsonField.ofNullable(statusMessage)) - /** The status message of test evaluation for the inference pipeline. */ + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ fun statusMessage(statusMessage: Optional) = statusMessage(statusMessage.getOrNull()) - /** The status message of test evaluation for the inference pipeline. */ + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } @@ -440,27 +694,54 @@ private constructor( /** The total number of tests. */ fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - /** The total number of tests. */ + /** + * Sets [Builder.totalGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun totalGoalCount(totalGoalCount: JsonField) = apply { this.totalGoalCount = totalGoalCount } fun project(project: Project?) = project(JsonField.ofNullable(project)) + /** Alias for calling [Builder.project] with `project.orElse(null)`. */ fun project(project: Optional) = project(project.getOrNull()) + /** + * Sets [Builder.project] to an arbitrary JSON value. + * + * You should usually call [Builder.project] with a well-typed [Project] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun project(project: JsonField) = apply { this.project = project } fun workspace(workspace: Workspace?) = workspace(JsonField.ofNullable(workspace)) + /** Alias for calling [Builder.workspace] with `workspace.orElse(null)`. */ fun workspace(workspace: Optional) = workspace(workspace.getOrNull()) + /** + * Sets [Builder.workspace] to an arbitrary JSON value. + * + * You should usually call [Builder.workspace] with a well-typed [Workspace] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun workspace(workspace: JsonField) = apply { this.workspace = workspace } /** The workspace id. */ fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) - /** The workspace id. */ + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } fun additionalProperties(additionalProperties: Map) = apply { @@ -515,8 +796,17 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun app(): String = app.getRequired("app") + /** + * Returns the raw JSON value of [app]. + * + * Unlike [app], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @@ -563,6 +853,13 @@ private constructor( fun app(app: String) = app(JsonField.of(app)) + /** + * Sets [Builder.app] to an arbitrary JSON value. + * + * You should usually call [Builder.app] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { @@ -784,117 +1081,265 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The project creator id. */ + /** + * The project creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The project creation date. */ + /** + * The project creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The project last updated date. */ + /** + * The project last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The number of tests in the development mode of the project. */ + /** + * The number of tests in the development mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") - /** The total number of tests in the project. */ + /** + * The total number of tests in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun goalCount(): Long = goalCount.getRequired("goalCount") - /** The number of inference pipelines in the project. */ + /** + * The number of inference pipelines in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun inferencePipelineCount(): Long = inferencePipelineCount.getRequired("inferencePipelineCount") - /** Links to the project. */ + /** + * Links to the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun links(): Links = links.getRequired("links") - /** The number of tests in the monitoring mode of the project. */ + /** + * The number of tests in the monitoring mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") - /** The project name. */ + /** + * The project name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The source of the project. */ + /** + * The source of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) - /** The task type of the project. */ + /** + * The task type of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun taskType(): TaskType = taskType.getRequired("taskType") - /** The number of versions (commits) in the project. */ + /** + * The number of versions (commits) in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun versionCount(): Long = versionCount.getRequired("versionCount") - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The project description. */ + /** + * The project description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) - /** The project id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The project creator id. */ + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId - /** The project creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The project last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The number of tests in the development mode of the project. */ + /** + * Returns the raw JSON value of [developmentGoalCount]. + * + * Unlike [developmentGoalCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("developmentGoalCount") @ExcludeMissing fun _developmentGoalCount(): JsonField = developmentGoalCount - /** The total number of tests in the project. */ + /** + * Returns the raw JSON value of [goalCount]. + * + * Unlike [goalCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount - /** The number of inference pipelines in the project. */ + /** + * Returns the raw JSON value of [inferencePipelineCount]. + * + * Unlike [inferencePipelineCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("inferencePipelineCount") @ExcludeMissing fun _inferencePipelineCount(): JsonField = inferencePipelineCount - /** Links to the project. */ + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links - /** The number of tests in the monitoring mode of the project. */ + /** + * Returns the raw JSON value of [monitoringGoalCount]. + * + * Unlike [monitoringGoalCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("monitoringGoalCount") @ExcludeMissing fun _monitoringGoalCount(): JsonField = monitoringGoalCount - /** The project name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The source of the project. */ + /** + * Returns the raw JSON value of [source]. + * + * Unlike [source], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source - /** The task type of the project. */ + /** + * Returns the raw JSON value of [taskType]. + * + * Unlike [taskType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("taskType") @ExcludeMissing fun _taskType(): JsonField = taskType - /** The number of versions (commits) in the project. */ + /** + * Returns the raw JSON value of [versionCount]. + * + * Unlike [versionCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("versionCount") @ExcludeMissing fun _versionCount(): JsonField = versionCount - /** The workspace id. */ + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId - /** The project description. */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + /** + * Returns the raw JSON value of [gitRepo]. + * + * Unlike [gitRepo], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo @JsonAnyGetter @@ -1000,22 +1445,40 @@ private constructor( /** The project id. */ fun id(id: String) = id(JsonField.of(id)) - /** The project id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The project creator id. */ fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The project creator id. */ + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) - /** The project creator id. */ + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The project creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -1023,7 +1486,13 @@ private constructor( /** The project last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The project last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -1032,7 +1501,13 @@ private constructor( fun developmentGoalCount(developmentGoalCount: Long) = developmentGoalCount(JsonField.of(developmentGoalCount)) - /** The number of tests in the development mode of the project. */ + /** + * Sets [Builder.developmentGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.developmentGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun developmentGoalCount(developmentGoalCount: JsonField) = apply { this.developmentGoalCount = developmentGoalCount } @@ -1040,14 +1515,26 @@ private constructor( /** The total number of tests in the project. */ fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) - /** The total number of tests in the project. */ + /** + * Sets [Builder.goalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.goalCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } /** The number of inference pipelines in the project. */ fun inferencePipelineCount(inferencePipelineCount: Long) = inferencePipelineCount(JsonField.of(inferencePipelineCount)) - /** The number of inference pipelines in the project. */ + /** + * Sets [Builder.inferencePipelineCount] to an arbitrary JSON value. + * + * You should usually call [Builder.inferencePipelineCount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { this.inferencePipelineCount = inferencePipelineCount } @@ -1055,14 +1542,26 @@ private constructor( /** Links to the project. */ fun links(links: Links) = links(JsonField.of(links)) - /** Links to the project. */ + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun links(links: JsonField) = apply { this.links = links } /** The number of tests in the monitoring mode of the project. */ fun monitoringGoalCount(monitoringGoalCount: Long) = monitoringGoalCount(JsonField.of(monitoringGoalCount)) - /** The number of tests in the monitoring mode of the project. */ + /** + * Sets [Builder.monitoringGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.monitoringGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { this.monitoringGoalCount = monitoringGoalCount } @@ -1070,28 +1569,52 @@ private constructor( /** The project name. */ fun name(name: String) = name(JsonField.of(name)) - /** The project name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The source of the project. */ fun source(source: Source?) = source(JsonField.ofNullable(source)) - /** The source of the project. */ + /** Alias for calling [Builder.source] with `source.orElse(null)`. */ fun source(source: Optional) = source(source.getOrNull()) - /** The source of the project. */ + /** + * Sets [Builder.source] to an arbitrary JSON value. + * + * You should usually call [Builder.source] with a well-typed [Source] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun source(source: JsonField) = apply { this.source = source } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) - /** The task type of the project. */ + /** + * Sets [Builder.taskType] to an arbitrary JSON value. + * + * You should usually call [Builder.taskType] with a well-typed [TaskType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun taskType(taskType: JsonField) = apply { this.taskType = taskType } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) - /** The number of versions (commits) in the project. */ + /** + * Sets [Builder.versionCount] to an arbitrary JSON value. + * + * You should usually call [Builder.versionCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun versionCount(versionCount: JsonField) = apply { this.versionCount = versionCount } @@ -1099,10 +1622,16 @@ private constructor( /** The workspace id. */ fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) - /** The workspace id. */ + /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) - /** The workspace id. */ + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } @@ -1110,18 +1639,32 @@ private constructor( /** The project description. */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** The project description. */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** The project description. */ - fun description(description: JsonField) = apply { - this.description = description + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description } fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) + /** Alias for calling [Builder.gitRepo] with `gitRepo.orElse(null)`. */ fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) + /** + * Sets [Builder.gitRepo] to an arbitrary JSON value. + * + * You should usually call [Builder.gitRepo] with a well-typed [GitRepo] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { @@ -1177,8 +1720,18 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun app(): String = app.getRequired("app") + /** + * Returns the raw JSON value of [app]. + * + * Unlike [app], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @@ -1225,6 +1778,13 @@ private constructor( fun app(app: String) = app(JsonField.of(app)) + /** + * Sets [Builder.app] to an arbitrary JSON value. + * + * You should usually call [Builder.app] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { @@ -1539,60 +2099,183 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun id(): String = id.getRequired("id") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun dateConnected(): OffsetDateTime = dateConnected.getRequired("dateConnected") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun gitId(): Long = gitId.getRequired("gitId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun name(): String = name.getRequired("name") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun private_(): Boolean = private_.getRequired("private") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun projectId(): String = projectId.getRequired("projectId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun slug(): String = slug.getRequired("slug") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun url(): String = url.getRequired("url") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [dateConnected]. + * + * Unlike [dateConnected], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected(): JsonField = dateConnected + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated + /** + * Returns the raw JSON value of [gitAccountId]. + * + * Unlike [gitAccountId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId(): JsonField = gitAccountId + /** + * Returns the raw JSON value of [gitId]. + * + * Unlike [gitId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gitId") @ExcludeMissing fun _gitId(): JsonField = gitId + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [private_]. + * + * Unlike [private_], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("private") @ExcludeMissing fun _private_(): JsonField = private_ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url + /** + * Returns the raw JSON value of [branch]. + * + * Unlike [branch], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch + /** + * Returns the raw JSON value of [rootDir]. + * + * Unlike [rootDir], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir @JsonAnyGetter @@ -1681,11 +2364,25 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) + /** + * Sets [Builder.dateConnected] to an arbitrary JSON value. + * + * You should usually call [Builder.dateConnected] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun dateConnected(dateConnected: JsonField) = apply { this.dateConnected = dateConnected } @@ -1693,46 +2390,116 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) + /** + * Sets [Builder.gitAccountId] to an arbitrary JSON value. + * + * You should usually call [Builder.gitAccountId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun gitAccountId(gitAccountId: JsonField) = apply { this.gitAccountId = gitAccountId } fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) + /** + * Sets [Builder.gitId] to an arbitrary JSON value. + * + * You should usually call [Builder.gitId] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gitId(gitId: JsonField) = apply { this.gitId = gitId } fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun private_(private_: Boolean) = private_(JsonField.of(private_)) + /** + * Sets [Builder.private_] to an arbitrary JSON value. + * + * You should usually call [Builder.private_] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun private_(private_: JsonField) = apply { this.private_ = private_ } fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } fun slug(slug: String) = slug(JsonField.of(slug)) + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } fun url(url: String) = url(JsonField.of(url)) + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun url(url: JsonField) = apply { this.url = url } fun branch(branch: String) = branch(JsonField.of(branch)) + /** + * Sets [Builder.branch] to an arbitrary JSON value. + * + * You should usually call [Builder.branch] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun branch(branch: JsonField) = apply { this.branch = branch } fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) + /** + * Sets [Builder.rootDir] to an arbitrary JSON value. + * + * You should usually call [Builder.rootDir] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun additionalProperties(additionalProperties: Map) = apply { @@ -1865,120 +2632,270 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The workspace creator id. */ + /** + * The workspace creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The workspace creation date. */ + /** + * The workspace creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The workspace last updated date. */ + /** + * The workspace last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The number of invites in the workspace. */ + /** + * The number of invites in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun inviteCount(): Long = inviteCount.getRequired("inviteCount") - /** The number of members in the workspace. */ + /** + * The number of members in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun memberCount(): Long = memberCount.getRequired("memberCount") - /** The workspace name. */ + /** + * The workspace name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The end date of the current billing period. */ + /** + * The end date of the current billing period. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun periodEndDate(): Optional = Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) - /** The start date of the current billing period. */ + /** + * The start date of the current billing period. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun periodStartDate(): Optional = Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) - /** The number of projects in the workspace. */ + /** + * The number of projects in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectCount(): Long = projectCount.getRequired("projectCount") - /** The workspace slug. */ + /** + * The workspace slug. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun slug(): String = slug.getRequired("slug") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun status(): Status = status.getRequired("status") - /** The workspace invite code. */ + /** + * The workspace invite code. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun inviteCode(): Optional = Optional.ofNullable(inviteCode.getNullable("inviteCode")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun monthlyUsage(): Optional> = Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) - /** Whether the workspace only allows SAML authentication. */ + /** + * Whether the workspace only allows SAML authentication. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun samlOnlyAccess(): Optional = Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun wildcardDomains(): Optional> = Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) - /** The workspace id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The workspace creator id. */ + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId - /** The workspace creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The workspace last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The number of invites in the workspace. */ + /** + * Returns the raw JSON value of [inviteCount]. + * + * Unlike [inviteCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("inviteCount") @ExcludeMissing fun _inviteCount(): JsonField = inviteCount - /** The number of members in the workspace. */ + /** + * Returns the raw JSON value of [memberCount]. + * + * Unlike [memberCount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("memberCount") @ExcludeMissing fun _memberCount(): JsonField = memberCount - /** The workspace name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The end date of the current billing period. */ + /** + * Returns the raw JSON value of [periodEndDate]. + * + * Unlike [periodEndDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("periodEndDate") @ExcludeMissing fun _periodEndDate(): JsonField = periodEndDate - /** The start date of the current billing period. */ + /** + * Returns the raw JSON value of [periodStartDate]. + * + * Unlike [periodStartDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("periodStartDate") @ExcludeMissing fun _periodStartDate(): JsonField = periodStartDate - /** The number of projects in the workspace. */ + /** + * Returns the raw JSON value of [projectCount]. + * + * Unlike [projectCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("projectCount") @ExcludeMissing fun _projectCount(): JsonField = projectCount - /** The workspace slug. */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The workspace invite code. */ + /** + * Returns the raw JSON value of [inviteCode]. + * + * Unlike [inviteCode], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("inviteCode") @ExcludeMissing fun _inviteCode(): JsonField = inviteCode + /** + * Returns the raw JSON value of [monthlyUsage]. + * + * Unlike [monthlyUsage], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("monthlyUsage") @ExcludeMissing fun _monthlyUsage(): JsonField> = monthlyUsage - /** Whether the workspace only allows SAML authentication. */ + /** + * Returns the raw JSON value of [samlOnlyAccess]. + * + * Unlike [samlOnlyAccess], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("samlOnlyAccess") @ExcludeMissing fun _samlOnlyAccess(): JsonField = samlOnlyAccess + /** + * Returns the raw JSON value of [wildcardDomains]. + * + * Unlike [wildcardDomains], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("wildcardDomains") @ExcludeMissing fun _wildcardDomains(): JsonField> = wildcardDomains @@ -2084,22 +3001,40 @@ private constructor( /** The workspace id. */ fun id(id: String) = id(JsonField.of(id)) - /** The workspace id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The workspace creator id. */ fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The workspace creator id. */ + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) - /** The workspace creator id. */ + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The workspace creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The workspace creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -2107,7 +3042,13 @@ private constructor( /** The workspace last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The workspace last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -2115,30 +3056,54 @@ private constructor( /** The number of invites in the workspace. */ fun inviteCount(inviteCount: Long) = inviteCount(JsonField.of(inviteCount)) - /** The number of invites in the workspace. */ + /** + * Sets [Builder.inviteCount] to an arbitrary JSON value. + * + * You should usually call [Builder.inviteCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun inviteCount(inviteCount: JsonField) = apply { this.inviteCount = inviteCount } /** The number of members in the workspace. */ fun memberCount(memberCount: Long) = memberCount(JsonField.of(memberCount)) - /** The number of members in the workspace. */ + /** + * Sets [Builder.memberCount] to an arbitrary JSON value. + * + * You should usually call [Builder.memberCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun memberCount(memberCount: JsonField) = apply { this.memberCount = memberCount } /** The workspace name. */ fun name(name: String) = name(JsonField.of(name)) - /** The workspace name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: OffsetDateTime?) = periodEndDate(JsonField.ofNullable(periodEndDate)) - /** The end date of the current billing period. */ + /** Alias for calling [Builder.periodEndDate] with `periodEndDate.orElse(null)`. */ fun periodEndDate(periodEndDate: Optional) = periodEndDate(periodEndDate.getOrNull()) - /** The end date of the current billing period. */ + /** + * Sets [Builder.periodEndDate] to an arbitrary JSON value. + * + * You should usually call [Builder.periodEndDate] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun periodEndDate(periodEndDate: JsonField) = apply { this.periodEndDate = periodEndDate } @@ -2147,11 +3112,17 @@ private constructor( fun periodStartDate(periodStartDate: OffsetDateTime?) = periodStartDate(JsonField.ofNullable(periodStartDate)) - /** The start date of the current billing period. */ + /** Alias for calling [Builder.periodStartDate] with `periodStartDate.orElse(null)`. */ fun periodStartDate(periodStartDate: Optional) = periodStartDate(periodStartDate.getOrNull()) - /** The start date of the current billing period. */ + /** + * Sets [Builder.periodStartDate] to an arbitrary JSON value. + * + * You should usually call [Builder.periodStartDate] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun periodStartDate(periodStartDate: JsonField) = apply { this.periodStartDate = periodStartDate } @@ -2159,7 +3130,13 @@ private constructor( /** The number of projects in the workspace. */ fun projectCount(projectCount: Long) = projectCount(JsonField.of(projectCount)) - /** The number of projects in the workspace. */ + /** + * Sets [Builder.projectCount] to an arbitrary JSON value. + * + * You should usually call [Builder.projectCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectCount(projectCount: JsonField) = apply { this.projectCount = projectCount } @@ -2167,26 +3144,57 @@ private constructor( /** The workspace slug. */ fun slug(slug: String) = slug(JsonField.of(slug)) - /** The workspace slug. */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } fun status(status: Status) = status(JsonField.of(status)) + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun status(status: JsonField) = apply { this.status = status } /** The workspace invite code. */ fun inviteCode(inviteCode: String) = inviteCode(JsonField.of(inviteCode)) - /** The workspace invite code. */ + /** + * Sets [Builder.inviteCode] to an arbitrary JSON value. + * + * You should usually call [Builder.inviteCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun inviteCode(inviteCode: JsonField) = apply { this.inviteCode = inviteCode } fun monthlyUsage(monthlyUsage: List) = monthlyUsage(JsonField.of(monthlyUsage)) + /** + * Sets [Builder.monthlyUsage] to an arbitrary JSON value. + * + * You should usually call [Builder.monthlyUsage] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun monthlyUsage(monthlyUsage: JsonField>) = apply { this.monthlyUsage = monthlyUsage.map { it.toMutableList() } } + /** + * Adds a single [MonthlyUsage] to [Builder.monthlyUsage]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMonthlyUsage(monthlyUsage: MonthlyUsage) = apply { this.monthlyUsage = (this.monthlyUsage ?: JsonField.of(mutableListOf())).also { @@ -2198,7 +3206,13 @@ private constructor( fun samlOnlyAccess(samlOnlyAccess: Boolean) = samlOnlyAccess(JsonField.of(samlOnlyAccess)) - /** Whether the workspace only allows SAML authentication. */ + /** + * Sets [Builder.samlOnlyAccess] to an arbitrary JSON value. + * + * You should usually call [Builder.samlOnlyAccess] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun samlOnlyAccess(samlOnlyAccess: JsonField) = apply { this.samlOnlyAccess = samlOnlyAccess } @@ -2206,10 +3220,22 @@ private constructor( fun wildcardDomains(wildcardDomains: List) = wildcardDomains(JsonField.of(wildcardDomains)) + /** + * Sets [Builder.wildcardDomains] to an arbitrary JSON value. + * + * You should usually call [Builder.wildcardDomains] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun wildcardDomains(wildcardDomains: JsonField>) = apply { this.wildcardDomains = wildcardDomains.map { it.toMutableList() } } + /** + * Adds a single [String] to [wildcardDomains]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addWildcardDomain(wildcardDomain: String) = apply { wildcardDomains = (wildcardDomains ?: JsonField.of(mutableListOf())).also { @@ -2413,23 +3439,53 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun executionTimeMs(): Optional = Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun monthYear(): Optional = Optional.ofNullable(monthYear.getNullable("monthYear")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun predictionCount(): Optional = Optional.ofNullable(predictionCount.getNullable("predictionCount")) + /** + * Returns the raw JSON value of [executionTimeMs]. + * + * Unlike [executionTimeMs], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("executionTimeMs") @ExcludeMissing fun _executionTimeMs(): JsonField = executionTimeMs + /** + * Returns the raw JSON value of [monthYear]. + * + * Unlike [monthYear], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("monthYear") @ExcludeMissing fun _monthYear(): JsonField = monthYear + /** + * Returns the raw JSON value of [predictionCount]. + * + * Unlike [predictionCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("predictionCount") @ExcludeMissing fun _predictionCount(): JsonField = predictionCount @@ -2478,18 +3534,40 @@ private constructor( fun executionTimeMs(executionTimeMs: Long?) = executionTimeMs(JsonField.ofNullable(executionTimeMs)) + /** + * Alias for [Builder.executionTimeMs]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun executionTimeMs(executionTimeMs: Long) = executionTimeMs(executionTimeMs as Long?) + /** + * Alias for calling [Builder.executionTimeMs] with `executionTimeMs.orElse(null)`. + */ fun executionTimeMs(executionTimeMs: Optional) = executionTimeMs(executionTimeMs.getOrNull()) + /** + * Sets [Builder.executionTimeMs] to an arbitrary JSON value. + * + * You should usually call [Builder.executionTimeMs] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun executionTimeMs(executionTimeMs: JsonField) = apply { this.executionTimeMs = executionTimeMs } fun monthYear(monthYear: LocalDate) = monthYear(JsonField.of(monthYear)) + /** + * Sets [Builder.monthYear] to an arbitrary JSON value. + * + * You should usually call [Builder.monthYear] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun monthYear(monthYear: JsonField) = apply { this.monthYear = monthYear } @@ -2497,6 +3575,13 @@ private constructor( fun predictionCount(predictionCount: Long) = predictionCount(JsonField.of(predictionCount)) + /** + * Sets [Builder.predictionCount] to an arbitrary JSON value. + * + * You should usually call [Builder.predictionCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun predictionCount(predictionCount: JsonField) = apply { this.predictionCount = predictionCount } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt index 2401d780..b766e29e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt @@ -96,25 +96,33 @@ private constructor( /** Filter list of items by name. */ fun name(name: String?) = apply { this.name = name } - /** Filter list of items by name. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) /** The page to return in a paginated query. */ fun page(page: Long?) = apply { this.page = page } - /** The page to return in a paginated query. */ + /** + * Alias for [Builder.page]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun page(page: Long) = page(page as Long?) - /** The page to return in a paginated query. */ + /** Alias for calling [Builder.page] with `page.orElse(null)`. */ fun page(page: Optional) = page(page.getOrNull()) /** Maximum number of items to return per page. */ fun perPage(perPage: Long?) = apply { this.perPage = perPage } - /** Maximum number of items to return per page. */ + /** + * Alias for [Builder.perPage]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun perPage(perPage: Long) = perPage(perPage as Long?) - /** Maximum number of items to return per page. */ + /** Alias for calling [Builder.perPage] with `perPage.orElse(null)`. */ fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt index bfc0b0d8..fb2084e8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt @@ -33,8 +33,17 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun items(): List = items.getRequired("items") + /** + * Returns the raw JSON value of [items]. + * + * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items @JsonAnyGetter @@ -82,10 +91,22 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) + /** + * Sets [Builder.items] to an arbitrary JSON value. + * + * You should usually call [Builder.items] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun items(items: JsonField>) = apply { this.items = items.map { it.toMutableList() } } + /** + * Adds a single [Item] to [items]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addItem(item: Item) = apply { items = (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } @@ -177,135 +198,304 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The inference pipeline id. */ + /** + * The inference pipeline id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The creation date. */ + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The last test evaluation date. */ + /** + * The last test evaluation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun dateLastEvaluated(): Optional = Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) - /** The last data sample received date. */ + /** + * The last data sample received date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun dateLastSampleReceived(): Optional = Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) - /** The next test evaluation date. */ + /** + * The next test evaluation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun dateOfNextEvaluation(): Optional = Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) - /** The last updated date. */ + /** + * The last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The inference pipeline description. */ + /** + * The inference pipeline description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** The number of tests failing. */ + /** + * The number of tests failing. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun links(): Links = links.getRequired("links") - /** The inference pipeline name. */ + /** + * The inference pipeline name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The number of tests passing. */ + /** + * The number of tests passing. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("projectId") - /** The status of test evaluation for the inference pipeline. */ + /** + * The status of test evaluation for the inference pipeline. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun status(): Status = status.getRequired("status") - /** The status message of test evaluation for the inference pipeline. */ + /** + * The status message of test evaluation for the inference pipeline. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun statusMessage(): Optional = Optional.ofNullable(statusMessage.getNullable("statusMessage")) - /** The total number of tests. */ + /** + * The total number of tests. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun project(): Optional = Optional.ofNullable(project.getNullable("project")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun workspace(): Optional = Optional.ofNullable(workspace.getNullable("workspace")) - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The inference pipeline id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The last test evaluation date. */ + /** + * Returns the raw JSON value of [dateLastEvaluated]. + * + * Unlike [dateLastEvaluated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateLastEvaluated") @ExcludeMissing fun _dateLastEvaluated(): JsonField = dateLastEvaluated - /** The last data sample received date. */ + /** + * Returns the raw JSON value of [dateLastSampleReceived]. + * + * Unlike [dateLastSampleReceived], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("dateLastSampleReceived") @ExcludeMissing fun _dateLastSampleReceived(): JsonField = dateLastSampleReceived - /** The next test evaluation date. */ + /** + * Returns the raw JSON value of [dateOfNextEvaluation]. + * + * Unlike [dateOfNextEvaluation], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("dateOfNextEvaluation") @ExcludeMissing fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation - /** The last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The inference pipeline description. */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** The number of tests failing. */ + /** + * Returns the raw JSON value of [failingGoalCount]. + * + * Unlike [failingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount(): JsonField = failingGoalCount + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links - /** The inference pipeline name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The number of tests passing. */ + /** + * Returns the raw JSON value of [passingGoalCount]. + * + * Unlike [passingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount(): JsonField = passingGoalCount - /** The project id. */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId - /** The status of test evaluation for the inference pipeline. */ + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The status message of test evaluation for the inference pipeline. */ + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage(): JsonField = statusMessage - /** The total number of tests. */ + /** + * Returns the raw JSON value of [totalGoalCount]. + * + * Unlike [totalGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount(): JsonField = totalGoalCount + /** + * Returns the raw JSON value of [project]. + * + * Unlike [project], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project") @ExcludeMissing fun _project(): JsonField = project + /** + * Returns the raw JSON value of [workspace]. + * + * Unlike [workspace], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("workspace") @ExcludeMissing fun _workspace(): JsonField = workspace - /** The workspace id. */ + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId @@ -420,13 +610,25 @@ private constructor( /** The inference pipeline id. */ fun id(id: String) = id(JsonField.of(id)) - /** The inference pipeline id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } /** The creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -435,11 +637,19 @@ private constructor( fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) - /** The last test evaluation date. */ + /** + * Alias for calling [Builder.dateLastEvaluated] with `dateLastEvaluated.orElse(null)`. + */ fun dateLastEvaluated(dateLastEvaluated: Optional) = dateLastEvaluated(dateLastEvaluated.getOrNull()) - /** The last test evaluation date. */ + /** + * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastEvaluated] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { this.dateLastEvaluated = dateLastEvaluated } @@ -448,11 +658,20 @@ private constructor( fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime?) = dateLastSampleReceived(JsonField.ofNullable(dateLastSampleReceived)) - /** The last data sample received date. */ + /** + * Alias for calling [Builder.dateLastSampleReceived] with + * `dateLastSampleReceived.orElse(null)`. + */ fun dateLastSampleReceived(dateLastSampleReceived: Optional) = dateLastSampleReceived(dateLastSampleReceived.getOrNull()) - /** The last data sample received date. */ + /** + * Sets [Builder.dateLastSampleReceived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastSampleReceived] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { this.dateLastSampleReceived = dateLastSampleReceived } @@ -461,11 +680,20 @@ private constructor( fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) - /** The next test evaluation date. */ + /** + * Alias for calling [Builder.dateOfNextEvaluation] with + * `dateOfNextEvaluation.orElse(null)`. + */ fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) - /** The next test evaluation date. */ + /** + * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfNextEvaluation] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { this.dateOfNextEvaluation = dateOfNextEvaluation } @@ -473,7 +701,13 @@ private constructor( /** The last updated date. */ fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -481,10 +715,16 @@ private constructor( /** The inference pipeline description. */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** The inference pipeline description. */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** The inference pipeline description. */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -493,26 +733,51 @@ private constructor( fun failingGoalCount(failingGoalCount: Long) = failingGoalCount(JsonField.of(failingGoalCount)) - /** The number of tests failing. */ + /** + * Sets [Builder.failingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun failingGoalCount(failingGoalCount: JsonField) = apply { this.failingGoalCount = failingGoalCount } fun links(links: Links) = links(JsonField.of(links)) + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun links(links: JsonField) = apply { this.links = links } /** The inference pipeline name. */ fun name(name: String) = name(JsonField.of(name)) - /** The inference pipeline name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The number of tests passing. */ fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) - /** The number of tests passing. */ + /** + * Sets [Builder.passingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun passingGoalCount(passingGoalCount: JsonField) = apply { this.passingGoalCount = passingGoalCount } @@ -520,24 +785,42 @@ private constructor( /** The project id. */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** The project id. */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** The status of test evaluation for the inference pipeline. */ fun status(status: Status) = status(JsonField.of(status)) - /** The status of test evaluation for the inference pipeline. */ + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun status(status: JsonField) = apply { this.status = status } /** The status message of test evaluation for the inference pipeline. */ fun statusMessage(statusMessage: String?) = statusMessage(JsonField.ofNullable(statusMessage)) - /** The status message of test evaluation for the inference pipeline. */ + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ fun statusMessage(statusMessage: Optional) = statusMessage(statusMessage.getOrNull()) - /** The status message of test evaluation for the inference pipeline. */ + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun statusMessage(statusMessage: JsonField) = apply { this.statusMessage = statusMessage } @@ -545,27 +828,55 @@ private constructor( /** The total number of tests. */ fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - /** The total number of tests. */ + /** + * Sets [Builder.totalGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun totalGoalCount(totalGoalCount: JsonField) = apply { this.totalGoalCount = totalGoalCount } fun project(project: Project?) = project(JsonField.ofNullable(project)) + /** Alias for calling [Builder.project] with `project.orElse(null)`. */ fun project(project: Optional) = project(project.getOrNull()) + /** + * Sets [Builder.project] to an arbitrary JSON value. + * + * You should usually call [Builder.project] with a well-typed [Project] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun project(project: JsonField) = apply { this.project = project } fun workspace(workspace: Workspace?) = workspace(JsonField.ofNullable(workspace)) + /** Alias for calling [Builder.workspace] with `workspace.orElse(null)`. */ fun workspace(workspace: Optional) = workspace(workspace.getOrNull()) + /** + * Sets [Builder.workspace] to an arbitrary JSON value. + * + * You should usually call [Builder.workspace] with a well-typed [Workspace] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun workspace(workspace: JsonField) = apply { this.workspace = workspace } /** The workspace id. */ fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) - /** The workspace id. */ + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } @@ -624,8 +935,18 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun app(): String = app.getRequired("app") + /** + * Returns the raw JSON value of [app]. + * + * Unlike [app], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @@ -672,6 +993,13 @@ private constructor( fun app(app: String) = app(JsonField.of(app)) + /** + * Sets [Builder.app] to an arbitrary JSON value. + * + * You should usually call [Builder.app] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { @@ -900,123 +1228,289 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The project id. */ + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun id(): String = id.getRequired("id") - /** The project creator id. */ + /** + * The project creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The project creation date. */ + /** + * The project creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The project last updated date. */ + /** + * The project last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The number of tests in the development mode of the project. */ + /** + * The number of tests in the development mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") - /** The total number of tests in the project. */ + /** + * The total number of tests in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun goalCount(): Long = goalCount.getRequired("goalCount") - /** The number of inference pipelines in the project. */ + /** + * The number of inference pipelines in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun inferencePipelineCount(): Long = inferencePipelineCount.getRequired("inferencePipelineCount") - /** Links to the project. */ + /** + * Links to the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun links(): Links = links.getRequired("links") - /** The number of tests in the monitoring mode of the project. */ + /** + * The number of tests in the monitoring mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") - /** The project name. */ + /** + * The project name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun name(): String = name.getRequired("name") - /** The source of the project. */ + /** + * The source of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) - /** The task type of the project. */ + /** + * The task type of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun taskType(): TaskType = taskType.getRequired("taskType") - /** The number of versions (commits) in the project. */ + /** + * The number of versions (commits) in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun versionCount(): Long = versionCount.getRequired("versionCount") - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) - /** The project description. */ + /** + * The project description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) - /** The project id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The project creator id. */ + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId - /** The project creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The project last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The number of tests in the development mode of the project. */ + /** + * Returns the raw JSON value of [developmentGoalCount]. + * + * Unlike [developmentGoalCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("developmentGoalCount") @ExcludeMissing fun _developmentGoalCount(): JsonField = developmentGoalCount - /** The total number of tests in the project. */ + /** + * Returns the raw JSON value of [goalCount]. + * + * Unlike [goalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount - /** The number of inference pipelines in the project. */ + /** + * Returns the raw JSON value of [inferencePipelineCount]. + * + * Unlike [inferencePipelineCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("inferencePipelineCount") @ExcludeMissing fun _inferencePipelineCount(): JsonField = inferencePipelineCount - /** Links to the project. */ + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links - /** The number of tests in the monitoring mode of the project. */ + /** + * Returns the raw JSON value of [monitoringGoalCount]. + * + * Unlike [monitoringGoalCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("monitoringGoalCount") @ExcludeMissing fun _monitoringGoalCount(): JsonField = monitoringGoalCount - /** The project name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The source of the project. */ + /** + * Returns the raw JSON value of [source]. + * + * Unlike [source], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source - /** The task type of the project. */ + /** + * Returns the raw JSON value of [taskType]. + * + * Unlike [taskType], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("taskType") @ExcludeMissing fun _taskType(): JsonField = taskType - /** The number of versions (commits) in the project. */ + /** + * Returns the raw JSON value of [versionCount]. + * + * Unlike [versionCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("versionCount") @ExcludeMissing fun _versionCount(): JsonField = versionCount - /** The workspace id. */ + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId - /** The project description. */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + /** + * Returns the raw JSON value of [gitRepo]. + * + * Unlike [gitRepo], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo @JsonAnyGetter @@ -1122,23 +1616,41 @@ private constructor( /** The project id. */ fun id(id: String) = id(JsonField.of(id)) - /** The project id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** The project creator id. */ fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The project creator id. */ + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) - /** The project creator id. */ + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The project creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -1147,7 +1659,13 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The project last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -1156,7 +1674,13 @@ private constructor( fun developmentGoalCount(developmentGoalCount: Long) = developmentGoalCount(JsonField.of(developmentGoalCount)) - /** The number of tests in the development mode of the project. */ + /** + * Sets [Builder.developmentGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.developmentGoalCount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun developmentGoalCount(developmentGoalCount: JsonField) = apply { this.developmentGoalCount = developmentGoalCount } @@ -1164,14 +1688,26 @@ private constructor( /** The total number of tests in the project. */ fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) - /** The total number of tests in the project. */ + /** + * Sets [Builder.goalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.goalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } /** The number of inference pipelines in the project. */ fun inferencePipelineCount(inferencePipelineCount: Long) = inferencePipelineCount(JsonField.of(inferencePipelineCount)) - /** The number of inference pipelines in the project. */ + /** + * Sets [Builder.inferencePipelineCount] to an arbitrary JSON value. + * + * You should usually call [Builder.inferencePipelineCount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { this.inferencePipelineCount = inferencePipelineCount } @@ -1179,14 +1715,26 @@ private constructor( /** Links to the project. */ fun links(links: Links) = links(JsonField.of(links)) - /** Links to the project. */ + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun links(links: JsonField) = apply { this.links = links } /** The number of tests in the monitoring mode of the project. */ fun monitoringGoalCount(monitoringGoalCount: Long) = monitoringGoalCount(JsonField.of(monitoringGoalCount)) - /** The number of tests in the monitoring mode of the project. */ + /** + * Sets [Builder.monitoringGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.monitoringGoalCount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { this.monitoringGoalCount = monitoringGoalCount } @@ -1194,28 +1742,52 @@ private constructor( /** The project name. */ fun name(name: String) = name(JsonField.of(name)) - /** The project name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** The source of the project. */ fun source(source: Source?) = source(JsonField.ofNullable(source)) - /** The source of the project. */ + /** Alias for calling [Builder.source] with `source.orElse(null)`. */ fun source(source: Optional) = source(source.getOrNull()) - /** The source of the project. */ + /** + * Sets [Builder.source] to an arbitrary JSON value. + * + * You should usually call [Builder.source] with a well-typed [Source] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun source(source: JsonField) = apply { this.source = source } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) - /** The task type of the project. */ + /** + * Sets [Builder.taskType] to an arbitrary JSON value. + * + * You should usually call [Builder.taskType] with a well-typed [TaskType] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun taskType(taskType: JsonField) = apply { this.taskType = taskType } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) - /** The number of versions (commits) in the project. */ + /** + * Sets [Builder.versionCount] to an arbitrary JSON value. + * + * You should usually call [Builder.versionCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun versionCount(versionCount: JsonField) = apply { this.versionCount = versionCount } @@ -1224,11 +1796,17 @@ private constructor( fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) - /** The workspace id. */ + /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) - /** The workspace id. */ + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } @@ -1237,19 +1815,33 @@ private constructor( fun description(description: String?) = description(JsonField.ofNullable(description)) - /** The project description. */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** The project description. */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun description(description: JsonField) = apply { this.description = description } fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) + /** Alias for calling [Builder.gitRepo] with `gitRepo.orElse(null)`. */ fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) + /** + * Sets [Builder.gitRepo] to an arbitrary JSON value. + * + * You should usually call [Builder.gitRepo] with a well-typed [GitRepo] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { @@ -1308,8 +1900,18 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun app(): String = app.getRequired("app") + /** + * Returns the raw JSON value of [app]. + * + * Unlike [app], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app @JsonAnyGetter @@ -1356,6 +1958,13 @@ private constructor( fun app(app: String) = app(JsonField.of(app)) + /** + * Sets [Builder.app] to an arbitrary JSON value. + * + * You should usually call [Builder.app] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { @@ -1674,63 +2283,191 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun id(): String = id.getRequired("id") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun dateConnected(): OffsetDateTime = dateConnected.getRequired("dateConnected") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun gitId(): Long = gitId.getRequired("gitId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun name(): String = name.getRequired("name") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun private_(): Boolean = private_.getRequired("private") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun projectId(): String = projectId.getRequired("projectId") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun slug(): String = slug.getRequired("slug") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun url(): String = url.getRequired("url") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [dateConnected]. + * + * Unlike [dateConnected], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected(): JsonField = dateConnected + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated + /** + * Returns the raw JSON value of [gitAccountId]. + * + * Unlike [gitAccountId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId(): JsonField = gitAccountId + /** + * Returns the raw JSON value of [gitId]. + * + * Unlike [gitId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gitId") @ExcludeMissing fun _gitId(): JsonField = gitId + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [private_]. + * + * Unlike [private_], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("private") @ExcludeMissing fun _private_(): JsonField = private_ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url + /** + * Returns the raw JSON value of [branch]. + * + * Unlike [branch], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch + /** + * Returns the raw JSON value of [rootDir]. + * + * Unlike [rootDir], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir @JsonAnyGetter @@ -1819,11 +2556,25 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) + /** + * Sets [Builder.dateConnected] to an arbitrary JSON value. + * + * You should usually call [Builder.dateConnected] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun dateConnected(dateConnected: JsonField) = apply { this.dateConnected = dateConnected } @@ -1831,6 +2582,13 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -1838,42 +2596,105 @@ private constructor( fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) + /** + * Sets [Builder.gitAccountId] to an arbitrary JSON value. + * + * You should usually call [Builder.gitAccountId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun gitAccountId(gitAccountId: JsonField) = apply { this.gitAccountId = gitAccountId } fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) + /** + * Sets [Builder.gitId] to an arbitrary JSON value. + * + * You should usually call [Builder.gitId] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun gitId(gitId: JsonField) = apply { this.gitId = gitId } fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun private_(private_: Boolean) = private_(JsonField.of(private_)) + /** + * Sets [Builder.private_] to an arbitrary JSON value. + * + * You should usually call [Builder.private_] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun private_(private_: JsonField) = apply { this.private_ = private_ } fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } fun slug(slug: String) = slug(JsonField.of(slug)) + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } fun url(url: String) = url(JsonField.of(url)) + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun url(url: JsonField) = apply { this.url = url } fun branch(branch: String) = branch(JsonField.of(branch)) + /** + * Sets [Builder.branch] to an arbitrary JSON value. + * + * You should usually call [Builder.branch] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun branch(branch: JsonField) = apply { this.branch = branch } fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) + /** + * Sets [Builder.rootDir] to an arbitrary JSON value. + * + * You should usually call [Builder.rootDir] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun additionalProperties(additionalProperties: Map) = apply { @@ -2008,123 +2829,288 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The workspace id. */ + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun id(): String = id.getRequired("id") - /** The workspace creator id. */ + /** + * The workspace creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) - /** The workspace creation date. */ + /** + * The workspace creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - /** The workspace last updated date. */ + /** + * The workspace last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") - /** The number of invites in the workspace. */ + /** + * The number of invites in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun inviteCount(): Long = inviteCount.getRequired("inviteCount") - /** The number of members in the workspace. */ + /** + * The number of members in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun memberCount(): Long = memberCount.getRequired("memberCount") - /** The workspace name. */ + /** + * The workspace name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun name(): String = name.getRequired("name") - /** The end date of the current billing period. */ + /** + * The end date of the current billing period. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun periodEndDate(): Optional = Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) - /** The start date of the current billing period. */ + /** + * The start date of the current billing period. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun periodStartDate(): Optional = Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) - /** The number of projects in the workspace. */ + /** + * The number of projects in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun projectCount(): Long = projectCount.getRequired("projectCount") - /** The workspace slug. */ + /** + * The workspace slug. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun slug(): String = slug.getRequired("slug") + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun status(): Status = status.getRequired("status") - /** The workspace invite code. */ + /** + * The workspace invite code. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun inviteCode(): Optional = Optional.ofNullable(inviteCode.getNullable("inviteCode")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun monthlyUsage(): Optional> = Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) - /** Whether the workspace only allows SAML authentication. */ + /** + * Whether the workspace only allows SAML authentication. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun samlOnlyAccess(): Optional = Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun wildcardDomains(): Optional> = Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) - /** The workspace id. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The workspace creator id. */ + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId - /** The workspace creation date. */ + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated(): JsonField = dateCreated - /** The workspace last updated date. */ + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated(): JsonField = dateUpdated - /** The number of invites in the workspace. */ + /** + * Returns the raw JSON value of [inviteCount]. + * + * Unlike [inviteCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("inviteCount") @ExcludeMissing fun _inviteCount(): JsonField = inviteCount - /** The number of members in the workspace. */ + /** + * Returns the raw JSON value of [memberCount]. + * + * Unlike [memberCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("memberCount") @ExcludeMissing fun _memberCount(): JsonField = memberCount - /** The workspace name. */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The end date of the current billing period. */ + /** + * Returns the raw JSON value of [periodEndDate]. + * + * Unlike [periodEndDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("periodEndDate") @ExcludeMissing fun _periodEndDate(): JsonField = periodEndDate - /** The start date of the current billing period. */ + /** + * Returns the raw JSON value of [periodStartDate]. + * + * Unlike [periodStartDate], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("periodStartDate") @ExcludeMissing fun _periodStartDate(): JsonField = periodStartDate - /** The number of projects in the workspace. */ + /** + * Returns the raw JSON value of [projectCount]. + * + * Unlike [projectCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("projectCount") @ExcludeMissing fun _projectCount(): JsonField = projectCount - /** The workspace slug. */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The workspace invite code. */ + /** + * Returns the raw JSON value of [inviteCode]. + * + * Unlike [inviteCode], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("inviteCode") @ExcludeMissing fun _inviteCode(): JsonField = inviteCode + /** + * Returns the raw JSON value of [monthlyUsage]. + * + * Unlike [monthlyUsage], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("monthlyUsage") @ExcludeMissing fun _monthlyUsage(): JsonField> = monthlyUsage - /** Whether the workspace only allows SAML authentication. */ + /** + * Returns the raw JSON value of [samlOnlyAccess]. + * + * Unlike [samlOnlyAccess], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("samlOnlyAccess") @ExcludeMissing fun _samlOnlyAccess(): JsonField = samlOnlyAccess + /** + * Returns the raw JSON value of [wildcardDomains]. + * + * Unlike [wildcardDomains], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("wildcardDomains") @ExcludeMissing fun _wildcardDomains(): JsonField> = wildcardDomains @@ -2230,23 +3216,41 @@ private constructor( /** The workspace id. */ fun id(id: String) = id(JsonField.of(id)) - /** The workspace id. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** The workspace creator id. */ fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) - /** The workspace creator id. */ + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) - /** The workspace creator id. */ + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The workspace creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - /** The workspace creation date. */ + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun dateCreated(dateCreated: JsonField) = apply { this.dateCreated = dateCreated } @@ -2255,7 +3259,13 @@ private constructor( fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) - /** The workspace last updated date. */ + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun dateUpdated(dateUpdated: JsonField) = apply { this.dateUpdated = dateUpdated } @@ -2263,7 +3273,13 @@ private constructor( /** The number of invites in the workspace. */ fun inviteCount(inviteCount: Long) = inviteCount(JsonField.of(inviteCount)) - /** The number of invites in the workspace. */ + /** + * Sets [Builder.inviteCount] to an arbitrary JSON value. + * + * You should usually call [Builder.inviteCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun inviteCount(inviteCount: JsonField) = apply { this.inviteCount = inviteCount } @@ -2271,7 +3287,13 @@ private constructor( /** The number of members in the workspace. */ fun memberCount(memberCount: Long) = memberCount(JsonField.of(memberCount)) - /** The number of members in the workspace. */ + /** + * Sets [Builder.memberCount] to an arbitrary JSON value. + * + * You should usually call [Builder.memberCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun memberCount(memberCount: JsonField) = apply { this.memberCount = memberCount } @@ -2279,18 +3301,30 @@ private constructor( /** The workspace name. */ fun name(name: String) = name(JsonField.of(name)) - /** The workspace name. */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** The end date of the current billing period. */ fun periodEndDate(periodEndDate: OffsetDateTime?) = periodEndDate(JsonField.ofNullable(periodEndDate)) - /** The end date of the current billing period. */ + /** Alias for calling [Builder.periodEndDate] with `periodEndDate.orElse(null)`. */ fun periodEndDate(periodEndDate: Optional) = periodEndDate(periodEndDate.getOrNull()) - /** The end date of the current billing period. */ + /** + * Sets [Builder.periodEndDate] to an arbitrary JSON value. + * + * You should usually call [Builder.periodEndDate] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun periodEndDate(periodEndDate: JsonField) = apply { this.periodEndDate = periodEndDate } @@ -2299,11 +3333,19 @@ private constructor( fun periodStartDate(periodStartDate: OffsetDateTime?) = periodStartDate(JsonField.ofNullable(periodStartDate)) - /** The start date of the current billing period. */ + /** + * Alias for calling [Builder.periodStartDate] with `periodStartDate.orElse(null)`. + */ fun periodStartDate(periodStartDate: Optional) = periodStartDate(periodStartDate.getOrNull()) - /** The start date of the current billing period. */ + /** + * Sets [Builder.periodStartDate] to an arbitrary JSON value. + * + * You should usually call [Builder.periodStartDate] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun periodStartDate(periodStartDate: JsonField) = apply { this.periodStartDate = periodStartDate } @@ -2311,7 +3353,13 @@ private constructor( /** The number of projects in the workspace. */ fun projectCount(projectCount: Long) = projectCount(JsonField.of(projectCount)) - /** The number of projects in the workspace. */ + /** + * Sets [Builder.projectCount] to an arbitrary JSON value. + * + * You should usually call [Builder.projectCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun projectCount(projectCount: JsonField) = apply { this.projectCount = projectCount } @@ -2319,17 +3367,36 @@ private constructor( /** The workspace slug. */ fun slug(slug: String) = slug(JsonField.of(slug)) - /** The workspace slug. */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } fun status(status: Status) = status(JsonField.of(status)) + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun status(status: JsonField) = apply { this.status = status } /** The workspace invite code. */ fun inviteCode(inviteCode: String) = inviteCode(JsonField.of(inviteCode)) - /** The workspace invite code. */ + /** + * Sets [Builder.inviteCode] to an arbitrary JSON value. + * + * You should usually call [Builder.inviteCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun inviteCode(inviteCode: JsonField) = apply { this.inviteCode = inviteCode } @@ -2337,10 +3404,22 @@ private constructor( fun monthlyUsage(monthlyUsage: List) = monthlyUsage(JsonField.of(monthlyUsage)) + /** + * Sets [Builder.monthlyUsage] to an arbitrary JSON value. + * + * You should usually call [Builder.monthlyUsage] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun monthlyUsage(monthlyUsage: JsonField>) = apply { this.monthlyUsage = monthlyUsage.map { it.toMutableList() } } + /** + * Adds a single [MonthlyUsage] to [Builder.monthlyUsage]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMonthlyUsage(monthlyUsage: MonthlyUsage) = apply { this.monthlyUsage = (this.monthlyUsage ?: JsonField.of(mutableListOf())).also { @@ -2352,7 +3431,13 @@ private constructor( fun samlOnlyAccess(samlOnlyAccess: Boolean) = samlOnlyAccess(JsonField.of(samlOnlyAccess)) - /** Whether the workspace only allows SAML authentication. */ + /** + * Sets [Builder.samlOnlyAccess] to an arbitrary JSON value. + * + * You should usually call [Builder.samlOnlyAccess] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun samlOnlyAccess(samlOnlyAccess: JsonField) = apply { this.samlOnlyAccess = samlOnlyAccess } @@ -2360,10 +3445,22 @@ private constructor( fun wildcardDomains(wildcardDomains: List) = wildcardDomains(JsonField.of(wildcardDomains)) + /** + * Sets [Builder.wildcardDomains] to an arbitrary JSON value. + * + * You should usually call [Builder.wildcardDomains] with a well-typed + * `List` value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun wildcardDomains(wildcardDomains: JsonField>) = apply { this.wildcardDomains = wildcardDomains.map { it.toMutableList() } } + /** + * Adds a single [String] to [wildcardDomains]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addWildcardDomain(wildcardDomain: String) = apply { wildcardDomains = (wildcardDomains ?: JsonField.of(mutableListOf())).also { @@ -2572,23 +3669,53 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun executionTimeMs(): Optional = Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun monthYear(): Optional = Optional.ofNullable(monthYear.getNullable("monthYear")) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun predictionCount(): Optional = Optional.ofNullable(predictionCount.getNullable("predictionCount")) + /** + * Returns the raw JSON value of [executionTimeMs]. + * + * Unlike [executionTimeMs], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("executionTimeMs") @ExcludeMissing fun _executionTimeMs(): JsonField = executionTimeMs + /** + * Returns the raw JSON value of [monthYear]. + * + * Unlike [monthYear], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("monthYear") @ExcludeMissing fun _monthYear(): JsonField = monthYear + /** + * Returns the raw JSON value of [predictionCount]. + * + * Unlike [predictionCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("predictionCount") @ExcludeMissing fun _predictionCount(): JsonField = predictionCount @@ -2637,18 +3764,41 @@ private constructor( fun executionTimeMs(executionTimeMs: Long?) = executionTimeMs(JsonField.ofNullable(executionTimeMs)) + /** + * Alias for [Builder.executionTimeMs]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun executionTimeMs(executionTimeMs: Long) = executionTimeMs(executionTimeMs as Long?) + /** + * Alias for calling [Builder.executionTimeMs] with + * `executionTimeMs.orElse(null)`. + */ fun executionTimeMs(executionTimeMs: Optional) = executionTimeMs(executionTimeMs.getOrNull()) + /** + * Sets [Builder.executionTimeMs] to an arbitrary JSON value. + * + * You should usually call [Builder.executionTimeMs] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun executionTimeMs(executionTimeMs: JsonField) = apply { this.executionTimeMs = executionTimeMs } fun monthYear(monthYear: LocalDate) = monthYear(JsonField.of(monthYear)) + /** + * Sets [Builder.monthYear] to an arbitrary JSON value. + * + * You should usually call [Builder.monthYear] with a well-typed [LocalDate] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun monthYear(monthYear: JsonField) = apply { this.monthYear = monthYear } @@ -2656,6 +3806,13 @@ private constructor( fun predictionCount(predictionCount: Long) = predictionCount(JsonField.of(predictionCount)) + /** + * Sets [Builder.predictionCount] to an arbitrary JSON value. + * + * You should usually call [Builder.predictionCount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun predictionCount(predictionCount: JsonField) = apply { this.predictionCount = predictionCount } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt index 76a1a3b5..3077cd63 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt @@ -14,6 +14,7 @@ import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.checkRequired import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects @NoAutoDetect @@ -28,19 +29,37 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The storage URI to send back to the backend after the upload was completed. */ + /** + * The storage URI to send back to the backend after the upload was completed. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun storageUri(): String = storageUri.getRequired("storageUri") - /** The presigned url. */ + /** + * The presigned url. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun url(): String = url.getRequired("url") /** Fields to include in the body of the upload. Only needed by s3 */ @JsonProperty("fields") @ExcludeMissing fun _fields(): JsonValue = fields - /** The storage URI to send back to the backend after the upload was completed. */ + /** + * Returns the raw JSON value of [storageUri]. + * + * Unlike [storageUri], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("storageUri") @ExcludeMissing fun _storageUri(): JsonField = storageUri - /** The presigned url. */ + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url @JsonAnyGetter @@ -94,13 +113,24 @@ private constructor( /** The storage URI to send back to the backend after the upload was completed. */ fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) - /** The storage URI to send back to the backend after the upload was completed. */ + /** + * Sets [Builder.storageUri] to an arbitrary JSON value. + * + * You should usually call [Builder.storageUri] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } /** The presigned url. */ fun url(url: String) = url(JsonField.of(url)) - /** The presigned url. */ + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun url(url: JsonField) = apply { this.url = url } /** Fields to include in the body of the upload. Only needed by s3 */ From 3d4d19974440297e5b1f4fdd220ae2c29adfad00 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Mar 2025 21:27:17 +0000 Subject: [PATCH 19/74] chore(internal): codegen related update (#85) --- .../openlayer/api/core/http/QueryParams.kt | 2 + .../projects/commits/CommitCreateParams.kt | 83 ++++++++++--------- .../InferencePipelineCreateParams.kt | 83 ++++++++++--------- .../commits/CommitRetrieveParamsTest.kt | 2 +- .../commits/CommitRetrieveResponseTest.kt | 2 +- .../testresults/TestResultListParamsTest.kt | 2 +- .../testresults/TestResultListResponseTest.kt | 14 +++- .../InferencePipelineDeleteParamsTest.kt | 2 +- .../InferencePipelineRetrieveParamsTest.kt | 2 +- .../InferencePipelineRetrieveResponseTest.kt | 2 +- .../InferencePipelineUpdateParamsTest.kt | 2 +- .../InferencePipelineUpdateResponseTest.kt | 2 +- .../data/DataStreamParamsTest.kt | 2 +- .../data/DataStreamResponseTest.kt | 2 +- .../rows/RowUpdateParamsTest.kt | 2 +- .../rows/RowUpdateResponseTest.kt | 2 +- .../testresults/TestResultListParamsTest.kt | 2 +- .../testresults/TestResultListResponseTest.kt | 14 +++- .../projects/ProjectCreateParamsTest.kt | 2 +- .../projects/ProjectCreateResponseTest.kt | 2 +- .../models/projects/ProjectListParamsTest.kt | 2 +- .../projects/ProjectListResponseTest.kt | 2 +- .../commits/CommitCreateParamsTest.kt | 24 +++--- .../commits/CommitCreateResponseTest.kt | 2 +- .../projects/commits/CommitListParamsTest.kt | 2 +- .../commits/CommitListResponseTest.kt | 2 +- .../InferencePipelineCreateParamsTest.kt | 24 +++--- .../InferencePipelineCreateResponseTest.kt | 2 +- .../InferencePipelineListParamsTest.kt | 2 +- .../InferencePipelineListResponseTest.kt | 2 +- .../PresignedUrlCreateParamsTest.kt | 2 +- .../PresignedUrlCreateResponseTest.kt | 2 +- .../api/services/ErrorHandlingTest.kt | 2 +- .../services/async/CommitServiceAsyncTest.kt | 2 +- .../InferencePipelineServiceAsyncTest.kt | 2 +- .../services/async/ProjectServiceAsyncTest.kt | 2 +- .../commits/TestResultServiceAsyncTest.kt | 2 +- .../DataServiceAsyncTest.kt | 2 +- .../inferencepipelines/RowServiceAsyncTest.kt | 2 +- .../TestResultServiceAsyncTest.kt | 2 +- .../async/projects/CommitServiceAsyncTest.kt | 6 +- .../InferencePipelineServiceAsyncTest.kt | 6 +- .../storage/PresignedUrlServiceAsyncTest.kt | 2 +- .../services/blocking/CommitServiceTest.kt | 2 +- .../blocking/InferencePipelineServiceTest.kt | 2 +- .../services/blocking/ProjectServiceTest.kt | 2 +- .../blocking/commits/TestResultServiceTest.kt | 2 +- .../inferencepipelines/DataServiceTest.kt | 2 +- .../inferencepipelines/RowServiceTest.kt | 2 +- .../TestResultServiceTest.kt | 2 +- .../blocking/projects/CommitServiceTest.kt | 6 +- .../projects/InferencePipelineServiceTest.kt | 6 +- .../storage/PresignedUrlServiceTest.kt | 2 +- 53 files changed, 192 insertions(+), 160 deletions(-) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/QueryParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/QueryParams.kt index fdc35912..8810d781 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/QueryParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/QueryParams.kt @@ -1,3 +1,5 @@ +// File generated from our OpenAPI spec by Stainless. + package com.openlayer.api.core.http import com.openlayer.api.core.toImmutable diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt index 3bc7d1f8..03135c92 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt @@ -27,13 +27,13 @@ import kotlin.jvm.optionals.getOrNull /** Create a new commit (project version) in a project. */ class CommitCreateParams private constructor( - private val projectId: String, + private val pathProjectId: String, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun projectId(): String = projectId + fun pathProjectId(): String = pathProjectId /** * The project version (commit) id. @@ -97,7 +97,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun projectId(): String = body.projectId() + fun bodyProjectId(): String = body.bodyProjectId() /** * The commit status. Initially, the commit is `queued`, then, it switches to `running`. @@ -222,11 +222,11 @@ private constructor( fun _passingGoalCount(): JsonField = body._passingGoalCount() /** - * Returns the raw JSON value of [projectId]. + * Returns the raw JSON value of [bodyProjectId]. * - * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [bodyProjectId], this method doesn't throw if the JSON field has an unexpected type. */ - fun _projectId(): JsonField = body._projectId() + fun _bodyProjectId(): JsonField = body._bodyProjectId() /** * Returns the raw JSON value of [status]. @@ -308,7 +308,7 @@ private constructor( fun getPathParam(index: Int): String { return when (index) { - 0 -> projectId + 0 -> pathProjectId else -> "" } } @@ -338,7 +338,7 @@ private constructor( private val passingGoalCount: JsonField = JsonMissing.of(), @JsonProperty("projectId") @ExcludeMissing - private val projectId: JsonField = JsonMissing.of(), + private val bodyProjectId: JsonField = JsonMissing.of(), @JsonProperty("status") @ExcludeMissing private val status: JsonField = JsonMissing.of(), @@ -433,7 +433,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun projectId(): String = projectId.getRequired("projectId") + fun bodyProjectId(): String = bodyProjectId.getRequired("projectId") /** * The commit status. Initially, the commit is `queued`, then, it switches to `running`. @@ -571,11 +571,14 @@ private constructor( fun _passingGoalCount(): JsonField = passingGoalCount /** - * Returns the raw JSON value of [projectId]. + * Returns the raw JSON value of [bodyProjectId]. * - * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [bodyProjectId], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + @JsonProperty("projectId") + @ExcludeMissing + fun _bodyProjectId(): JsonField = bodyProjectId /** * Returns the raw JSON value of [status]. @@ -675,7 +678,7 @@ private constructor( failingGoalCount() mlModelId() passingGoalCount() - projectId() + bodyProjectId() status() statusMessage() storageUri() @@ -704,7 +707,7 @@ private constructor( * .failingGoalCount() * .mlModelId() * .passingGoalCount() - * .projectId() + * .bodyProjectId() * .status() * .statusMessage() * .storageUri() @@ -726,7 +729,7 @@ private constructor( private var failingGoalCount: JsonField? = null private var mlModelId: JsonField? = null private var passingGoalCount: JsonField? = null - private var projectId: JsonField? = null + private var bodyProjectId: JsonField? = null private var status: JsonField? = null private var statusMessage: JsonField? = null private var storageUri: JsonField? = null @@ -747,7 +750,7 @@ private constructor( failingGoalCount = body.failingGoalCount mlModelId = body.mlModelId passingGoalCount = body.passingGoalCount - projectId = body.projectId + bodyProjectId = body.bodyProjectId status = body.status statusMessage = body.statusMessage storageUri = body.storageUri @@ -863,16 +866,18 @@ private constructor( } /** The project id. */ - fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + fun bodyProjectId(bodyProjectId: String) = bodyProjectId(JsonField.of(bodyProjectId)) /** - * Sets [Builder.projectId] to an arbitrary JSON value. + * Sets [Builder.bodyProjectId] to an arbitrary JSON value. * - * You should usually call [Builder.projectId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet + * You should usually call [Builder.bodyProjectId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + fun bodyProjectId(bodyProjectId: JsonField) = apply { + this.bodyProjectId = bodyProjectId + } /** * The commit status. Initially, the commit is `queued`, then, it switches to `running`. @@ -1053,7 +1058,7 @@ private constructor( checkRequired("failingGoalCount", failingGoalCount), checkRequired("mlModelId", mlModelId), checkRequired("passingGoalCount", passingGoalCount), - checkRequired("projectId", projectId), + checkRequired("bodyProjectId", bodyProjectId), checkRequired("status", status), checkRequired("statusMessage", statusMessage), checkRequired("storageUri", storageUri), @@ -1072,17 +1077,17 @@ private constructor( return true } - return /* spotless:off */ other is Body && id == other.id && commit == other.commit && dateArchived == other.dateArchived && dateCreated == other.dateCreated && failingGoalCount == other.failingGoalCount && mlModelId == other.mlModelId && passingGoalCount == other.passingGoalCount && projectId == other.projectId && status == other.status && statusMessage == other.statusMessage && storageUri == other.storageUri && totalGoalCount == other.totalGoalCount && trainingDatasetId == other.trainingDatasetId && validationDatasetId == other.validationDatasetId && archived == other.archived && deploymentStatus == other.deploymentStatus && links == other.links && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && id == other.id && commit == other.commit && dateArchived == other.dateArchived && dateCreated == other.dateCreated && failingGoalCount == other.failingGoalCount && mlModelId == other.mlModelId && passingGoalCount == other.passingGoalCount && bodyProjectId == other.bodyProjectId && status == other.status && statusMessage == other.statusMessage && storageUri == other.storageUri && totalGoalCount == other.totalGoalCount && trainingDatasetId == other.trainingDatasetId && validationDatasetId == other.validationDatasetId && archived == other.archived && deploymentStatus == other.deploymentStatus && links == other.links && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, commit, dateArchived, dateCreated, failingGoalCount, mlModelId, passingGoalCount, projectId, status, statusMessage, storageUri, totalGoalCount, trainingDatasetId, validationDatasetId, archived, deploymentStatus, links, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, commit, dateArchived, dateCreated, failingGoalCount, mlModelId, passingGoalCount, bodyProjectId, status, statusMessage, storageUri, totalGoalCount, trainingDatasetId, validationDatasetId, archived, deploymentStatus, links, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Body{id=$id, commit=$commit, dateArchived=$dateArchived, dateCreated=$dateCreated, failingGoalCount=$failingGoalCount, mlModelId=$mlModelId, passingGoalCount=$passingGoalCount, projectId=$projectId, status=$status, statusMessage=$statusMessage, storageUri=$storageUri, totalGoalCount=$totalGoalCount, trainingDatasetId=$trainingDatasetId, validationDatasetId=$validationDatasetId, archived=$archived, deploymentStatus=$deploymentStatus, links=$links, additionalProperties=$additionalProperties}" + "Body{id=$id, commit=$commit, dateArchived=$dateArchived, dateCreated=$dateCreated, failingGoalCount=$failingGoalCount, mlModelId=$mlModelId, passingGoalCount=$passingGoalCount, bodyProjectId=$bodyProjectId, status=$status, statusMessage=$statusMessage, storageUri=$storageUri, totalGoalCount=$totalGoalCount, trainingDatasetId=$trainingDatasetId, validationDatasetId=$validationDatasetId, archived=$archived, deploymentStatus=$deploymentStatus, links=$links, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -1094,7 +1099,7 @@ private constructor( * * The following fields are required: * ```java - * .projectId() + * .pathProjectId() * .id() * .commit() * .dateArchived() @@ -1102,7 +1107,7 @@ private constructor( * .failingGoalCount() * .mlModelId() * .passingGoalCount() - * .projectId() + * .bodyProjectId() * .status() * .statusMessage() * .storageUri() @@ -1118,20 +1123,20 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var projectId: String? = null + private var pathProjectId: String? = null private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic internal fun from(commitCreateParams: CommitCreateParams) = apply { - projectId = commitCreateParams.projectId + pathProjectId = commitCreateParams.pathProjectId body = commitCreateParams.body.toBuilder() additionalHeaders = commitCreateParams.additionalHeaders.toBuilder() additionalQueryParams = commitCreateParams.additionalQueryParams.toBuilder() } - fun projectId(projectId: String) = apply { this.projectId = projectId } + fun pathProjectId(pathProjectId: String) = apply { this.pathProjectId = pathProjectId } /** The project version (commit) id. */ fun id(id: String) = apply { body.id(id) } @@ -1235,16 +1240,18 @@ private constructor( } /** The project id. */ - fun projectId(projectId: String) = apply { body.projectId(projectId) } + fun bodyProjectId(bodyProjectId: String) = apply { body.bodyProjectId(bodyProjectId) } /** - * Sets [Builder.projectId] to an arbitrary JSON value. + * Sets [Builder.bodyProjectId] to an arbitrary JSON value. * - * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * You should usually call [Builder.bodyProjectId] with a well-typed [String] value instead. * This method is primarily for setting the field to an undocumented or not yet supported * value. */ - fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } + fun bodyProjectId(bodyProjectId: JsonField) = apply { + body.bodyProjectId(bodyProjectId) + } /** * The commit status. Initially, the commit is `queued`, then, it switches to `running`. @@ -1513,7 +1520,7 @@ private constructor( fun build(): CommitCreateParams = CommitCreateParams( - checkRequired("projectId", projectId), + checkRequired("pathProjectId", pathProjectId), body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -2337,11 +2344,11 @@ private constructor( return true } - return /* spotless:off */ other is CommitCreateParams && projectId == other.projectId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + return /* spotless:off */ other is CommitCreateParams && pathProjectId == other.pathProjectId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(projectId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(pathProjectId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "CommitCreateParams{projectId=$projectId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "CommitCreateParams{pathProjectId=$pathProjectId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt index 02a82df5..f1606c15 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt @@ -29,13 +29,13 @@ import kotlin.jvm.optionals.getOrNull /** Create an inference pipeline in a project. */ class InferencePipelineCreateParams private constructor( - private val projectId: String, + private val pathProjectId: String, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun projectId(): String = projectId + fun pathProjectId(): String = pathProjectId /** * The inference pipeline id. @@ -129,7 +129,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun projectId(): String = body.projectId() + fun bodyProjectId(): String = body.bodyProjectId() /** * The status of test evaluation for the inference pipeline. @@ -258,11 +258,11 @@ private constructor( fun _passingGoalCount(): JsonField = body._passingGoalCount() /** - * Returns the raw JSON value of [projectId]. + * Returns the raw JSON value of [bodyProjectId]. * - * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [bodyProjectId], this method doesn't throw if the JSON field has an unexpected type. */ - fun _projectId(): JsonField = body._projectId() + fun _bodyProjectId(): JsonField = body._bodyProjectId() /** * Returns the raw JSON value of [status]. @@ -320,7 +320,7 @@ private constructor( fun getPathParam(index: Int): String { return when (index) { - 0 -> projectId + 0 -> pathProjectId else -> "" } } @@ -362,7 +362,7 @@ private constructor( private val passingGoalCount: JsonField = JsonMissing.of(), @JsonProperty("projectId") @ExcludeMissing - private val projectId: JsonField = JsonMissing.of(), + private val bodyProjectId: JsonField = JsonMissing.of(), @JsonProperty("status") @ExcludeMissing private val status: JsonField = JsonMissing.of(), @@ -481,7 +481,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun projectId(): String = projectId.getRequired("projectId") + fun bodyProjectId(): String = bodyProjectId.getRequired("projectId") /** * The status of test evaluation for the inference pipeline. @@ -629,11 +629,14 @@ private constructor( fun _passingGoalCount(): JsonField = passingGoalCount /** - * Returns the raw JSON value of [projectId]. + * Returns the raw JSON value of [bodyProjectId]. * - * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [bodyProjectId], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + @JsonProperty("projectId") + @ExcludeMissing + fun _bodyProjectId(): JsonField = bodyProjectId /** * Returns the raw JSON value of [status]. @@ -709,7 +712,7 @@ private constructor( links().validate() name() passingGoalCount() - projectId() + bodyProjectId() status() statusMessage() totalGoalCount() @@ -739,7 +742,7 @@ private constructor( * .links() * .name() * .passingGoalCount() - * .projectId() + * .bodyProjectId() * .status() * .statusMessage() * .totalGoalCount() @@ -762,7 +765,7 @@ private constructor( private var links: JsonField? = null private var name: JsonField? = null private var passingGoalCount: JsonField? = null - private var projectId: JsonField? = null + private var bodyProjectId: JsonField? = null private var status: JsonField? = null private var statusMessage: JsonField? = null private var totalGoalCount: JsonField? = null @@ -784,7 +787,7 @@ private constructor( links = body.links name = body.name passingGoalCount = body.passingGoalCount - projectId = body.projectId + bodyProjectId = body.bodyProjectId status = body.status statusMessage = body.statusMessage totalGoalCount = body.totalGoalCount @@ -970,16 +973,18 @@ private constructor( } /** The project id. */ - fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + fun bodyProjectId(bodyProjectId: String) = bodyProjectId(JsonField.of(bodyProjectId)) /** - * Sets [Builder.projectId] to an arbitrary JSON value. + * Sets [Builder.bodyProjectId] to an arbitrary JSON value. * - * You should usually call [Builder.projectId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet + * You should usually call [Builder.bodyProjectId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + fun bodyProjectId(bodyProjectId: JsonField) = apply { + this.bodyProjectId = bodyProjectId + } /** The status of test evaluation for the inference pipeline. */ fun status(status: Status) = status(JsonField.of(status)) @@ -1100,7 +1105,7 @@ private constructor( checkRequired("links", links), checkRequired("name", name), checkRequired("passingGoalCount", passingGoalCount), - checkRequired("projectId", projectId), + checkRequired("bodyProjectId", bodyProjectId), checkRequired("status", status), checkRequired("statusMessage", statusMessage), checkRequired("totalGoalCount", totalGoalCount), @@ -1116,17 +1121,17 @@ private constructor( return true } - return /* spotless:off */ other is Body && id == other.id && dateCreated == other.dateCreated && dateLastEvaluated == other.dateLastEvaluated && dateLastSampleReceived == other.dateLastSampleReceived && dateOfNextEvaluation == other.dateOfNextEvaluation && dateUpdated == other.dateUpdated && description == other.description && failingGoalCount == other.failingGoalCount && links == other.links && name == other.name && passingGoalCount == other.passingGoalCount && projectId == other.projectId && status == other.status && statusMessage == other.statusMessage && totalGoalCount == other.totalGoalCount && project == other.project && workspace == other.workspace && workspaceId == other.workspaceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && id == other.id && dateCreated == other.dateCreated && dateLastEvaluated == other.dateLastEvaluated && dateLastSampleReceived == other.dateLastSampleReceived && dateOfNextEvaluation == other.dateOfNextEvaluation && dateUpdated == other.dateUpdated && description == other.description && failingGoalCount == other.failingGoalCount && links == other.links && name == other.name && passingGoalCount == other.passingGoalCount && bodyProjectId == other.bodyProjectId && status == other.status && statusMessage == other.statusMessage && totalGoalCount == other.totalGoalCount && project == other.project && workspace == other.workspace && workspaceId == other.workspaceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, dateCreated, dateLastEvaluated, dateLastSampleReceived, dateOfNextEvaluation, dateUpdated, description, failingGoalCount, links, name, passingGoalCount, projectId, status, statusMessage, totalGoalCount, project, workspace, workspaceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dateCreated, dateLastEvaluated, dateLastSampleReceived, dateOfNextEvaluation, dateUpdated, description, failingGoalCount, links, name, passingGoalCount, bodyProjectId, status, statusMessage, totalGoalCount, project, workspace, workspaceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Body{id=$id, dateCreated=$dateCreated, dateLastEvaluated=$dateLastEvaluated, dateLastSampleReceived=$dateLastSampleReceived, dateOfNextEvaluation=$dateOfNextEvaluation, dateUpdated=$dateUpdated, description=$description, failingGoalCount=$failingGoalCount, links=$links, name=$name, passingGoalCount=$passingGoalCount, projectId=$projectId, status=$status, statusMessage=$statusMessage, totalGoalCount=$totalGoalCount, project=$project, workspace=$workspace, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" + "Body{id=$id, dateCreated=$dateCreated, dateLastEvaluated=$dateLastEvaluated, dateLastSampleReceived=$dateLastSampleReceived, dateOfNextEvaluation=$dateOfNextEvaluation, dateUpdated=$dateUpdated, description=$description, failingGoalCount=$failingGoalCount, links=$links, name=$name, passingGoalCount=$passingGoalCount, bodyProjectId=$bodyProjectId, status=$status, statusMessage=$statusMessage, totalGoalCount=$totalGoalCount, project=$project, workspace=$workspace, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -1139,7 +1144,7 @@ private constructor( * * The following fields are required: * ```java - * .projectId() + * .pathProjectId() * .id() * .dateCreated() * .dateLastEvaluated() @@ -1151,7 +1156,7 @@ private constructor( * .links() * .name() * .passingGoalCount() - * .projectId() + * .bodyProjectId() * .status() * .statusMessage() * .totalGoalCount() @@ -1164,20 +1169,20 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var projectId: String? = null + private var pathProjectId: String? = null private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic internal fun from(inferencePipelineCreateParams: InferencePipelineCreateParams) = apply { - projectId = inferencePipelineCreateParams.projectId + pathProjectId = inferencePipelineCreateParams.pathProjectId body = inferencePipelineCreateParams.body.toBuilder() additionalHeaders = inferencePipelineCreateParams.additionalHeaders.toBuilder() additionalQueryParams = inferencePipelineCreateParams.additionalQueryParams.toBuilder() } - fun projectId(projectId: String) = apply { this.projectId = projectId } + fun pathProjectId(pathProjectId: String) = apply { this.pathProjectId = pathProjectId } /** The inference pipeline id. */ fun id(id: String) = apply { body.id(id) } @@ -1353,16 +1358,18 @@ private constructor( } /** The project id. */ - fun projectId(projectId: String) = apply { body.projectId(projectId) } + fun bodyProjectId(bodyProjectId: String) = apply { body.bodyProjectId(bodyProjectId) } /** - * Sets [Builder.projectId] to an arbitrary JSON value. + * Sets [Builder.bodyProjectId] to an arbitrary JSON value. * - * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * You should usually call [Builder.bodyProjectId] with a well-typed [String] value instead. * This method is primarily for setting the field to an undocumented or not yet supported * value. */ - fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } + fun bodyProjectId(bodyProjectId: JsonField) = apply { + body.bodyProjectId(bodyProjectId) + } /** The status of test evaluation for the inference pipeline. */ fun status(status: Status) = apply { body.status(status) } @@ -1565,7 +1572,7 @@ private constructor( fun build(): InferencePipelineCreateParams = InferencePipelineCreateParams( - checkRequired("projectId", projectId), + checkRequired("pathProjectId", pathProjectId), body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -4443,11 +4450,11 @@ private constructor( return true } - return /* spotless:off */ other is InferencePipelineCreateParams && projectId == other.projectId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + return /* spotless:off */ other is InferencePipelineCreateParams && pathProjectId == other.pathProjectId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(projectId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(pathProjectId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "InferencePipelineCreateParams{projectId=$projectId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "InferencePipelineCreateParams{pathProjectId=$pathProjectId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveParamsTest.kt index 4ad5908b..4c7b8542 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveParamsTest.kt @@ -5,7 +5,7 @@ package com.openlayer.api.models.commits import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class CommitRetrieveParamsTest { +internal class CommitRetrieveParamsTest { @Test fun create() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt index 11f1b13d..765b4703 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt @@ -6,7 +6,7 @@ import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class CommitRetrieveResponseTest { +internal class CommitRetrieveResponseTest { @Test fun createCommitRetrieveResponse() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt index 75b13ea8..9b524699 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt @@ -6,7 +6,7 @@ import com.openlayer.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class TestResultListParamsTest { +internal class TestResultListParamsTest { @Test fun create() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt index cfc41f76..16dc4c8f 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt @@ -7,7 +7,7 @@ import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class TestResultListResponseTest { +internal class TestResultListResponseTest { @Test fun createTestResultListResponse() { @@ -32,7 +32,11 @@ class TestResultListResponseTest { .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .description("This test checks for duplicate rows in the dataset.") + .description( + JsonValue.from( + "This test checks for duplicate rows in the dataset." + ) + ) .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -83,7 +87,11 @@ class TestResultListResponseTest { .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .description("This test checks for duplicate rows in the dataset.") + .description( + JsonValue.from( + "This test checks for duplicate rows in the dataset." + ) + ) .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParamsTest.kt index 7d1e1cfe..3fdfc636 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParamsTest.kt @@ -5,7 +5,7 @@ package com.openlayer.api.models.inferencepipelines import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class InferencePipelineDeleteParamsTest { +internal class InferencePipelineDeleteParamsTest { @Test fun create() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParamsTest.kt index a7d16114..92d490a1 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParamsTest.kt @@ -6,7 +6,7 @@ import com.openlayer.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class InferencePipelineRetrieveParamsTest { +internal class InferencePipelineRetrieveParamsTest { @Test fun create() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt index a57ab209..474d2989 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt @@ -7,7 +7,7 @@ import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class InferencePipelineRetrieveResponseTest { +internal class InferencePipelineRetrieveResponseTest { @Test fun createInferencePipelineRetrieveResponse() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParamsTest.kt index d58a401a..dd528e34 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParamsTest.kt @@ -6,7 +6,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class InferencePipelineUpdateParamsTest { +internal class InferencePipelineUpdateParamsTest { @Test fun create() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt index 8d35abbc..e65d844f 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt @@ -7,7 +7,7 @@ import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class InferencePipelineUpdateResponseTest { +internal class InferencePipelineUpdateResponseTest { @Test fun createInferencePipelineUpdateResponse() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParamsTest.kt index e36d69c5..b0f593fb 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParamsTest.kt @@ -7,7 +7,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class DataStreamParamsTest { +internal class DataStreamParamsTest { @Test fun create() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponseTest.kt index 9cbd2386..6418f012 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponseTest.kt @@ -5,7 +5,7 @@ package com.openlayer.api.models.inferencepipelines.data import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class DataStreamResponseTest { +internal class DataStreamResponseTest { @Test fun createDataStreamResponse() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt index 3013696d..94768893 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt @@ -8,7 +8,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class RowUpdateParamsTest { +internal class RowUpdateParamsTest { @Test fun create() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponseTest.kt index a423a574..8d93ea51 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponseTest.kt @@ -5,7 +5,7 @@ package com.openlayer.api.models.inferencepipelines.rows import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class RowUpdateResponseTest { +internal class RowUpdateResponseTest { @Test fun createRowUpdateResponse() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt index 4e0fae12..94baac03 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt @@ -6,7 +6,7 @@ import com.openlayer.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class TestResultListParamsTest { +internal class TestResultListParamsTest { @Test fun create() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt index dcaa341d..2b0c06c7 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt @@ -7,7 +7,7 @@ import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class TestResultListResponseTest { +internal class TestResultListResponseTest { @Test fun createTestResultListResponse() { @@ -32,7 +32,11 @@ class TestResultListResponseTest { .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .description("This test checks for duplicate rows in the dataset.") + .description( + JsonValue.from( + "This test checks for duplicate rows in the dataset." + ) + ) .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -83,7 +87,11 @@ class TestResultListResponseTest { .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .description("This test checks for duplicate rows in the dataset.") + .description( + JsonValue.from( + "This test checks for duplicate rows in the dataset." + ) + ) .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateParamsTest.kt index c40e6d21..a6dd32da 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateParamsTest.kt @@ -7,7 +7,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class ProjectCreateParamsTest { +internal class ProjectCreateParamsTest { @Test fun create() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateResponseTest.kt index a3b42157..bab6428f 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateResponseTest.kt @@ -6,7 +6,7 @@ import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class ProjectCreateResponseTest { +internal class ProjectCreateResponseTest { @Test fun createProjectCreateResponse() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListParamsTest.kt index 15fe616b..2c31af92 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListParamsTest.kt @@ -6,7 +6,7 @@ import com.openlayer.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class ProjectListParamsTest { +internal class ProjectListParamsTest { @Test fun create() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListResponseTest.kt index dbc6829c..19949a5b 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListResponseTest.kt @@ -6,7 +6,7 @@ import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class ProjectListResponseTest { +internal class ProjectListResponseTest { @Test fun createProjectListResponse() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt index 3614d30b..8c38b268 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt @@ -7,12 +7,12 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class CommitCreateParamsTest { +internal class CommitCreateParamsTest { @Test fun create() { CommitCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pathProjectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( CommitCreateParams.Commit.builder() @@ -35,7 +35,7 @@ class CommitCreateParamsTest { .failingGoalCount(1L) .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .status(CommitCreateParams.Status.QUEUED) .statusMessage("Commit successfully processed.") .storageUri("s3://...") @@ -58,7 +58,7 @@ class CommitCreateParamsTest { fun body() { val params = CommitCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pathProjectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( CommitCreateParams.Commit.builder() @@ -81,7 +81,7 @@ class CommitCreateParamsTest { .failingGoalCount(1L) .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .status(CommitCreateParams.Status.QUEUED) .statusMessage("Commit successfully processed.") .storageUri("s3://...") @@ -125,7 +125,7 @@ class CommitCreateParamsTest { assertThat(body.failingGoalCount()).isEqualTo(1L) assertThat(body.mlModelId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.passingGoalCount()).isEqualTo(5L) - assertThat(body.projectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.bodyProjectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.status()).isEqualTo(CommitCreateParams.Status.QUEUED) assertThat(body.statusMessage()).contains("Commit successfully processed.") assertThat(body.storageUri()).isEqualTo("s3://...") @@ -148,7 +148,7 @@ class CommitCreateParamsTest { fun bodyWithoutOptionalFields() { val params = CommitCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pathProjectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( CommitCreateParams.Commit.builder() @@ -167,7 +167,7 @@ class CommitCreateParamsTest { .failingGoalCount(1L) .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .status(CommitCreateParams.Status.QUEUED) .statusMessage("Commit successfully processed.") .storageUri("s3://...") @@ -198,7 +198,7 @@ class CommitCreateParamsTest { assertThat(body.failingGoalCount()).isEqualTo(1L) assertThat(body.mlModelId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.passingGoalCount()).isEqualTo(5L) - assertThat(body.projectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.bodyProjectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.status()).isEqualTo(CommitCreateParams.Status.QUEUED) assertThat(body.statusMessage()).contains("Commit successfully processed.") assertThat(body.storageUri()).isEqualTo("s3://...") @@ -211,7 +211,7 @@ class CommitCreateParamsTest { fun getPathParam() { val params = CommitCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pathProjectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( CommitCreateParams.Commit.builder() @@ -230,7 +230,7 @@ class CommitCreateParamsTest { .failingGoalCount(1L) .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .status(CommitCreateParams.Status.QUEUED) .statusMessage("Commit successfully processed.") .storageUri("s3://...") @@ -239,7 +239,7 @@ class CommitCreateParamsTest { .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .build() assertThat(params).isNotNull - // path param "projectId" + // path param "pathProjectId" assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") // out-of-bound path param assertThat(params.getPathParam(1)).isEqualTo("") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt index 9e75a5be..190d61f5 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt @@ -6,7 +6,7 @@ import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class CommitCreateResponseTest { +internal class CommitCreateResponseTest { @Test fun createCommitCreateResponse() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListParamsTest.kt index 634d5133..fc48ccc6 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListParamsTest.kt @@ -6,7 +6,7 @@ import com.openlayer.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class CommitListParamsTest { +internal class CommitListParamsTest { @Test fun create() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt index 8ba1ffeb..eef2969a 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt @@ -6,7 +6,7 @@ import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class CommitListResponseTest { +internal class CommitListResponseTest { @Test fun createCommitListResponse() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt index 7e7edb18..f4e460a6 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt @@ -8,12 +8,12 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class InferencePipelineCreateParamsTest { +internal class InferencePipelineCreateParamsTest { @Test fun create() { InferencePipelineCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pathProjectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -31,7 +31,7 @@ class InferencePipelineCreateParamsTest { ) .name("production") .passingGoalCount(5L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .status(InferencePipelineCreateParams.Status.QUEUED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) @@ -109,7 +109,7 @@ class InferencePipelineCreateParamsTest { fun body() { val params = InferencePipelineCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pathProjectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -127,7 +127,7 @@ class InferencePipelineCreateParamsTest { ) .name("production") .passingGoalCount(5L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .status(InferencePipelineCreateParams.Status.QUEUED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) @@ -224,7 +224,7 @@ class InferencePipelineCreateParamsTest { ) assertThat(body.name()).isEqualTo("production") assertThat(body.passingGoalCount()).isEqualTo(5L) - assertThat(body.projectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.bodyProjectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.status()).isEqualTo(InferencePipelineCreateParams.Status.QUEUED) assertThat(body.statusMessage()).contains("Tests successfully evaluated") assertThat(body.totalGoalCount()).isEqualTo(6L) @@ -303,7 +303,7 @@ class InferencePipelineCreateParamsTest { fun bodyWithoutOptionalFields() { val params = InferencePipelineCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pathProjectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -321,7 +321,7 @@ class InferencePipelineCreateParamsTest { ) .name("production") .passingGoalCount(5L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .status(InferencePipelineCreateParams.Status.QUEUED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) @@ -351,7 +351,7 @@ class InferencePipelineCreateParamsTest { ) assertThat(body.name()).isEqualTo("production") assertThat(body.passingGoalCount()).isEqualTo(5L) - assertThat(body.projectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.bodyProjectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.status()).isEqualTo(InferencePipelineCreateParams.Status.QUEUED) assertThat(body.statusMessage()).contains("Tests successfully evaluated") assertThat(body.totalGoalCount()).isEqualTo(6L) @@ -361,7 +361,7 @@ class InferencePipelineCreateParamsTest { fun getPathParam() { val params = InferencePipelineCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pathProjectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -379,13 +379,13 @@ class InferencePipelineCreateParamsTest { ) .name("production") .passingGoalCount(5L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .status(InferencePipelineCreateParams.Status.QUEUED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .build() assertThat(params).isNotNull - // path param "projectId" + // path param "pathProjectId" assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") // out-of-bound path param assertThat(params.getPathParam(1)).isEqualTo("") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt index 38e7509f..bc1d786f 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt @@ -7,7 +7,7 @@ import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class InferencePipelineCreateResponseTest { +internal class InferencePipelineCreateResponseTest { @Test fun createInferencePipelineCreateResponse() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParamsTest.kt index 7f12713c..3621d38e 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParamsTest.kt @@ -6,7 +6,7 @@ import com.openlayer.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class InferencePipelineListParamsTest { +internal class InferencePipelineListParamsTest { @Test fun create() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt index 8fa21074..e33f2621 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt @@ -7,7 +7,7 @@ import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class InferencePipelineListResponseTest { +internal class InferencePipelineListResponseTest { @Test fun createInferencePipelineListResponse() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParamsTest.kt index fac4f9ff..58ed9d31 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParamsTest.kt @@ -6,7 +6,7 @@ import com.openlayer.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class PresignedUrlCreateParamsTest { +internal class PresignedUrlCreateParamsTest { @Test fun create() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponseTest.kt index f062a9e9..7de37b91 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponseTest.kt @@ -6,7 +6,7 @@ import com.openlayer.api.core.JsonValue import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class PresignedUrlCreateResponseTest { +internal class PresignedUrlCreateResponseTest { @Test fun createPresignedUrlCreateResponse() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt index a04cb4db..951d0b2d 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt @@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @WireMockTest -class ErrorHandlingTest { +internal class ErrorHandlingTest { companion object { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/CommitServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/CommitServiceAsyncTest.kt index dade0f9d..9696a52f 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/CommitServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/CommitServiceAsyncTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class CommitServiceAsyncTest { +internal class CommitServiceAsyncTest { @Test fun retrieve() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncTest.kt index c1fce262..31daf776 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncTest.kt @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class InferencePipelineServiceAsyncTest { +internal class InferencePipelineServiceAsyncTest { @Test fun retrieve() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncTest.kt index c63b6596..428155bf 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncTest.kt @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class ProjectServiceAsyncTest { +internal class ProjectServiceAsyncTest { @Test fun create() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt index b9d12301..afbe6fc3 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class TestResultServiceAsyncTest { +internal class TestResultServiceAsyncTest { @Test fun list() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsyncTest.kt index 8062d7a3..e1a0cce4 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsyncTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class DataServiceAsyncTest { +internal class DataServiceAsyncTest { @Test fun stream() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsyncTest.kt index cb6b7894..539670bc 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsyncTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class RowServiceAsyncTest { +internal class RowServiceAsyncTest { @Test fun update() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncTest.kt index fa3abb77..b939f9d0 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class TestResultServiceAsyncTest { +internal class TestResultServiceAsyncTest { @Test fun list() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt index a5be2c6d..9c5c3e00 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class CommitServiceAsyncTest { +internal class CommitServiceAsyncTest { @Test fun create() { @@ -25,7 +25,7 @@ class CommitServiceAsyncTest { val commitFuture = commitServiceAsync.create( CommitCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pathProjectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( CommitCreateParams.Commit.builder() @@ -48,7 +48,7 @@ class CommitServiceAsyncTest { .failingGoalCount(1L) .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .status(CommitCreateParams.Status.QUEUED) .statusMessage("Commit successfully processed.") .storageUri("s3://...") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt index d23f1d0f..4455075e 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt @@ -12,7 +12,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class InferencePipelineServiceAsyncTest { +internal class InferencePipelineServiceAsyncTest { @Test fun create() { @@ -26,7 +26,7 @@ class InferencePipelineServiceAsyncTest { val inferencePipelineFuture = inferencePipelineServiceAsync.create( InferencePipelineCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pathProjectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -44,7 +44,7 @@ class InferencePipelineServiceAsyncTest { ) .name("production") .passingGoalCount(5L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .status(InferencePipelineCreateParams.Status.QUEUED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncTest.kt index c8ffdc74..e98d12f7 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class PresignedUrlServiceAsyncTest { +internal class PresignedUrlServiceAsyncTest { @Test fun create() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt index 0d98e9d6..d9235637 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class CommitServiceTest { +internal class CommitServiceTest { @Test fun retrieve() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt index 6b168a1a..ce6a6507 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class InferencePipelineServiceTest { +internal class InferencePipelineServiceTest { @Test fun retrieve() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt index a5342433..7cc888fb 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class ProjectServiceTest { +internal class ProjectServiceTest { @Test fun create() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt index 75435126..b17bc64c 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class TestResultServiceTest { +internal class TestResultServiceTest { @Test fun list() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataServiceTest.kt index a8762af1..fc46b195 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataServiceTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class DataServiceTest { +internal class DataServiceTest { @Test fun stream() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowServiceTest.kt index 9b43392b..847f7b18 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowServiceTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class RowServiceTest { +internal class RowServiceTest { @Test fun update() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceTest.kt index 2be47030..b8662c51 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class TestResultServiceTest { +internal class TestResultServiceTest { @Test fun list() { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt index e94a74c2..9c7ca4f0 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class CommitServiceTest { +internal class CommitServiceTest { @Test fun create() { @@ -25,7 +25,7 @@ class CommitServiceTest { val commit = commitService.create( CommitCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pathProjectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .commit( CommitCreateParams.Commit.builder() @@ -48,7 +48,7 @@ class CommitServiceTest { .failingGoalCount(1L) .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .status(CommitCreateParams.Status.QUEUED) .statusMessage("Commit successfully processed.") .storageUri("s3://...") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt index 56d21e5a..8d83721f 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt @@ -12,7 +12,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class InferencePipelineServiceTest { +internal class InferencePipelineServiceTest { @Test fun create() { @@ -26,7 +26,7 @@ class InferencePipelineServiceTest { val inferencePipeline = inferencePipelineService.create( InferencePipelineCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pathProjectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -44,7 +44,7 @@ class InferencePipelineServiceTest { ) .name("production") .passingGoalCount(5L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .status(InferencePipelineCreateParams.Status.QUEUED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt index 33d211f8..f165113e 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class PresignedUrlServiceTest { +internal class PresignedUrlServiceTest { @Test fun create() { From e6da0bfc278f0405e7a875e53574abff11033bea Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Mar 2025 21:28:52 +0000 Subject: [PATCH 20/74] docs: add `build` method comments (#86) --- .../client/okhttp/OpenlayerOkHttpClient.kt | 5 + .../okhttp/OpenlayerOkHttpClientAsync.kt | 5 + .../com/openlayer/api/core/ClientOptions.kt | 12 ++ .../kotlin/com/openlayer/api/core/Timeout.kt | 5 + .../openlayer/api/errors/OpenlayerError.kt | 5 + .../models/commits/CommitRetrieveParams.kt | 12 ++ .../models/commits/CommitRetrieveResponse.kt | 56 +++++++ .../testresults/TestResultListParams.kt | 12 ++ .../testresults/TestResultListResponse.kt | 62 +++++++ .../InferencePipelineDeleteParams.kt | 12 ++ .../InferencePipelineRetrieveParams.kt | 12 ++ .../InferencePipelineRetrieveResponse.kt | 124 ++++++++++++++ .../InferencePipelineUpdateParams.kt | 17 ++ .../InferencePipelineUpdateResponse.kt | 124 ++++++++++++++ .../data/DataStreamParams.kt | 78 +++++++++ .../data/DataStreamResponse.kt | 12 ++ .../rows/RowUpdateParams.kt | 31 ++++ .../rows/RowUpdateResponse.kt | 12 ++ .../testresults/TestResultListParams.kt | 12 ++ .../testresults/TestResultListResponse.kt | 62 +++++++ .../models/projects/ProjectCreateParams.kt | 83 ++++++++++ .../models/projects/ProjectCreateResponse.kt | 58 +++++++ .../api/models/projects/ProjectListParams.kt | 5 + .../models/projects/ProjectListResponse.kt | 70 ++++++++ .../projects/commits/CommitCreateParams.kt | 82 ++++++++++ .../projects/commits/CommitCreateResponse.kt | 56 +++++++ .../projects/commits/CommitListParams.kt | 12 ++ .../projects/commits/CommitListResponse.kt | 68 ++++++++ .../InferencePipelineCreateParams.kt | 151 ++++++++++++++++++ .../InferencePipelineCreateResponse.kt | 124 ++++++++++++++ .../InferencePipelineListParams.kt | 12 ++ .../InferencePipelineListResponse.kt | 136 ++++++++++++++++ .../presignedurl/PresignedUrlCreateParams.kt | 12 ++ .../PresignedUrlCreateResponse.kt | 13 ++ 34 files changed, 1552 insertions(+) diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt index f322838c..3c01aaec 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt @@ -151,6 +151,11 @@ class OpenlayerOkHttpClient private constructor() { fun fromEnv() = apply { clientOptions.fromEnv() } + /** + * Returns an immutable instance of [OpenlayerClient]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): OpenlayerClient = OpenlayerClientImpl( clientOptions diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt index 9118c3b6..aa03f9cd 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt @@ -153,6 +153,11 @@ class OpenlayerOkHttpClientAsync private constructor() { fun fromEnv() = apply { clientOptions.fromEnv() } + /** + * Returns an immutable instance of [OpenlayerClientAsync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): OpenlayerClientAsync = OpenlayerClientAsyncImpl( clientOptions diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt index b22b2b18..b1c17e43 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt @@ -179,6 +179,18 @@ private constructor( fun fromEnv() = apply { System.getenv("OPENLAYER_API_KEY")?.let { apiKey(it) } } + /** + * Returns an immutable instance of [ClientOptions]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .httpClient() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): ClientOptions { val httpClient = checkRequired("httpClient", httpClient) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Timeout.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Timeout.kt index 5cdd099f..e07cad54 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Timeout.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Timeout.kt @@ -132,6 +132,11 @@ private constructor( /** Alias for calling [Builder.request] with `request.orElse(null)`. */ fun request(request: Optional) = request(request.getOrNull()) + /** + * Returns an immutable instance of [Timeout]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Timeout = Timeout(connect, read, write, request) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt index 76f53c88..c6b6dad2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt @@ -60,6 +60,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [OpenlayerError]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): OpenlayerError = OpenlayerError(additionalProperties.toImmutable()) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveParams.kt index ea0ddb37..13f08848 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveParams.kt @@ -166,6 +166,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [CommitRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .projectVersionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): CommitRetrieveParams = CommitRetrieveParams( checkRequired("projectVersionId", projectVersionId), diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt index 633c1d9e..16eef454 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt @@ -737,6 +737,31 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [CommitRetrieveResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .commit() + * .dateArchived() + * .dateCreated() + * .failingGoalCount() + * .mlModelId() + * .passingGoalCount() + * .projectId() + * .status() + * .statusMessage() + * .storageUri() + * .totalGoalCount() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): CommitRetrieveResponse = CommitRetrieveResponse( checkRequired("id", id), @@ -1293,6 +1318,25 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Commit]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .authorId() + * .fileSize() + * .message() + * .mlModelId() + * .storageUri() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Commit = Commit( checkRequired("id", id), @@ -1551,6 +1595,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Links]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .app() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Links = Links(checkRequired("app", app), additionalProperties.toImmutable()) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt index b5df591f..d4304a15 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt @@ -277,6 +277,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [TestResultListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .projectVersionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): TestResultListParams = TestResultListParams( checkRequired("projectVersionId", projectVersionId), diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt index 7c3f4fe0..c52ee6fd 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt @@ -139,6 +139,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [TestResultListResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): TestResultListResponse = TestResultListResponse( checkRequired("items", items).map { it.toImmutable() }, @@ -647,6 +659,26 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Item]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateDataEnds() + * .dateDataStarts() + * .dateUpdated() + * .inferencePipelineId() + * .projectVersionId() + * .status() + * .statusMessage() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Item = Item( checkRequired("id", id), @@ -1725,6 +1757,31 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Goal]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .commentCount() + * .creatorId() + * .dateArchived() + * .dateCreated() + * .dateUpdated() + * .description() + * .name() + * .number() + * .originProjectVersionId() + * .subtype() + * .suggested() + * .thresholds() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Goal = Goal( checkRequired("id", id), @@ -2025,6 +2082,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Threshold]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Threshold = Threshold( insightName, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt index 26c08a75..a9964443 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt @@ -202,6 +202,18 @@ private constructor( keys.forEach(::removeAdditionalBodyProperty) } + /** + * Returns an immutable instance of [InferencePipelineDeleteParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .inferencePipelineId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): InferencePipelineDeleteParams = InferencePipelineDeleteParams( checkRequired("inferencePipelineId", inferencePipelineId), diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt index 8b8bd60f..ea7de80b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt @@ -202,6 +202,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [InferencePipelineRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .inferencePipelineId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): InferencePipelineRetrieveParams = InferencePipelineRetrieveParams( checkRequired("inferencePipelineId", inferencePipelineId), diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt index eab69602..28df1f63 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt @@ -763,6 +763,32 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [InferencePipelineRetrieveResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateLastEvaluated() + * .dateLastSampleReceived() + * .dateOfNextEvaluation() + * .dateUpdated() + * .description() + * .failingGoalCount() + * .links() + * .name() + * .passingGoalCount() + * .projectId() + * .status() + * .statusMessage() + * .totalGoalCount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): InferencePipelineRetrieveResponse = InferencePipelineRetrieveResponse( checkRequired("id", id), @@ -881,6 +907,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Links]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .app() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Links = Links(checkRequired("app", app), additionalProperties.toImmutable()) } @@ -1686,6 +1724,31 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Project]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Project = Project( checkRequired("id", id), @@ -1809,6 +1872,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Links]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .app() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Links = Links(checkRequired("app", app), additionalProperties.toImmutable()) } @@ -2524,6 +2599,27 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [GitRepo]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateConnected() + * .dateUpdated() + * .gitAccountId() + * .gitId() + * .name() + * .private_() + * .projectId() + * .slug() + * .url() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): GitRepo = GitRepo( checkRequired("id", id), @@ -3262,6 +3358,29 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Workspace]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .inviteCount() + * .memberCount() + * .name() + * .periodEndDate() + * .periodStartDate() + * .projectCount() + * .slug() + * .status() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Workspace = Workspace( checkRequired("id", id), @@ -3608,6 +3727,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [MonthlyUsage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): MonthlyUsage = MonthlyUsage( executionTimeMs, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt index 0c244a8e..fc06e1e9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt @@ -283,6 +283,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Body = Body(description, name, referenceDatasetUri, additionalProperties.toImmutable()) } @@ -510,6 +515,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [InferencePipelineUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .inferencePipelineId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): InferencePipelineUpdateParams = InferencePipelineUpdateParams( checkRequired("inferencePipelineId", inferencePipelineId), diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt index a3937dc9..c6eaa8a7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt @@ -763,6 +763,32 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [InferencePipelineUpdateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateLastEvaluated() + * .dateLastSampleReceived() + * .dateOfNextEvaluation() + * .dateUpdated() + * .description() + * .failingGoalCount() + * .links() + * .name() + * .passingGoalCount() + * .projectId() + * .status() + * .statusMessage() + * .totalGoalCount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): InferencePipelineUpdateResponse = InferencePipelineUpdateResponse( checkRequired("id", id), @@ -881,6 +907,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Links]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .app() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Links = Links(checkRequired("app", app), additionalProperties.toImmutable()) } @@ -1686,6 +1724,31 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Project]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Project = Project( checkRequired("id", id), @@ -1809,6 +1872,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Links]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .app() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Links = Links(checkRequired("app", app), additionalProperties.toImmutable()) } @@ -2524,6 +2599,27 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [GitRepo]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateConnected() + * .dateUpdated() + * .gitAccountId() + * .gitId() + * .name() + * .private_() + * .projectId() + * .slug() + * .url() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): GitRepo = GitRepo( checkRequired("id", id), @@ -3262,6 +3358,29 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Workspace]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .inviteCount() + * .memberCount() + * .name() + * .periodEndDate() + * .periodStartDate() + * .projectCount() + * .slug() + * .status() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Workspace = Workspace( checkRequired("id", id), @@ -3608,6 +3727,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [MonthlyUsage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): MonthlyUsage = MonthlyUsage( executionTimeMs, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt index 4b533336..b686c7a2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt @@ -264,6 +264,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .config() + * .rows() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Body = Body( checkRequired("config", config), @@ -500,6 +513,20 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [DataStreamParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .inferencePipelineId() + * .config() + * .rows() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): DataStreamParams = DataStreamParams( checkRequired("inferencePipelineId", inferencePipelineId), @@ -1281,6 +1308,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [LlmData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .outputColumnName() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): LlmData = LlmData( checkRequired("outputColumnName", outputColumnName), @@ -1430,6 +1469,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Prompt]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Prompt = Prompt(content, role, additionalProperties.toImmutable()) } @@ -1977,6 +2021,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [TabularClassificationData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .classNames() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): TabularClassificationData = TabularClassificationData( checkRequired("classNames", classNames).map { it.toImmutable() }, @@ -2407,6 +2463,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [TabularRegressionData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): TabularRegressionData = TabularRegressionData( (categoricalFeatureNames ?: JsonMissing.of()).map { it.toImmutable() }, @@ -2875,6 +2936,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [TextClassificationData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .classNames() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): TextClassificationData = TextClassificationData( checkRequired("classNames", classNames).map { it.toImmutable() }, @@ -2968,6 +3041,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Row]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Row = Row(additionalProperties.toImmutable()) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt index 004ade87..fa5e0cbc 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt @@ -112,6 +112,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [DataStreamResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .success() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): DataStreamResponse = DataStreamResponse( checkRequired("success", success), diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt index c9f87af9..4524f9f8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt @@ -182,6 +182,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .row() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Body = Body(checkRequired("row", row), config, additionalProperties.toImmutable()) } @@ -379,6 +391,20 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [RowUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .inferencePipelineId() + * .inferenceId() + * .row() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): RowUpdateParams = RowUpdateParams( checkRequired("inferencePipelineId", inferencePipelineId), @@ -690,6 +716,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Config]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Config = Config( groundTruthColumnName, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt index 1f3ca3e2..c857c633 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt @@ -112,6 +112,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [RowUpdateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .success() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): RowUpdateResponse = RowUpdateResponse(checkRequired("success", success), additionalProperties.toImmutable()) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt index 26636297..403682e9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt @@ -254,6 +254,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [TestResultListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .inferencePipelineId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): TestResultListParams = TestResultListParams( checkRequired("inferencePipelineId", inferencePipelineId), diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt index 50c7cfa7..0db24df5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt @@ -139,6 +139,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [TestResultListResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): TestResultListResponse = TestResultListResponse( checkRequired("items", items).map { it.toImmutable() }, @@ -647,6 +659,26 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Item]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateDataEnds() + * .dateDataStarts() + * .dateUpdated() + * .inferencePipelineId() + * .projectVersionId() + * .status() + * .statusMessage() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Item = Item( checkRequired("id", id), @@ -1725,6 +1757,31 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Goal]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .commentCount() + * .creatorId() + * .dateArchived() + * .dateCreated() + * .dateUpdated() + * .description() + * .name() + * .number() + * .originProjectVersionId() + * .subtype() + * .suggested() + * .thresholds() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Goal = Goal( checkRequired("id", id), @@ -2025,6 +2082,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Threshold]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Threshold = Threshold( insightName, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt index 0c6b92e7..49da43f3 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt @@ -944,6 +944,31 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Body = Body( checkRequired("id", id), @@ -1360,6 +1385,31 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [ProjectCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): ProjectCreateParams = ProjectCreateParams( body.build(), @@ -1463,6 +1513,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Links]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .app() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Links = Links(checkRequired("app", app), additionalProperties.toImmutable()) } @@ -2150,6 +2212,27 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [GitRepo]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateConnected() + * .dateUpdated() + * .gitAccountId() + * .gitId() + * .name() + * .private_() + * .projectId() + * .slug() + * .url() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): GitRepo = GitRepo( checkRequired("id", id), diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt index 905c710c..9cf60b18 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt @@ -658,6 +658,31 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [ProjectCreateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): ProjectCreateResponse = ProjectCreateResponse( checkRequired("id", id), @@ -775,6 +800,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Links]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .app() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Links = Links(checkRequired("app", app), additionalProperties.toImmutable()) } @@ -1462,6 +1499,27 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [GitRepo]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateConnected() + * .dateUpdated() + * .gitAccountId() + * .gitId() + * .name() + * .private_() + * .projectId() + * .slug() + * .url() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): GitRepo = GitRepo( checkRequired("id", id), diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt index f4f25a60..c3e657d5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt @@ -220,6 +220,11 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [ProjectListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): ProjectListParams = ProjectListParams( name, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt index 8da10652..42dba5b2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt @@ -129,6 +129,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [ProjectListResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): ProjectListResponse = ProjectListResponse( checkRequired("items", items).map { it.toImmutable() }, @@ -795,6 +807,31 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Item]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Item = Item( checkRequired("id", id), @@ -918,6 +955,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Links]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .app() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Links = Links(checkRequired("app", app), additionalProperties.toImmutable()) } @@ -1633,6 +1682,27 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [GitRepo]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateConnected() + * .dateUpdated() + * .gitAccountId() + * .gitId() + * .name() + * .private_() + * .projectId() + * .slug() + * .url() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): GitRepo = GitRepo( checkRequired("id", id), diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt index 03135c92..39fe52fc 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt @@ -1049,6 +1049,31 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .commit() + * .dateArchived() + * .dateCreated() + * .failingGoalCount() + * .mlModelId() + * .passingGoalCount() + * .bodyProjectId() + * .status() + * .statusMessage() + * .storageUri() + * .totalGoalCount() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Body = Body( checkRequired("id", id), @@ -1518,6 +1543,32 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [CommitCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .pathProjectId() + * .id() + * .commit() + * .dateArchived() + * .dateCreated() + * .failingGoalCount() + * .mlModelId() + * .passingGoalCount() + * .bodyProjectId() + * .status() + * .statusMessage() + * .storageUri() + * .totalGoalCount() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): CommitCreateParams = CommitCreateParams( checkRequired("pathProjectId", pathProjectId), @@ -2060,6 +2111,25 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Commit]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .authorId() + * .fileSize() + * .message() + * .mlModelId() + * .storageUri() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Commit = Commit( checkRequired("id", id), @@ -2318,6 +2388,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Links]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .app() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Links = Links(checkRequired("app", app), additionalProperties.toImmutable()) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt index 87773c0e..2a9eee83 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt @@ -737,6 +737,31 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [CommitCreateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .commit() + * .dateArchived() + * .dateCreated() + * .failingGoalCount() + * .mlModelId() + * .passingGoalCount() + * .projectId() + * .status() + * .statusMessage() + * .storageUri() + * .totalGoalCount() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): CommitCreateResponse = CommitCreateResponse( checkRequired("id", id), @@ -1293,6 +1318,25 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Commit]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .authorId() + * .fileSize() + * .message() + * .mlModelId() + * .storageUri() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Commit = Commit( checkRequired("id", id), @@ -1551,6 +1595,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Links]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .app() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Links = Links(checkRequired("app", app), additionalProperties.toImmutable()) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt index fde2ba6e..03099fc4 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt @@ -210,6 +210,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [CommitListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .projectId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): CommitListParams = CommitListParams( checkRequired("projectId", projectId), diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt index 2a571c5f..5f49d717 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt @@ -129,6 +129,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [CommitListResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): CommitListResponse = CommitListResponse( checkRequired("items", items).map { it.toImmutable() }, @@ -867,6 +879,31 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Item]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .commit() + * .dateArchived() + * .dateCreated() + * .failingGoalCount() + * .mlModelId() + * .passingGoalCount() + * .projectId() + * .status() + * .statusMessage() + * .storageUri() + * .totalGoalCount() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Item = Item( checkRequired("id", id), @@ -1444,6 +1481,25 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Commit]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .authorId() + * .fileSize() + * .message() + * .mlModelId() + * .storageUri() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Commit = Commit( checkRequired("id", id), @@ -1710,6 +1766,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Links]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .app() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Links = Links(checkRequired("app", app), additionalProperties.toImmutable()) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt index f1606c15..3d0671be 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt @@ -1092,6 +1092,32 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateLastEvaluated() + * .dateLastSampleReceived() + * .dateOfNextEvaluation() + * .dateUpdated() + * .description() + * .failingGoalCount() + * .links() + * .name() + * .passingGoalCount() + * .bodyProjectId() + * .status() + * .statusMessage() + * .totalGoalCount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Body = Body( checkRequired("id", id), @@ -1570,6 +1596,33 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [InferencePipelineCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .pathProjectId() + * .id() + * .dateCreated() + * .dateLastEvaluated() + * .dateLastSampleReceived() + * .dateOfNextEvaluation() + * .dateUpdated() + * .description() + * .failingGoalCount() + * .links() + * .name() + * .passingGoalCount() + * .bodyProjectId() + * .status() + * .statusMessage() + * .totalGoalCount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): InferencePipelineCreateParams = InferencePipelineCreateParams( checkRequired("pathProjectId", pathProjectId), @@ -1673,6 +1726,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Links]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .app() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Links = Links(checkRequired("app", app), additionalProperties.toImmutable()) } @@ -2478,6 +2543,31 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Project]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Project = Project( checkRequired("id", id), @@ -2601,6 +2691,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Links]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .app() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Links = Links(checkRequired("app", app), additionalProperties.toImmutable()) } @@ -3316,6 +3418,27 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [GitRepo]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateConnected() + * .dateUpdated() + * .gitAccountId() + * .gitId() + * .name() + * .private_() + * .projectId() + * .slug() + * .url() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): GitRepo = GitRepo( checkRequired("id", id), @@ -4054,6 +4177,29 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Workspace]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .inviteCount() + * .memberCount() + * .name() + * .periodEndDate() + * .periodStartDate() + * .projectCount() + * .slug() + * .status() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Workspace = Workspace( checkRequired("id", id), @@ -4400,6 +4546,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [MonthlyUsage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): MonthlyUsage = MonthlyUsage( executionTimeMs, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt index 73ceafa1..acca9b95 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt @@ -763,6 +763,32 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [InferencePipelineCreateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateLastEvaluated() + * .dateLastSampleReceived() + * .dateOfNextEvaluation() + * .dateUpdated() + * .description() + * .failingGoalCount() + * .links() + * .name() + * .passingGoalCount() + * .projectId() + * .status() + * .statusMessage() + * .totalGoalCount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): InferencePipelineCreateResponse = InferencePipelineCreateResponse( checkRequired("id", id), @@ -881,6 +907,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Links]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .app() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Links = Links(checkRequired("app", app), additionalProperties.toImmutable()) } @@ -1686,6 +1724,31 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Project]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Project = Project( checkRequired("id", id), @@ -1809,6 +1872,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Links]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .app() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Links = Links(checkRequired("app", app), additionalProperties.toImmutable()) } @@ -2524,6 +2599,27 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [GitRepo]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateConnected() + * .dateUpdated() + * .gitAccountId() + * .gitId() + * .name() + * .private_() + * .projectId() + * .slug() + * .url() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): GitRepo = GitRepo( checkRequired("id", id), @@ -3262,6 +3358,29 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Workspace]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .inviteCount() + * .memberCount() + * .name() + * .periodEndDate() + * .periodStartDate() + * .projectCount() + * .slug() + * .status() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Workspace = Workspace( checkRequired("id", id), @@ -3608,6 +3727,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [MonthlyUsage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): MonthlyUsage = MonthlyUsage( executionTimeMs, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt index b766e29e..555fb035 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt @@ -223,6 +223,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [InferencePipelineListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .projectId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): InferencePipelineListParams = InferencePipelineListParams( checkRequired("projectId", projectId), diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt index fb2084e8..459a7b75 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt @@ -131,6 +131,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [InferencePipelineListResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): InferencePipelineListResponse = InferencePipelineListResponse( checkRequired("items", items).map { it.toImmutable() }, @@ -900,6 +912,32 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Item]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateLastEvaluated() + * .dateLastSampleReceived() + * .dateOfNextEvaluation() + * .dateUpdated() + * .description() + * .failingGoalCount() + * .links() + * .name() + * .passingGoalCount() + * .projectId() + * .status() + * .statusMessage() + * .totalGoalCount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Item = Item( checkRequired("id", id), @@ -1024,6 +1062,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Links]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .app() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Links = Links(checkRequired("app", app), additionalProperties.toImmutable()) } @@ -1866,6 +1916,31 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Project]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Project = Project( checkRequired("id", id), @@ -1989,6 +2064,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Links]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .app() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Links = Links(checkRequired("app", app), additionalProperties.toImmutable()) } @@ -2719,6 +2806,27 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [GitRepo]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateConnected() + * .dateUpdated() + * .gitAccountId() + * .gitId() + * .name() + * .private_() + * .projectId() + * .slug() + * .url() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): GitRepo = GitRepo( checkRequired("id", id), @@ -3490,6 +3598,29 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Workspace]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .inviteCount() + * .memberCount() + * .name() + * .periodEndDate() + * .periodStartDate() + * .projectCount() + * .slug() + * .status() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Workspace = Workspace( checkRequired("id", id), @@ -3839,6 +3970,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [MonthlyUsage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): MonthlyUsage = MonthlyUsage( executionTimeMs, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt index 57edf541..323f5c27 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt @@ -199,6 +199,18 @@ private constructor( keys.forEach(::removeAdditionalBodyProperty) } + /** + * Returns an immutable instance of [PresignedUrlCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .objectName() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): PresignedUrlCreateParams = PresignedUrlCreateParams( checkRequired("objectName", objectName), diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt index 3077cd63..94e76f11 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt @@ -155,6 +155,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PresignedUrlCreateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .storageUri() + * .url() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): PresignedUrlCreateResponse = PresignedUrlCreateResponse( checkRequired("storageUri", storageUri), From 301bc32db49ad7d0b417b98996f11ed445c2501c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 03:14:54 +0000 Subject: [PATCH 21/74] chore(internal): refactor query param serialization impl and tests (#87) --- .../testresults/TestResultListParams.kt | 21 ++++++++------- .../InferencePipelineRetrieveParams.kt | 13 +++++----- .../rows/RowUpdateParams.kt | 13 +++++----- .../testresults/TestResultListParams.kt | 19 +++++++------- .../api/models/projects/ProjectListParams.kt | 19 +++++++------- .../projects/commits/CommitListParams.kt | 15 ++++++----- .../InferencePipelineListParams.kt | 17 ++++++------ .../presignedurl/PresignedUrlCreateParams.kt | 13 +++++----- .../testresults/TestResultListParamsTest.kt | 26 ++++++++++++------- .../InferencePipelineRetrieveParamsTest.kt | 16 ++++++++---- .../rows/RowUpdateParamsTest.kt | 16 +++++++----- .../testresults/TestResultListParamsTest.kt | 24 +++++++++++------ .../models/projects/ProjectListParamsTest.kt | 24 +++++++++++------ .../projects/commits/CommitListParamsTest.kt | 15 ++++++----- .../InferencePipelineListParamsTest.kt | 22 +++++++++++----- .../PresignedUrlCreateParamsTest.kt | 16 +++++++----- 16 files changed, 173 insertions(+), 116 deletions(-) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt index d4304a15..48340c7b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt @@ -57,16 +57,17 @@ private constructor( override fun _headers(): Headers = additionalHeaders - override fun _queryParams(): QueryParams { - val queryParams = QueryParams.builder() - this.includeArchived?.let { queryParams.put("includeArchived", listOf(it.toString())) } - this.page?.let { queryParams.put("page", listOf(it.toString())) } - this.perPage?.let { queryParams.put("perPage", listOf(it.toString())) } - this.status?.let { queryParams.put("status", listOf(it.toString())) } - this.type?.let { queryParams.put("type", listOf(it.toString())) } - queryParams.putAll(additionalQueryParams) - return queryParams.build() - } + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + includeArchived?.let { put("includeArchived", it.toString()) } + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + status?.let { put("status", it.asString()) } + type?.let { put("type", it.asString()) } + putAll(additionalQueryParams) + } + .build() fun getPathParam(index: Int): String { return when (index) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt index ea7de80b..08ac66a4 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt @@ -36,12 +36,13 @@ private constructor( override fun _headers(): Headers = additionalHeaders - override fun _queryParams(): QueryParams { - val queryParams = QueryParams.builder() - this.expand?.let { queryParams.put("expand", listOf(it.joinToString(separator = ","))) } - queryParams.putAll(additionalQueryParams) - return queryParams.build() - } + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + expand?.let { put("expand", it.joinToString(",") { it.asString() }) } + putAll(additionalQueryParams) + } + .build() fun getPathParam(index: Int): String { return when (index) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt index 4524f9f8..59cce0e5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt @@ -62,12 +62,13 @@ private constructor( override fun _headers(): Headers = additionalHeaders - override fun _queryParams(): QueryParams { - val queryParams = QueryParams.builder() - this.inferenceId.let { queryParams.put("inferenceId", listOf(it.toString())) } - queryParams.putAll(additionalQueryParams) - return queryParams.build() - } + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + put("inferenceId", inferenceId) + putAll(additionalQueryParams) + } + .build() fun getPathParam(index: Int): String { return when (index) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt index 403682e9..7c241f3d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt @@ -53,15 +53,16 @@ private constructor( override fun _headers(): Headers = additionalHeaders - override fun _queryParams(): QueryParams { - val queryParams = QueryParams.builder() - this.page?.let { queryParams.put("page", listOf(it.toString())) } - this.perPage?.let { queryParams.put("perPage", listOf(it.toString())) } - this.status?.let { queryParams.put("status", listOf(it.toString())) } - this.type?.let { queryParams.put("type", listOf(it.toString())) } - queryParams.putAll(additionalQueryParams) - return queryParams.build() - } + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + status?.let { put("status", it.asString()) } + type?.let { put("type", it.asString()) } + putAll(additionalQueryParams) + } + .build() fun getPathParam(index: Int): String { return when (index) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt index c3e657d5..1ce8fd00 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt @@ -43,15 +43,16 @@ private constructor( override fun _headers(): Headers = additionalHeaders - override fun _queryParams(): QueryParams { - val queryParams = QueryParams.builder() - this.name?.let { queryParams.put("name", listOf(it.toString())) } - this.page?.let { queryParams.put("page", listOf(it.toString())) } - this.perPage?.let { queryParams.put("perPage", listOf(it.toString())) } - this.taskType?.let { queryParams.put("taskType", listOf(it.toString())) } - queryParams.putAll(additionalQueryParams) - return queryParams.build() - } + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + name?.let { put("name", it) } + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + taskType?.let { put("taskType", it.asString()) } + putAll(additionalQueryParams) + } + .build() fun toBuilder() = Builder().from(this) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt index 03099fc4..9abe9250 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt @@ -35,13 +35,14 @@ private constructor( override fun _headers(): Headers = additionalHeaders - override fun _queryParams(): QueryParams { - val queryParams = QueryParams.builder() - this.page?.let { queryParams.put("page", listOf(it.toString())) } - this.perPage?.let { queryParams.put("perPage", listOf(it.toString())) } - queryParams.putAll(additionalQueryParams) - return queryParams.build() - } + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + putAll(additionalQueryParams) + } + .build() fun getPathParam(index: Int): String { return when (index) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt index 555fb035..3128e663 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt @@ -39,14 +39,15 @@ private constructor( override fun _headers(): Headers = additionalHeaders - override fun _queryParams(): QueryParams { - val queryParams = QueryParams.builder() - this.name?.let { queryParams.put("name", listOf(it.toString())) } - this.page?.let { queryParams.put("page", listOf(it.toString())) } - this.perPage?.let { queryParams.put("perPage", listOf(it.toString())) } - queryParams.putAll(additionalQueryParams) - return queryParams.build() - } + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + name?.let { put("name", it) } + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + putAll(additionalQueryParams) + } + .build() fun getPathParam(index: Int): String { return when (index) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt index 323f5c27..95f39b35 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt @@ -36,12 +36,13 @@ private constructor( override fun _headers(): Headers = additionalHeaders - override fun _queryParams(): QueryParams { - val queryParams = QueryParams.builder() - this.objectName.let { queryParams.put("objectName", listOf(it.toString())) } - queryParams.putAll(additionalQueryParams) - return queryParams.build() - } + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + put("objectName", objectName) + putAll(additionalQueryParams) + } + .build() fun toBuilder() = Builder().from(this) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt index 9b524699..b9b5bcbf 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt @@ -31,13 +31,19 @@ internal class TestResultListParamsTest { .status(TestResultListParams.Status.RUNNING) .type(TestResultListParams.Type.INTEGRITY) .build() - val expected = QueryParams.builder() - expected.put("includeArchived", "true") - expected.put("page", "1") - expected.put("perPage", "1") - expected.put("status", TestResultListParams.Status.RUNNING.toString()) - expected.put("type", TestResultListParams.Type.INTEGRITY.toString()) - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("includeArchived", "true") + .put("page", "1") + .put("perPage", "1") + .put("status", "running") + .put("type", "integrity") + .build() + ) } @Test @@ -46,8 +52,10 @@ internal class TestResultListParamsTest { TestResultListParams.builder() .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() - val expected = QueryParams.builder() - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } @Test diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParamsTest.kt index 92d490a1..5526f8fd 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParamsTest.kt @@ -23,9 +23,13 @@ internal class InferencePipelineRetrieveParamsTest { .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addExpand(InferencePipelineRetrieveParams.Expand.PROJECT) .build() - val expected = QueryParams.builder() - expected.put("expand", InferencePipelineRetrieveParams.Expand.PROJECT.toString()) - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder().put("expand", listOf("project").joinToString(",")).build() + ) } @Test @@ -34,8 +38,10 @@ internal class InferencePipelineRetrieveParamsTest { InferencePipelineRetrieveParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() - val expected = QueryParams.builder() - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } @Test diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt index 94768893..b65df277 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt @@ -43,9 +43,11 @@ internal class RowUpdateParamsTest { .build() ) .build() - val expected = QueryParams.builder() - expected.put("inferenceId", "inferenceId") - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo(QueryParams.builder().put("inferenceId", "inferenceId").build()) } @Test @@ -56,9 +58,11 @@ internal class RowUpdateParamsTest { .inferenceId("inferenceId") .row(JsonValue.from(mapOf())) .build() - val expected = QueryParams.builder() - expected.put("inferenceId", "inferenceId") - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo(QueryParams.builder().put("inferenceId", "inferenceId").build()) } @Test diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt index 94baac03..ae05735a 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt @@ -29,12 +29,18 @@ internal class TestResultListParamsTest { .status(TestResultListParams.Status.RUNNING) .type(TestResultListParams.Type.INTEGRITY) .build() - val expected = QueryParams.builder() - expected.put("page", "1") - expected.put("perPage", "1") - expected.put("status", TestResultListParams.Status.RUNNING.toString()) - expected.put("type", TestResultListParams.Type.INTEGRITY.toString()) - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("page", "1") + .put("perPage", "1") + .put("status", "running") + .put("type", "integrity") + .build() + ) } @Test @@ -43,8 +49,10 @@ internal class TestResultListParamsTest { TestResultListParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() - val expected = QueryParams.builder() - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } @Test diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListParamsTest.kt index 2c31af92..3b17b106 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListParamsTest.kt @@ -27,18 +27,26 @@ internal class ProjectListParamsTest { .perPage(1L) .taskType(ProjectListParams.TaskType.LLM_BASE) .build() - val expected = QueryParams.builder() - expected.put("name", "name") - expected.put("page", "1") - expected.put("perPage", "1") - expected.put("taskType", ProjectListParams.TaskType.LLM_BASE.toString()) - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("name", "name") + .put("page", "1") + .put("perPage", "1") + .put("taskType", "llm-base") + .build() + ) } @Test fun queryParamsWithoutOptionalFields() { val params = ProjectListParams.builder().build() - val expected = QueryParams.builder() - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListParamsTest.kt index fc48ccc6..b9c162ff 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListParamsTest.kt @@ -25,18 +25,21 @@ internal class CommitListParamsTest { .page(1L) .perPage(1L) .build() - val expected = QueryParams.builder() - expected.put("page", "1") - expected.put("perPage", "1") - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo(QueryParams.builder().put("page", "1").put("perPage", "1").build()) } @Test fun queryParamsWithoutOptionalFields() { val params = CommitListParams.builder().projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() - val expected = QueryParams.builder() - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } @Test diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParamsTest.kt index 3621d38e..7fe89e33 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParamsTest.kt @@ -27,11 +27,17 @@ internal class InferencePipelineListParamsTest { .page(1L) .perPage(1L) .build() - val expected = QueryParams.builder() - expected.put("name", "name") - expected.put("page", "1") - expected.put("perPage", "1") - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("name", "name") + .put("page", "1") + .put("perPage", "1") + .build() + ) } @Test @@ -40,8 +46,10 @@ internal class InferencePipelineListParamsTest { InferencePipelineListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() - val expected = QueryParams.builder() - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } @Test diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParamsTest.kt index 58ed9d31..579b2247 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParamsTest.kt @@ -16,16 +16,20 @@ internal class PresignedUrlCreateParamsTest { @Test fun queryParams() { val params = PresignedUrlCreateParams.builder().objectName("objectName").build() - val expected = QueryParams.builder() - expected.put("objectName", "objectName") - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo(QueryParams.builder().put("objectName", "objectName").build()) } @Test fun queryParamsWithoutOptionalFields() { val params = PresignedUrlCreateParams.builder().objectName("objectName").build() - val expected = QueryParams.builder() - expected.put("objectName", "objectName") - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo(QueryParams.builder().put("objectName", "objectName").build()) } } From ece3d6d3f438671e2b4fab916f9295c668d2f137 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 03:33:21 +0000 Subject: [PATCH 22/74] chore(internal): rename `getPathParam` (#88) chore(internal): reorder some params methodsc chore(internal): delete duplicate tests chore(internal): refactor some test assertions --- .../models/commits/CommitRetrieveParams.kt | 13 ++- .../testresults/TestResultListParams.kt | 13 ++- .../InferencePipelineDeleteParams.kt | 13 ++- .../InferencePipelineRetrieveParams.kt | 13 ++- .../InferencePipelineUpdateParams.kt | 13 ++- .../data/DataStreamParams.kt | 13 ++- .../rows/RowUpdateParams.kt | 13 ++- .../testresults/TestResultListParams.kt | 13 ++- .../projects/commits/CommitCreateParams.kt | 13 ++- .../projects/commits/CommitListParams.kt | 13 ++- .../InferencePipelineCreateParams.kt | 13 ++- .../InferencePipelineListParams.kt | 13 ++- .../services/async/CommitServiceAsyncImpl.kt | 2 +- .../InferencePipelineServiceAsyncImpl.kt | 6 +- .../commits/TestResultServiceAsyncImpl.kt | 2 +- .../DataServiceAsyncImpl.kt | 2 +- .../inferencepipelines/RowServiceAsyncImpl.kt | 2 +- .../TestResultServiceAsyncImpl.kt | 2 +- .../async/projects/CommitServiceAsyncImpl.kt | 4 +- .../InferencePipelineServiceAsyncImpl.kt | 4 +- .../services/blocking/CommitServiceImpl.kt | 2 +- .../blocking/InferencePipelineServiceImpl.kt | 6 +- .../blocking/commits/TestResultServiceImpl.kt | 2 +- .../inferencepipelines/DataServiceImpl.kt | 2 +- .../inferencepipelines/RowServiceImpl.kt | 2 +- .../TestResultServiceImpl.kt | 2 +- .../blocking/projects/CommitServiceImpl.kt | 4 +- .../projects/InferencePipelineServiceImpl.kt | 4 +- .../commits/CommitRetrieveParamsTest.kt | 9 +- .../testresults/TestResultListParamsTest.kt | 25 +++--- .../InferencePipelineDeleteParamsTest.kt | 9 +- .../InferencePipelineRetrieveParamsTest.kt | 25 +++--- .../InferencePipelineUpdateParamsTest.kt | 25 +++--- .../data/DataStreamParamsTest.kt | 85 +++++++++---------- .../rows/RowUpdateParamsTest.kt | 29 +++---- .../testresults/TestResultListParamsTest.kt | 25 +++--- .../commits/CommitCreateParamsTest.kt | 75 ++++++++-------- .../projects/commits/CommitListParamsTest.kt | 21 +++-- .../InferencePipelineCreateParamsTest.kt | 67 +++++++-------- .../InferencePipelineListParamsTest.kt | 25 +++--- .../PresignedUrlCreateParamsTest.kt | 10 --- 41 files changed, 298 insertions(+), 336 deletions(-) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveParams.kt index 13f08848..9f80ee28 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveParams.kt @@ -23,16 +23,15 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { + fun _pathParam(index: Int): String = + when (index) { 0 -> projectVersionId else -> "" } - } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams fun toBuilder() = Builder().from(this) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt index 48340c7b..aedbec78 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt @@ -55,6 +55,12 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams + fun _pathParam(index: Int): String = + when (index) { + 0 -> projectVersionId + else -> "" + } + override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = @@ -69,13 +75,6 @@ private constructor( } .build() - fun getPathParam(index: Int): String { - return when (index) { - 0 -> projectVersionId - else -> "" - } - } - fun toBuilder() = Builder().from(this) companion object { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt index a9964443..c14f9ba7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt @@ -33,16 +33,15 @@ private constructor( internal fun _body(): Optional> = Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { + fun _pathParam(index: Int): String = + when (index) { 0 -> inferencePipelineId else -> "" } - } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams fun toBuilder() = Builder().from(this) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt index 08ac66a4..6cb9ed2e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt @@ -34,6 +34,12 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams + fun _pathParam(index: Int): String = + when (index) { + 0 -> inferencePipelineId + else -> "" + } + override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = @@ -44,13 +50,6 @@ private constructor( } .build() - fun getPathParam(index: Int): String { - return when (index) { - 0 -> inferencePipelineId - else -> "" - } - } - fun toBuilder() = Builder().from(this) companion object { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt index fc06e1e9..80e906c2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt @@ -88,16 +88,15 @@ private constructor( @JvmSynthetic internal fun _body(): Body = body - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { + fun _pathParam(index: Int): String = + when (index) { 0 -> inferencePipelineId else -> "" } - } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect class Body diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt index b686c7a2..9eec4f7e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt @@ -82,16 +82,15 @@ private constructor( @JvmSynthetic internal fun _body(): Body = body - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { + fun _pathParam(index: Int): String = + when (index) { 0 -> inferencePipelineId else -> "" } - } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect class Body diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt index 59cce0e5..788d0350 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt @@ -60,6 +60,12 @@ private constructor( @JvmSynthetic internal fun _body(): Body = body + fun _pathParam(index: Int): String = + when (index) { + 0 -> inferencePipelineId + else -> "" + } + override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = @@ -70,13 +76,6 @@ private constructor( } .build() - fun getPathParam(index: Int): String { - return when (index) { - 0 -> inferencePipelineId - else -> "" - } - } - @NoAutoDetect class Body @JsonCreator diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt index 7c241f3d..2128d9c8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt @@ -51,6 +51,12 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams + fun _pathParam(index: Int): String = + when (index) { + 0 -> inferencePipelineId + else -> "" + } + override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = @@ -64,13 +70,6 @@ private constructor( } .build() - fun getPathParam(index: Int): String { - return when (index) { - 0 -> inferencePipelineId - else -> "" - } - } - fun toBuilder() = Builder().from(this) companion object { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt index 39fe52fc..a0dfdffd 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt @@ -302,16 +302,15 @@ private constructor( @JvmSynthetic internal fun _body(): Body = body - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { + fun _pathParam(index: Int): String = + when (index) { 0 -> pathProjectId else -> "" } - } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect class Body diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt index 9abe9250..ac703133 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt @@ -33,6 +33,12 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams + fun _pathParam(index: Int): String = + when (index) { + 0 -> projectId + else -> "" + } + override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = @@ -44,13 +50,6 @@ private constructor( } .build() - fun getPathParam(index: Int): String { - return when (index) { - 0 -> projectId - else -> "" - } - } - fun toBuilder() = Builder().from(this) companion object { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt index 3d0671be..aa4aeaeb 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt @@ -314,16 +314,15 @@ private constructor( @JvmSynthetic internal fun _body(): Body = body - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { + fun _pathParam(index: Int): String = + when (index) { 0 -> pathProjectId else -> "" } - } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect class Body diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt index 3128e663..8516051d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt @@ -37,6 +37,12 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams + fun _pathParam(index: Int): String = + when (index) { + 0 -> projectId + else -> "" + } + override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = @@ -49,13 +55,6 @@ private constructor( } .build() - fun getPathParam(index: Int): String { - return when (index) { - 0 -> projectId - else -> "" - } - } - fun toBuilder() = Builder().from(this) companion object { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt index 0322f214..39799d61 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt @@ -64,7 +64,7 @@ class CommitServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("versions", params.getPathParam(0)) + .addPathSegments("versions", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt index 90667d64..809fc79f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt @@ -108,7 +108,7 @@ internal constructor(private val clientOptions: ClientOptions) : InferencePipeli val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("inference-pipelines", params.getPathParam(0)) + .addPathSegments("inference-pipelines", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) @@ -138,7 +138,7 @@ internal constructor(private val clientOptions: ClientOptions) : InferencePipeli val request = HttpRequest.builder() .method(HttpMethod.PUT) - .addPathSegments("inference-pipelines", params.getPathParam(0)) + .addPathSegments("inference-pipelines", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) @@ -167,7 +167,7 @@ internal constructor(private val clientOptions: ClientOptions) : InferencePipeli val request = HttpRequest.builder() .method(HttpMethod.DELETE) - .addPathSegments("inference-pipelines", params.getPathParam(0)) + .addPathSegments("inference-pipelines", params._pathParam(0)) .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() .prepareAsync(clientOptions, params) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt index 836081ee..25422d17 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt @@ -50,7 +50,7 @@ class TestResultServiceAsyncImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("versions", params.getPathParam(0), "results") + .addPathSegments("versions", params._pathParam(0), "results") .build() .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsyncImpl.kt index 50bb6d73..a7b602a5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsyncImpl.kt @@ -50,7 +50,7 @@ class DataServiceAsyncImpl internal constructor(private val clientOptions: Clien val request = HttpRequest.builder() .method(HttpMethod.POST) - .addPathSegments("inference-pipelines", params.getPathParam(0), "data-stream") + .addPathSegments("inference-pipelines", params._pathParam(0), "data-stream") .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsyncImpl.kt index 96d8c857..14e43222 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsyncImpl.kt @@ -50,7 +50,7 @@ class RowServiceAsyncImpl internal constructor(private val clientOptions: Client val request = HttpRequest.builder() .method(HttpMethod.PUT) - .addPathSegments("inference-pipelines", params.getPathParam(0), "rows") + .addPathSegments("inference-pipelines", params._pathParam(0), "rows") .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncImpl.kt index bfb0cc2f..996335c6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncImpl.kt @@ -50,7 +50,7 @@ class TestResultServiceAsyncImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("inference-pipelines", params.getPathParam(0), "results") + .addPathSegments("inference-pipelines", params._pathParam(0), "results") .build() .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt index 0f231527..3960b323 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt @@ -60,7 +60,7 @@ class CommitServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.POST) - .addPathSegments("projects", params.getPathParam(0), "versions") + .addPathSegments("projects", params._pathParam(0), "versions") .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) @@ -90,7 +90,7 @@ class CommitServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("projects", params.getPathParam(0), "versions") + .addPathSegments("projects", params._pathParam(0), "versions") .build() .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt index e2f137ae..357027bb 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt @@ -60,7 +60,7 @@ internal constructor(private val clientOptions: ClientOptions) : InferencePipeli val request = HttpRequest.builder() .method(HttpMethod.POST) - .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .addPathSegments("projects", params._pathParam(0), "inference-pipelines") .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) @@ -91,7 +91,7 @@ internal constructor(private val clientOptions: ClientOptions) : InferencePipeli val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .addPathSegments("projects", params._pathParam(0), "inference-pipelines") .build() .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt index d9e25e1b..57bfda49 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt @@ -61,7 +61,7 @@ class CommitServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("versions", params.getPathParam(0)) + .addPathSegments("versions", params._pathParam(0)) .build() .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt index 6d85977a..cc013f6f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt @@ -103,7 +103,7 @@ class InferencePipelineServiceImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("inference-pipelines", params.getPathParam(0)) + .addPathSegments("inference-pipelines", params._pathParam(0)) .build() .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) @@ -130,7 +130,7 @@ class InferencePipelineServiceImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.PUT) - .addPathSegments("inference-pipelines", params.getPathParam(0)) + .addPathSegments("inference-pipelines", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) @@ -156,7 +156,7 @@ class InferencePipelineServiceImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.DELETE) - .addPathSegments("inference-pipelines", params.getPathParam(0)) + .addPathSegments("inference-pipelines", params._pathParam(0)) .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() .prepare(clientOptions, params) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt index 366e8b68..f9bbc61f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt @@ -49,7 +49,7 @@ class TestResultServiceImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("versions", params.getPathParam(0), "results") + .addPathSegments("versions", params._pathParam(0), "results") .build() .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataServiceImpl.kt index aca096fb..e7643803 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataServiceImpl.kt @@ -48,7 +48,7 @@ class DataServiceImpl internal constructor(private val clientOptions: ClientOpti val request = HttpRequest.builder() .method(HttpMethod.POST) - .addPathSegments("inference-pipelines", params.getPathParam(0), "data-stream") + .addPathSegments("inference-pipelines", params._pathParam(0), "data-stream") .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowServiceImpl.kt index 19d65031..085ddf73 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowServiceImpl.kt @@ -48,7 +48,7 @@ class RowServiceImpl internal constructor(private val clientOptions: ClientOptio val request = HttpRequest.builder() .method(HttpMethod.PUT) - .addPathSegments("inference-pipelines", params.getPathParam(0), "rows") + .addPathSegments("inference-pipelines", params._pathParam(0), "rows") .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceImpl.kt index f618d3c0..32b10215 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceImpl.kt @@ -49,7 +49,7 @@ class TestResultServiceImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("inference-pipelines", params.getPathParam(0), "results") + .addPathSegments("inference-pipelines", params._pathParam(0), "results") .build() .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt index 73d6b428..db0c3c0a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt @@ -59,7 +59,7 @@ class CommitServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.POST) - .addPathSegments("projects", params.getPathParam(0), "versions") + .addPathSegments("projects", params._pathParam(0), "versions") .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) @@ -86,7 +86,7 @@ class CommitServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("projects", params.getPathParam(0), "versions") + .addPathSegments("projects", params._pathParam(0), "versions") .build() .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt index 5192cd12..8603b8ee 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt @@ -59,7 +59,7 @@ class InferencePipelineServiceImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.POST) - .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .addPathSegments("projects", params._pathParam(0), "inference-pipelines") .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) @@ -87,7 +87,7 @@ class InferencePipelineServiceImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .addPathSegments("projects", params._pathParam(0), "inference-pipelines") .build() .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveParamsTest.kt index 4c7b8542..cd6dbebb 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveParamsTest.kt @@ -15,15 +15,14 @@ internal class CommitRetrieveParamsTest { } @Test - fun getPathParam() { + fun pathParams() { val params = CommitRetrieveParams.builder() .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() - assertThat(params).isNotNull - // path param "projectVersionId" - assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") + assertThat(params._pathParam(1)).isEqualTo("") } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt index b9b5bcbf..7de79c1c 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt @@ -20,6 +20,18 @@ internal class TestResultListParamsTest { .build() } + @Test + fun pathParams() { + val params = + TestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + @Test fun queryParams() { val params = @@ -57,17 +69,4 @@ internal class TestResultListParamsTest { assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } - - @Test - fun getPathParam() { - val params = - TestResultListParams.builder() - .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - assertThat(params).isNotNull - // path param "projectVersionId" - assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParamsTest.kt index 3fdfc636..4b7f2a2f 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParamsTest.kt @@ -15,15 +15,14 @@ internal class InferencePipelineDeleteParamsTest { } @Test - fun getPathParam() { + fun pathParams() { val params = InferencePipelineDeleteParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() - assertThat(params).isNotNull - // path param "inferencePipelineId" - assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") + assertThat(params._pathParam(1)).isEqualTo("") } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParamsTest.kt index 5526f8fd..65d06ecb 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParamsTest.kt @@ -16,6 +16,18 @@ internal class InferencePipelineRetrieveParamsTest { .build() } + @Test + fun pathParams() { + val params = + InferencePipelineRetrieveParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + @Test fun queryParams() { val params = @@ -43,17 +55,4 @@ internal class InferencePipelineRetrieveParamsTest { assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } - - @Test - fun getPathParam() { - val params = - InferencePipelineRetrieveParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - assertThat(params).isNotNull - // path param "inferencePipelineId" - assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParamsTest.kt index dd528e34..b06b9fa1 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParamsTest.kt @@ -18,6 +18,18 @@ internal class InferencePipelineUpdateParamsTest { .build() } + @Test + fun pathParams() { + val params = + InferencePipelineUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + @Test fun body() { val params = @@ -47,17 +59,4 @@ internal class InferencePipelineUpdateParamsTest { assertNotNull(body) } - - @Test - fun getPathParam() { - val params = - InferencePipelineUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - assertThat(params).isNotNull - // path param "inferencePipelineId" - assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParamsTest.kt index b0f593fb..e262bd4e 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParamsTest.kt @@ -46,6 +46,30 @@ internal class DataStreamParamsTest { .build() } + @Test + fun pathParams() { + val params = + DataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + DataStreamParams.Config.LlmData.builder().outputColumnName("output").build() + ) + .addRow( + DataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() + ) + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + @Test fun body() { val params = @@ -111,16 +135,14 @@ internal class DataStreamParamsTest { ) ) assertThat(body.rows()) - .isEqualTo( - listOf( - DataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) + .containsExactly( + DataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() ) } @@ -153,41 +175,14 @@ internal class DataStreamParamsTest { ) ) assertThat(body.rows()) - .isEqualTo( - listOf( - DataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) + .containsExactly( + DataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build() ) } - - @Test - fun getPathParam() { - val params = - DataStreamParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - DataStreamParams.Config.LlmData.builder().outputColumnName("output").build() - ) - .addRow( - DataStreamParams.Row.builder() - .putAdditionalProperty("user_query", JsonValue.from("bar")) - .putAdditionalProperty("output", JsonValue.from("bar")) - .putAdditionalProperty("tokens", JsonValue.from("bar")) - .putAdditionalProperty("cost", JsonValue.from("bar")) - .putAdditionalProperty("timestamp", JsonValue.from("bar")) - .build() - ) - .build() - assertThat(params).isNotNull - // path param "inferencePipelineId" - assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt index b65df277..73cabb67 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt @@ -27,6 +27,20 @@ internal class RowUpdateParamsTest { .build() } + @Test + fun pathParams() { + val params = + RowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .inferenceId("inferenceId") + .row(JsonValue.from(mapOf())) + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + @Test fun queryParams() { val params = @@ -111,19 +125,4 @@ internal class RowUpdateParamsTest { assertNotNull(body) assertThat(body._row()).isEqualTo(JsonValue.from(mapOf())) } - - @Test - fun getPathParam() { - val params = - RowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .inferenceId("inferenceId") - .row(JsonValue.from(mapOf())) - .build() - assertThat(params).isNotNull - // path param "inferencePipelineId" - assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt index ae05735a..3ea847a1 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt @@ -19,6 +19,18 @@ internal class TestResultListParamsTest { .build() } + @Test + fun pathParams() { + val params = + TestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + @Test fun queryParams() { val params = @@ -54,17 +66,4 @@ internal class TestResultListParamsTest { assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } - - @Test - fun getPathParam() { - val params = - TestResultListParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - assertThat(params).isNotNull - // path param "inferencePipelineId" - assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt index 8c38b268..e9648b98 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt @@ -54,6 +54,43 @@ internal class CommitCreateParamsTest { .build() } + @Test + fun pathParams() { + val params = + CommitCreateParams.builder() + .pathProjectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commit( + CommitCreateParams.Commit.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .fileSize(1024L) + .message("Updated the prompt.") + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .storageUri("s3://...") + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + ) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(1L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(5L) + .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(CommitCreateParams.Status.QUEUED) + .statusMessage("Commit successfully processed.") + .storageUri("s3://...") + .totalGoalCount(6L) + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + @Test fun body() { val params = @@ -206,42 +243,4 @@ internal class CommitCreateParamsTest { assertThat(body.trainingDatasetId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.validationDatasetId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") } - - @Test - fun getPathParam() { - val params = - CommitCreateParams.builder() - .pathProjectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .commit( - CommitCreateParams.Commit.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .fileSize(1024L) - .message("Updated the prompt.") - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .storageUri("s3://...") - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build() - ) - .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .failingGoalCount(1L) - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .passingGoalCount(5L) - .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(CommitCreateParams.Status.QUEUED) - .statusMessage("Commit successfully processed.") - .storageUri("s3://...") - .totalGoalCount(6L) - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build() - assertThat(params).isNotNull - // path param "pathProjectId" - assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListParamsTest.kt index b9c162ff..6503483b 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListParamsTest.kt @@ -17,6 +17,16 @@ internal class CommitListParamsTest { .build() } + @Test + fun pathParams() { + val params = + CommitListParams.builder().projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + @Test fun queryParams() { val params = @@ -41,15 +51,4 @@ internal class CommitListParamsTest { assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } - - @Test - fun getPathParam() { - val params = - CommitListParams.builder().projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() - assertThat(params).isNotNull - // path param "projectId" - assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt index f4e460a6..60fb7650 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt @@ -105,6 +105,39 @@ internal class InferencePipelineCreateParamsTest { .build() } + @Test + fun pathParams() { + val params = + InferencePipelineCreateParams.builder() + .pathProjectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastSampleReceived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description("This pipeline is used for production.") + .failingGoalCount(1L) + .links( + InferencePipelineCreateParams.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .name("production") + .passingGoalCount(5L) + .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(InferencePipelineCreateParams.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(6L) + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + @Test fun body() { val params = @@ -356,38 +389,4 @@ internal class InferencePipelineCreateParamsTest { assertThat(body.statusMessage()).contains("Tests successfully evaluated") assertThat(body.totalGoalCount()).isEqualTo(6L) } - - @Test - fun getPathParam() { - val params = - InferencePipelineCreateParams.builder() - .pathProjectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateLastSampleReceived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateOfNextEvaluation(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .description("This pipeline is used for production.") - .failingGoalCount(1L) - .links( - InferencePipelineCreateParams.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .name("production") - .passingGoalCount(5L) - .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineCreateParams.Status.QUEUED) - .statusMessage("Tests successfully evaluated") - .totalGoalCount(6L) - .build() - assertThat(params).isNotNull - // path param "pathProjectId" - assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParamsTest.kt index 7fe89e33..1c520fbe 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParamsTest.kt @@ -18,6 +18,18 @@ internal class InferencePipelineListParamsTest { .build() } + @Test + fun pathParams() { + val params = + InferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + @Test fun queryParams() { val params = @@ -51,17 +63,4 @@ internal class InferencePipelineListParamsTest { assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } - - @Test - fun getPathParam() { - val params = - InferencePipelineListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - assertThat(params).isNotNull - // path param "projectId" - assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParamsTest.kt index 579b2247..d9c2b5a9 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParamsTest.kt @@ -22,14 +22,4 @@ internal class PresignedUrlCreateParamsTest { assertThat(queryParams) .isEqualTo(QueryParams.builder().put("objectName", "objectName").build()) } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = PresignedUrlCreateParams.builder().objectName("objectName").build() - - val queryParams = params._queryParams() - - assertThat(queryParams) - .isEqualTo(QueryParams.builder().put("objectName", "objectName").build()) - } } From db068dc6e79b6a3fa77fe7b22a9a7bf31b61b8d9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 19 Mar 2025 08:12:30 +0000 Subject: [PATCH 23/74] chore(internal): reformat some tests (#89) chore(internal): generate more tests --- .../api/models/commits/CommitRetrieveResponseTest.kt | 4 ++-- .../models/commits/testresults/TestResultListResponseTest.kt | 4 ++-- .../InferencePipelineRetrieveResponseTest.kt | 4 ++-- .../inferencepipelines/InferencePipelineUpdateResponseTest.kt | 4 ++-- .../models/inferencepipelines/data/DataStreamResponseTest.kt | 4 ++-- .../models/inferencepipelines/rows/RowUpdateResponseTest.kt | 4 ++-- .../testresults/TestResultListResponseTest.kt | 4 ++-- .../api/models/projects/ProjectCreateResponseTest.kt | 4 ++-- .../openlayer/api/models/projects/ProjectListResponseTest.kt | 4 ++-- .../api/models/projects/commits/CommitCreateResponseTest.kt | 4 ++-- .../api/models/projects/commits/CommitListResponseTest.kt | 4 ++-- .../inferencepipelines/InferencePipelineCreateResponseTest.kt | 4 ++-- .../inferencepipelines/InferencePipelineListResponseTest.kt | 4 ++-- .../storage/presignedurl/PresignedUrlCreateResponseTest.kt | 4 ++-- 14 files changed, 28 insertions(+), 28 deletions(-) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt index 765b4703..b7f0de52 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class CommitRetrieveResponseTest { @Test - fun createCommitRetrieveResponse() { + fun create() { val commitRetrieveResponse = CommitRetrieveResponse.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -50,7 +50,7 @@ internal class CommitRetrieveResponseTest { .build() ) .build() - assertThat(commitRetrieveResponse).isNotNull + assertThat(commitRetrieveResponse.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(commitRetrieveResponse.commit()) .isEqualTo( diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt index 16dc4c8f..11c30854 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test internal class TestResultListResponseTest { @Test - fun createTestResultListResponse() { + fun create() { val testResultListResponse = TestResultListResponse.builder() .addItem( @@ -66,7 +66,7 @@ internal class TestResultListResponseTest { .build() ) .build() - assertThat(testResultListResponse).isNotNull + assertThat(testResultListResponse.items()) .containsExactly( TestResultListResponse.Item.builder() diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt index 474d2989..cdfc0ddb 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test internal class InferencePipelineRetrieveResponseTest { @Test - fun createInferencePipelineRetrieveResponse() { + fun create() { val inferencePipelineRetrieveResponse = InferencePipelineRetrieveResponse.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -102,7 +102,7 @@ internal class InferencePipelineRetrieveResponseTest { ) .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .build() - assertThat(inferencePipelineRetrieveResponse).isNotNull + assertThat(inferencePipelineRetrieveResponse.id()) .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(inferencePipelineRetrieveResponse.dateCreated()) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt index e65d844f..ed7a6ec2 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test internal class InferencePipelineUpdateResponseTest { @Test - fun createInferencePipelineUpdateResponse() { + fun create() { val inferencePipelineUpdateResponse = InferencePipelineUpdateResponse.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -102,7 +102,7 @@ internal class InferencePipelineUpdateResponseTest { ) .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .build() - assertThat(inferencePipelineUpdateResponse).isNotNull + assertThat(inferencePipelineUpdateResponse.id()) .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(inferencePipelineUpdateResponse.dateCreated()) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponseTest.kt index 6418f012..c4973097 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponseTest.kt @@ -8,10 +8,10 @@ import org.junit.jupiter.api.Test internal class DataStreamResponseTest { @Test - fun createDataStreamResponse() { + fun create() { val dataStreamResponse = DataStreamResponse.builder().success(DataStreamResponse.Success.TRUE).build() - assertThat(dataStreamResponse).isNotNull + assertThat(dataStreamResponse.success()).isEqualTo(DataStreamResponse.Success.TRUE) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponseTest.kt index 8d93ea51..28568e08 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponseTest.kt @@ -8,10 +8,10 @@ import org.junit.jupiter.api.Test internal class RowUpdateResponseTest { @Test - fun createRowUpdateResponse() { + fun create() { val rowUpdateResponse = RowUpdateResponse.builder().success(RowUpdateResponse.Success.TRUE).build() - assertThat(rowUpdateResponse).isNotNull + assertThat(rowUpdateResponse.success()).isEqualTo(RowUpdateResponse.Success.TRUE) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt index 2b0c06c7..aaddfb19 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test internal class TestResultListResponseTest { @Test - fun createTestResultListResponse() { + fun create() { val testResultListResponse = TestResultListResponse.builder() .addItem( @@ -66,7 +66,7 @@ internal class TestResultListResponseTest { .build() ) .build() - assertThat(testResultListResponse).isNotNull + assertThat(testResultListResponse.items()) .containsExactly( TestResultListResponse.Item.builder() diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateResponseTest.kt index bab6428f..f3ecb620 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateResponseTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class ProjectCreateResponseTest { @Test - fun createProjectCreateResponse() { + fun create() { val projectCreateResponse = ProjectCreateResponse.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -50,7 +50,7 @@ internal class ProjectCreateResponseTest { .build() ) .build() - assertThat(projectCreateResponse).isNotNull + assertThat(projectCreateResponse.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(projectCreateResponse.creatorId()) .contains("589ece63-49a2-41b4-98e1-10547761d4b0") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListResponseTest.kt index 19949a5b..1a8a28c7 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListResponseTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class ProjectListResponseTest { @Test - fun createProjectListResponse() { + fun create() { val projectListResponse = ProjectListResponse.builder() .addItem( @@ -54,7 +54,7 @@ internal class ProjectListResponseTest { .build() ) .build() - assertThat(projectListResponse).isNotNull + assertThat(projectListResponse.items()) .containsExactly( ProjectListResponse.Item.builder() diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt index 190d61f5..b8ec9cd9 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class CommitCreateResponseTest { @Test - fun createCommitCreateResponse() { + fun create() { val commitCreateResponse = CommitCreateResponse.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -50,7 +50,7 @@ internal class CommitCreateResponseTest { .build() ) .build() - assertThat(commitCreateResponse).isNotNull + assertThat(commitCreateResponse.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(commitCreateResponse.commit()) .isEqualTo( diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt index eef2969a..a6ef21e7 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class CommitListResponseTest { @Test - fun createCommitListResponse() { + fun create() { val commitListResponse = CommitListResponse.builder() .addItem( @@ -54,7 +54,7 @@ internal class CommitListResponseTest { .build() ) .build() - assertThat(commitListResponse).isNotNull + assertThat(commitListResponse.items()) .containsExactly( CommitListResponse.Item.builder() diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt index bc1d786f..27e5e421 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test internal class InferencePipelineCreateResponseTest { @Test - fun createInferencePipelineCreateResponse() { + fun create() { val inferencePipelineCreateResponse = InferencePipelineCreateResponse.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -102,7 +102,7 @@ internal class InferencePipelineCreateResponseTest { ) .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") .build() - assertThat(inferencePipelineCreateResponse).isNotNull + assertThat(inferencePipelineCreateResponse.id()) .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(inferencePipelineCreateResponse.dateCreated()) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt index e33f2621..54344291 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test internal class InferencePipelineListResponseTest { @Test - fun createInferencePipelineListResponse() { + fun create() { val inferencePipelineListResponse = InferencePipelineListResponse.builder() .addItem( @@ -113,7 +113,7 @@ internal class InferencePipelineListResponseTest { .build() ) .build() - assertThat(inferencePipelineListResponse).isNotNull + assertThat(inferencePipelineListResponse.items()) .containsExactly( InferencePipelineListResponse.Item.builder() diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponseTest.kt index 7de37b91..af5fd427 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponseTest.kt @@ -9,14 +9,14 @@ import org.junit.jupiter.api.Test internal class PresignedUrlCreateResponseTest { @Test - fun createPresignedUrlCreateResponse() { + fun create() { val presignedUrlCreateResponse = PresignedUrlCreateResponse.builder() .storageUri("storageUri") .url("url") .fields(JsonValue.from(mapOf())) .build() - assertThat(presignedUrlCreateResponse).isNotNull + assertThat(presignedUrlCreateResponse.storageUri()).isEqualTo("storageUri") assertThat(presignedUrlCreateResponse.url()).isEqualTo("url") assertThat(presignedUrlCreateResponse._fields()) From f2b112b2f218ba39307aad1ed17c0d6114142d3a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 19 Mar 2025 09:03:11 +0000 Subject: [PATCH 24/74] fix(client): support kotlin 1.8 runtime (#90) --- buildSrc/build.gradle.kts | 4 +-- .../src/main/kotlin/openlayer.java.gradle.kts | 3 +++ .../main/kotlin/openlayer.kotlin.gradle.kts | 25 ++++++++++--------- openlayer-java-example/build.gradle.kts | 10 +++++--- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index d1ed374d..778c89de 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,6 +1,6 @@ plugins { `kotlin-dsl` - kotlin("jvm") version "2.1.10" + kotlin("jvm") version "1.9.20" id("com.vanniktech.maven.publish") version "0.28.0" } @@ -11,6 +11,6 @@ repositories { dependencies { implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.2") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.10") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20") implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0") } diff --git a/buildSrc/src/main/kotlin/openlayer.java.gradle.kts b/buildSrc/src/main/kotlin/openlayer.java.gradle.kts index 597b6e80..e39d9ac6 100644 --- a/buildSrc/src/main/kotlin/openlayer.java.gradle.kts +++ b/buildSrc/src/main/kotlin/openlayer.java.gradle.kts @@ -23,6 +23,9 @@ java { toolchain { languageVersion.set(JavaLanguageVersion.of(17)) } + + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } tasks.withType().configureEach { diff --git a/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts b/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts index 703a05e9..f8d2c677 100644 --- a/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts @@ -1,6 +1,6 @@ import com.diffplug.gradle.spotless.SpotlessExtension import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion plugins { id("openlayer.java") @@ -11,25 +11,26 @@ kotlin { jvmToolchain { languageVersion.set(JavaLanguageVersion.of(17)) } -} - -configure { - kotlin { - ktfmt().kotlinlangStyle() - toggleOffOn() - } -} -tasks.withType().configureEach { compilerOptions { - allWarningsAsErrors = true freeCompilerArgs = listOf( "-Xjvm-default=all", "-Xjdk-release=1.8", // Suppress deprecation warnings because we may still reference and test deprecated members. - "-Xsuppress-warning=DEPRECATION" + // TODO: Replace with `-Xsuppress-warning=DEPRECATION` once we use Kotlin compiler 2.1.0+. + "-nowarn", ) jvmTarget.set(JvmTarget.JVM_1_8) + languageVersion.set(KotlinVersion.KOTLIN_1_8) + apiVersion.set(KotlinVersion.KOTLIN_1_8) + coreLibrariesVersion = "1.8.0" + } +} + +configure { + kotlin { + ktfmt().kotlinlangStyle() + toggleOffOn() } } diff --git a/openlayer-java-example/build.gradle.kts b/openlayer-java-example/build.gradle.kts index 9973e516..20cb067a 100644 --- a/openlayer-java-example/build.gradle.kts +++ b/openlayer-java-example/build.gradle.kts @@ -1,16 +1,20 @@ plugins { - id("openlayer.kotlin") id("java") application } +repositories { + mavenCentral() +} + dependencies { implementation(project(":openlayer-java")) } -tasks.withType().configureEach { +java { // Allow using more modern APIs, like `List.of` and `Map.of`, in examples. - options.release.set(9) + sourceCompatibility = JavaVersion.VERSION_1_9 + targetCompatibility = JavaVersion.VERSION_1_9 } application { From b92860288151baab73f6ad26ffbd0976a3f54aab Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 19 Mar 2025 09:06:01 +0000 Subject: [PATCH 25/74] chore(internal): refactor enum query param serialization (#91) --- .../api/models/commits/testresults/TestResultListParams.kt | 4 ++-- .../inferencepipelines/InferencePipelineRetrieveParams.kt | 2 +- .../inferencepipelines/testresults/TestResultListParams.kt | 4 ++-- .../com/openlayer/api/models/projects/ProjectListParams.kt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt index aedbec78..f1bd55d7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt @@ -69,8 +69,8 @@ private constructor( includeArchived?.let { put("includeArchived", it.toString()) } page?.let { put("page", it.toString()) } perPage?.let { put("perPage", it.toString()) } - status?.let { put("status", it.asString()) } - type?.let { put("type", it.asString()) } + status?.let { put("status", it.toString()) } + type?.let { put("type", it.toString()) } putAll(additionalQueryParams) } .build() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt index 6cb9ed2e..e4e48e37 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt @@ -45,7 +45,7 @@ private constructor( override fun _queryParams(): QueryParams = QueryParams.builder() .apply { - expand?.let { put("expand", it.joinToString(",") { it.asString() }) } + expand?.let { put("expand", it.joinToString(",") { it.toString() }) } putAll(additionalQueryParams) } .build() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt index 2128d9c8..e28f7732 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt @@ -64,8 +64,8 @@ private constructor( .apply { page?.let { put("page", it.toString()) } perPage?.let { put("perPage", it.toString()) } - status?.let { put("status", it.asString()) } - type?.let { put("type", it.asString()) } + status?.let { put("status", it.toString()) } + type?.let { put("type", it.toString()) } putAll(additionalQueryParams) } .build() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt index 1ce8fd00..cfef6024 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt @@ -49,7 +49,7 @@ private constructor( name?.let { put("name", it) } page?.let { put("page", it.toString()) } perPage?.let { put("perPage", it.toString()) } - taskType?.let { put("taskType", it.asString()) } + taskType?.let { put("taskType", it.toString()) } putAll(additionalQueryParams) } .build() From 722165bcfa13936fc3ed70592833293495f1ed20 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 20 Mar 2025 05:16:55 +0000 Subject: [PATCH 26/74] chore(internal): add missing release please block (#92) --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 779cf2f5..f2931a45 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,12 @@ The Openlayer Java SDK provides convenient access to the Openlayer REST API from It is generated with [Stainless](https://www.stainless.com/). + + The REST API documentation can be found on [openlayer.com](https://openlayer.com/docs/api-reference/rest/overview). Javadocs are also available on [javadoc.io](https://javadoc.io/doc/com.openlayer.api/openlayer-java/0.1.0-alpha.11). + + ## Installation From d1ee889f1b5a4b8e97fff690f0c4db997441278f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 20 Mar 2025 05:30:51 +0000 Subject: [PATCH 27/74] chore(client)!: refactor exception structure and methods (#93) # Migration Previously you would access error JSON on an exception via `exception.error()._additionalProperties()`, which would return `Map`. Now you would access this via `exception.body()`, which returns `JsonValue`. You should no longer assume that the returned error JSON is an object. You can check via `exception.body().asObject()`. --- .../api/core/handlers/ErrorHandler.kt | 149 +++++++----------- .../api/errors/BadRequestException.kt | 78 ++++++++- .../api/errors/InternalServerException.kt | 93 ++++++++++- .../openlayer/api/errors/NotFoundException.kt | 74 ++++++++- .../openlayer/api/errors/OpenlayerError.kt | 82 ---------- .../api/errors/OpenlayerServiceException.kt | 22 +-- .../api/errors/PermissionDeniedException.kt | 78 ++++++++- .../api/errors/RateLimitException.kt | 78 ++++++++- .../api/errors/UnauthorizedException.kt | 78 ++++++++- .../errors/UnexpectedStatusCodeException.kt | 94 ++++++++++- .../errors/UnprocessableEntityException.kt | 78 ++++++++- .../services/async/CommitServiceAsyncImpl.kt | 4 +- .../InferencePipelineServiceAsyncImpl.kt | 4 +- .../services/async/ProjectServiceAsyncImpl.kt | 4 +- .../commits/TestResultServiceAsyncImpl.kt | 4 +- .../DataServiceAsyncImpl.kt | 4 +- .../inferencepipelines/RowServiceAsyncImpl.kt | 4 +- .../TestResultServiceAsyncImpl.kt | 4 +- .../async/projects/CommitServiceAsyncImpl.kt | 4 +- .../InferencePipelineServiceAsyncImpl.kt | 4 +- .../storage/PresignedUrlServiceAsyncImpl.kt | 4 +- .../services/blocking/CommitServiceImpl.kt | 4 +- .../blocking/InferencePipelineServiceImpl.kt | 4 +- .../services/blocking/ProjectServiceImpl.kt | 4 +- .../blocking/commits/TestResultServiceImpl.kt | 4 +- .../inferencepipelines/DataServiceImpl.kt | 4 +- .../inferencepipelines/RowServiceImpl.kt | 4 +- .../TestResultServiceImpl.kt | 4 +- .../blocking/projects/CommitServiceImpl.kt | 4 +- .../projects/InferencePipelineServiceImpl.kt | 4 +- .../storage/PresignedUrlServiceImpl.kt | 4 +- .../api/services/ErrorHandlingTest.kt | 56 ++++--- 32 files changed, 763 insertions(+), 277 deletions(-) delete mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/ErrorHandler.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/ErrorHandler.kt index 5e442089..52ca7bb6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/ErrorHandler.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/ErrorHandler.kt @@ -1,125 +1,84 @@ +// File generated from our OpenAPI spec by Stainless. + @file:JvmName("ErrorHandler") package com.openlayer.api.core.handlers import com.fasterxml.jackson.databind.json.JsonMapper -import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.http.HttpResponse import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.BadRequestException import com.openlayer.api.errors.InternalServerException import com.openlayer.api.errors.NotFoundException -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.errors.PermissionDeniedException import com.openlayer.api.errors.RateLimitException import com.openlayer.api.errors.UnauthorizedException import com.openlayer.api.errors.UnexpectedStatusCodeException import com.openlayer.api.errors.UnprocessableEntityException -import java.io.ByteArrayInputStream -import java.io.InputStream @JvmSynthetic -internal fun errorHandler(jsonMapper: JsonMapper): Handler { - val handler = jsonHandler(jsonMapper) +internal fun errorHandler(jsonMapper: JsonMapper): Handler { + val handler = jsonHandler(jsonMapper) - return object : Handler { - override fun handle(response: HttpResponse): OpenlayerError = + return object : Handler { + override fun handle(response: HttpResponse): JsonValue = try { handler.handle(response) } catch (e: Exception) { - OpenlayerError.builder().build() + JsonMissing.of() } } } @JvmSynthetic -internal fun Handler.withErrorHandler(errorHandler: Handler): Handler = +internal fun Handler.withErrorHandler(errorHandler: Handler): Handler = object : Handler { - override fun handle(response: HttpResponse): T { + override fun handle(response: HttpResponse): T = when (val statusCode = response.statusCode()) { - in 200..299 -> { - return this@withErrorHandler.handle(response) - } - 400 -> { - val buffered = response.buffered() - throw BadRequestException( - buffered.headers(), - stringHandler().handle(buffered), - errorHandler.handle(buffered), - ) - } - 401 -> { - val buffered = response.buffered() - throw UnauthorizedException( - buffered.headers(), - stringHandler().handle(buffered), - errorHandler.handle(buffered), - ) - } - 403 -> { - val buffered = response.buffered() - throw PermissionDeniedException( - buffered.headers(), - stringHandler().handle(buffered), - errorHandler.handle(buffered), - ) - } - 404 -> { - val buffered = response.buffered() - throw NotFoundException( - buffered.headers(), - stringHandler().handle(buffered), - errorHandler.handle(buffered), - ) - } - 422 -> { - val buffered = response.buffered() - throw UnprocessableEntityException( - buffered.headers(), - stringHandler().handle(buffered), - errorHandler.handle(buffered), - ) - } - 429 -> { - val buffered = response.buffered() - throw RateLimitException( - buffered.headers(), - stringHandler().handle(buffered), - errorHandler.handle(buffered), - ) - } - in 500..599 -> { - val buffered = response.buffered() - throw InternalServerException( - statusCode, - buffered.headers(), - stringHandler().handle(buffered), - errorHandler.handle(buffered), - ) - } - else -> { - val buffered = response.buffered() - throw UnexpectedStatusCodeException( - statusCode, - buffered.headers(), - stringHandler().handle(buffered), - errorHandler.handle(buffered), - ) - } + in 200..299 -> this@withErrorHandler.handle(response) + 400 -> + throw BadRequestException.builder() + .headers(response.headers()) + .body(errorHandler.handle(response)) + .build() + 401 -> + throw UnauthorizedException.builder() + .headers(response.headers()) + .body(errorHandler.handle(response)) + .build() + 403 -> + throw PermissionDeniedException.builder() + .headers(response.headers()) + .body(errorHandler.handle(response)) + .build() + 404 -> + throw NotFoundException.builder() + .headers(response.headers()) + .body(errorHandler.handle(response)) + .build() + 422 -> + throw UnprocessableEntityException.builder() + .headers(response.headers()) + .body(errorHandler.handle(response)) + .build() + 429 -> + throw RateLimitException.builder() + .headers(response.headers()) + .body(errorHandler.handle(response)) + .build() + in 500..599 -> + throw InternalServerException.builder() + .statusCode(statusCode) + .headers(response.headers()) + .body(errorHandler.handle(response)) + .build() + else -> + throw UnexpectedStatusCodeException.builder() + .statusCode(statusCode) + .headers(response.headers()) + .body(errorHandler.handle(response)) + .build() } - } - } - -private fun HttpResponse.buffered(): HttpResponse { - val body = body().readBytes() - - return object : HttpResponse { - override fun statusCode(): Int = this@buffered.statusCode() - - override fun headers(): Headers = this@buffered.headers() - - override fun body(): InputStream = ByteArrayInputStream(body) - - override fun close() = this@buffered.close() } -} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt index fdd01aa2..ea4fa913 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt @@ -1,6 +1,80 @@ +// File generated from our OpenAPI spec by Stainless. + package com.openlayer.api.errors +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class BadRequestException +private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : + OpenlayerServiceException("400: $body", cause) { + + override fun headers(): Headers = headers + + override fun body(): JsonValue = body + + override fun statusCode(): Int = 400 + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [BadRequestException]. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BadRequestException]. */ + class Builder internal constructor() { + + private var headers: Headers? = null + private var body: JsonValue? = null + private var cause: Throwable? = null + + @JvmSynthetic + internal fun from(badRequestException: BadRequestException) = apply { + headers = badRequestException.headers + body = badRequestException.body + cause = badRequestException.cause + } + + fun headers(headers: Headers) = apply { this.headers = headers } + + fun body(body: JsonValue) = apply { this.body = body } + + fun cause(cause: Throwable?) = apply { this.cause = cause } + + /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ + fun cause(cause: Optional) = cause(cause.getOrNull()) -class BadRequestException(headers: Headers, body: String, error: OpenlayerError) : - OpenlayerServiceException(400, headers, body, error) + /** + * Returns an immutable instance of [BadRequestException]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BadRequestException = + BadRequestException( + checkRequired("headers", headers), + checkRequired("body", body), + cause, + ) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/InternalServerException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/InternalServerException.kt index ba8c9119..aca354d8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/InternalServerException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/InternalServerException.kt @@ -1,10 +1,91 @@ +// File generated from our OpenAPI spec by Stainless. + package com.openlayer.api.errors +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class InternalServerException +private constructor( + private val statusCode: Int, + private val headers: Headers, + private val body: JsonValue, + cause: Throwable?, +) : OpenlayerServiceException("$statusCode: $body", cause) { + + override fun statusCode(): Int = statusCode + + override fun headers(): Headers = headers + + override fun body(): JsonValue = body + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [InternalServerException]. + * + * The following fields are required: + * ```java + * .statusCode() + * .headers() + * .body() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InternalServerException]. */ + class Builder internal constructor() { + + private var statusCode: Int? = null + private var headers: Headers? = null + private var body: JsonValue? = null + private var cause: Throwable? = null + + @JvmSynthetic + internal fun from(internalServerException: InternalServerException) = apply { + statusCode = internalServerException.statusCode + headers = internalServerException.headers + body = internalServerException.body + cause = internalServerException.cause + } + + fun statusCode(statusCode: Int) = apply { this.statusCode = statusCode } + + fun headers(headers: Headers) = apply { this.headers = headers } + + fun body(body: JsonValue) = apply { this.body = body } + + fun cause(cause: Throwable?) = apply { this.cause = cause } + + /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ + fun cause(cause: Optional) = cause(cause.getOrNull()) -class InternalServerException( - statusCode: Int, - headers: Headers, - body: String, - error: OpenlayerError, -) : OpenlayerServiceException(statusCode, headers, body, error) + /** + * Returns an immutable instance of [InternalServerException]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .statusCode() + * .headers() + * .body() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): InternalServerException = + InternalServerException( + checkRequired("statusCode", statusCode), + checkRequired("headers", headers), + checkRequired("body", body), + cause, + ) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt index d47b79cc..7bbae3bb 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt @@ -1,6 +1,76 @@ +// File generated from our OpenAPI spec by Stainless. + package com.openlayer.api.errors +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class NotFoundException +private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : + OpenlayerServiceException("404: $body", cause) { + + override fun headers(): Headers = headers + + override fun body(): JsonValue = body + + override fun statusCode(): Int = 404 + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [NotFoundException]. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [NotFoundException]. */ + class Builder internal constructor() { + + private var headers: Headers? = null + private var body: JsonValue? = null + private var cause: Throwable? = null + + @JvmSynthetic + internal fun from(notFoundException: NotFoundException) = apply { + headers = notFoundException.headers + body = notFoundException.body + cause = notFoundException.cause + } + + fun headers(headers: Headers) = apply { this.headers = headers } + + fun body(body: JsonValue) = apply { this.body = body } + + fun cause(cause: Throwable?) = apply { this.cause = cause } + + /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ + fun cause(cause: Optional) = cause(cause.getOrNull()) -class NotFoundException(headers: Headers, body: String, error: OpenlayerError) : - OpenlayerServiceException(404, headers, body, error) + /** + * Returns an immutable instance of [NotFoundException]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): NotFoundException = + NotFoundException(checkRequired("headers", headers), checkRequired("body", body), cause) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt deleted file mode 100644 index c6b6dad2..00000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt +++ /dev/null @@ -1,82 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.errors - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.openlayer.api.core.ExcludeMissing -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.immutableEmptyMap -import com.openlayer.api.core.toImmutable -import java.util.Objects - -@NoAutoDetect -class OpenlayerError -@JsonCreator -private constructor( - @JsonAnyGetter - @ExcludeMissing - @JsonAnySetter - @get:JvmName("additionalProperties") - val additionalProperties: Map = immutableEmptyMap() -) { - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [OpenlayerError]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [OpenlayerError]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(openlayerError: OpenlayerError) = apply { - additionalProperties = openlayerError.additionalProperties.toMutableMap() - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [OpenlayerError]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): OpenlayerError = OpenlayerError(additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is OpenlayerError && additionalProperties == other.additionalProperties /* spotless:on */ - } - - override fun hashCode(): Int = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ - - override fun toString() = "OpenlayerError{additionalProperties=$additionalProperties}" -} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerServiceException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerServiceException.kt index f170186e..69a2cf0b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerServiceException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerServiceException.kt @@ -1,23 +1,17 @@ +// File generated from our OpenAPI spec by Stainless. + package com.openlayer.api.errors +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.http.Headers abstract class OpenlayerServiceException -@JvmOverloads -constructor( - private val statusCode: Int, - private val headers: Headers, - private val body: String, - private val error: OpenlayerError, - message: String = "$statusCode: $error", - cause: Throwable? = null, -) : OpenlayerException(message, cause) { - - fun statusCode(): Int = statusCode +protected constructor(message: String, cause: Throwable? = null) : + OpenlayerException(message, cause) { - fun headers(): Headers = headers + abstract fun statusCode(): Int - fun body(): String = body + abstract fun headers(): Headers - fun error(): OpenlayerError = error + abstract fun body(): JsonValue } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt index 72a01e62..f931e74c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt @@ -1,6 +1,80 @@ +// File generated from our OpenAPI spec by Stainless. + package com.openlayer.api.errors +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class PermissionDeniedException +private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : + OpenlayerServiceException("403: $body", cause) { + + override fun headers(): Headers = headers + + override fun body(): JsonValue = body + + override fun statusCode(): Int = 403 + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [PermissionDeniedException]. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [PermissionDeniedException]. */ + class Builder internal constructor() { + + private var headers: Headers? = null + private var body: JsonValue? = null + private var cause: Throwable? = null + + @JvmSynthetic + internal fun from(permissionDeniedException: PermissionDeniedException) = apply { + headers = permissionDeniedException.headers + body = permissionDeniedException.body + cause = permissionDeniedException.cause + } + + fun headers(headers: Headers) = apply { this.headers = headers } + + fun body(body: JsonValue) = apply { this.body = body } + + fun cause(cause: Throwable?) = apply { this.cause = cause } + + /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ + fun cause(cause: Optional) = cause(cause.getOrNull()) -class PermissionDeniedException(headers: Headers, body: String, error: OpenlayerError) : - OpenlayerServiceException(403, headers, body, error) + /** + * Returns an immutable instance of [PermissionDeniedException]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): PermissionDeniedException = + PermissionDeniedException( + checkRequired("headers", headers), + checkRequired("body", body), + cause, + ) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt index 067918e5..fa8e4df3 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt @@ -1,6 +1,80 @@ +// File generated from our OpenAPI spec by Stainless. + package com.openlayer.api.errors +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class RateLimitException +private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : + OpenlayerServiceException("429: $body", cause) { + + override fun headers(): Headers = headers + + override fun body(): JsonValue = body + + override fun statusCode(): Int = 429 + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RateLimitException]. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RateLimitException]. */ + class Builder internal constructor() { + + private var headers: Headers? = null + private var body: JsonValue? = null + private var cause: Throwable? = null + + @JvmSynthetic + internal fun from(rateLimitException: RateLimitException) = apply { + headers = rateLimitException.headers + body = rateLimitException.body + cause = rateLimitException.cause + } + + fun headers(headers: Headers) = apply { this.headers = headers } + + fun body(body: JsonValue) = apply { this.body = body } + + fun cause(cause: Throwable?) = apply { this.cause = cause } + + /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ + fun cause(cause: Optional) = cause(cause.getOrNull()) -class RateLimitException(headers: Headers, body: String, error: OpenlayerError) : - OpenlayerServiceException(429, headers, body, error) + /** + * Returns an immutable instance of [RateLimitException]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RateLimitException = + RateLimitException( + checkRequired("headers", headers), + checkRequired("body", body), + cause, + ) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt index 893dbf8f..3a0c1cda 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt @@ -1,6 +1,80 @@ +// File generated from our OpenAPI spec by Stainless. + package com.openlayer.api.errors +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class UnauthorizedException +private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : + OpenlayerServiceException("401: $body", cause) { + + override fun headers(): Headers = headers + + override fun body(): JsonValue = body + + override fun statusCode(): Int = 401 + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [UnauthorizedException]. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [UnauthorizedException]. */ + class Builder internal constructor() { + + private var headers: Headers? = null + private var body: JsonValue? = null + private var cause: Throwable? = null + + @JvmSynthetic + internal fun from(unauthorizedException: UnauthorizedException) = apply { + headers = unauthorizedException.headers + body = unauthorizedException.body + cause = unauthorizedException.cause + } + + fun headers(headers: Headers) = apply { this.headers = headers } + + fun body(body: JsonValue) = apply { this.body = body } + + fun cause(cause: Throwable?) = apply { this.cause = cause } + + /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ + fun cause(cause: Optional) = cause(cause.getOrNull()) -class UnauthorizedException(headers: Headers, body: String, error: OpenlayerError) : - OpenlayerServiceException(401, headers, body, error) + /** + * Returns an immutable instance of [UnauthorizedException]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): UnauthorizedException = + UnauthorizedException( + checkRequired("headers", headers), + checkRequired("body", body), + cause, + ) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnexpectedStatusCodeException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnexpectedStatusCodeException.kt index b4cab62c..e8ed72b9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnexpectedStatusCodeException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnexpectedStatusCodeException.kt @@ -1,10 +1,92 @@ +// File generated from our OpenAPI spec by Stainless. + package com.openlayer.api.errors +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class UnexpectedStatusCodeException +private constructor( + private val statusCode: Int, + private val headers: Headers, + private val body: JsonValue, + cause: Throwable?, +) : OpenlayerServiceException("$statusCode: $body", cause) { + + override fun statusCode(): Int = statusCode + + override fun headers(): Headers = headers + + override fun body(): JsonValue = body + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [UnexpectedStatusCodeException]. + * + * The following fields are required: + * ```java + * .statusCode() + * .headers() + * .body() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [UnexpectedStatusCodeException]. */ + class Builder internal constructor() { + + private var statusCode: Int? = null + private var headers: Headers? = null + private var body: JsonValue? = null + private var cause: Throwable? = null + + @JvmSynthetic + internal fun from(unexpectedStatusCodeException: UnexpectedStatusCodeException) = apply { + statusCode = unexpectedStatusCodeException.statusCode + headers = unexpectedStatusCodeException.headers + body = unexpectedStatusCodeException.body + cause = unexpectedStatusCodeException.cause + } + + fun statusCode(statusCode: Int) = apply { this.statusCode = statusCode } + + fun headers(headers: Headers) = apply { this.headers = headers } + + fun body(body: JsonValue) = apply { this.body = body } + + fun cause(cause: Throwable?) = apply { this.cause = cause } + + /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ + fun cause(cause: Optional) = cause(cause.getOrNull()) -class UnexpectedStatusCodeException( - statusCode: Int, - headers: Headers, - body: String, - error: OpenlayerError, -) : OpenlayerServiceException(statusCode, headers, body, error) + /** + * Returns an immutable instance of [UnexpectedStatusCodeException]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .statusCode() + * .headers() + * .body() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): UnexpectedStatusCodeException = + UnexpectedStatusCodeException( + checkRequired("statusCode", statusCode), + checkRequired("headers", headers), + checkRequired("body", body), + cause, + ) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt index 940a85d8..ceeaf6b6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt @@ -1,6 +1,80 @@ +// File generated from our OpenAPI spec by Stainless. + package com.openlayer.api.errors +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class UnprocessableEntityException +private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : + OpenlayerServiceException("422: $body", cause) { + + override fun headers(): Headers = headers + + override fun body(): JsonValue = body + + override fun statusCode(): Int = 422 + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [UnprocessableEntityException]. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [UnprocessableEntityException]. */ + class Builder internal constructor() { + + private var headers: Headers? = null + private var body: JsonValue? = null + private var cause: Throwable? = null + + @JvmSynthetic + internal fun from(unprocessableEntityException: UnprocessableEntityException) = apply { + headers = unprocessableEntityException.headers + body = unprocessableEntityException.body + cause = unprocessableEntityException.cause + } + + fun headers(headers: Headers) = apply { this.headers = headers } + + fun body(body: JsonValue) = apply { this.body = body } + + fun cause(cause: Throwable?) = apply { this.cause = cause } + + /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ + fun cause(cause: Optional) = cause(cause.getOrNull()) -class UnprocessableEntityException(headers: Headers, body: String, error: OpenlayerError) : - OpenlayerServiceException(422, headers, body, error) + /** + * Returns an immutable instance of [UnprocessableEntityException]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): UnprocessableEntityException = + UnprocessableEntityException( + checkRequired("headers", headers), + checkRequired("body", body), + cause, + ) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt index 39799d61..6195c624 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.async import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.errorHandler import com.openlayer.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.commits.CommitRetrieveParams import com.openlayer.api.models.commits.CommitRetrieveResponse import com.openlayer.api.services.async.commits.TestResultServiceAsync @@ -45,7 +45,7 @@ class CommitServiceAsyncImpl internal constructor(private val clientOptions: Cli class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : CommitServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val testResults: TestResultServiceAsync.WithRawResponse by lazy { TestResultServiceAsyncImpl.WithRawResponseImpl(clientOptions) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt index 809fc79f..d333e5e9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.async import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.emptyHandler import com.openlayer.api.core.handlers.errorHandler @@ -16,7 +17,6 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.inferencepipelines.InferencePipelineDeleteParams import com.openlayer.api.models.inferencepipelines.InferencePipelineRetrieveParams import com.openlayer.api.models.inferencepipelines.InferencePipelineRetrieveResponse @@ -77,7 +77,7 @@ internal constructor(private val clientOptions: ClientOptions) : InferencePipeli class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : InferencePipelineServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val data: DataServiceAsync.WithRawResponse by lazy { DataServiceAsyncImpl.WithRawResponseImpl(clientOptions) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt index 14f66c6c..33b9d711 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.async import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.errorHandler import com.openlayer.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.projects.ProjectCreateParams import com.openlayer.api.models.projects.ProjectCreateResponse import com.openlayer.api.models.projects.ProjectListParams @@ -61,7 +61,7 @@ class ProjectServiceAsyncImpl internal constructor(private val clientOptions: Cl class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : ProjectServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val commits: CommitServiceAsync.WithRawResponse by lazy { CommitServiceAsyncImpl.WithRawResponseImpl(clientOptions) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt index 25422d17..8163f596 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.async.commits import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.errorHandler import com.openlayer.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.commits.testresults.TestResultListParams import com.openlayer.api.models.commits.testresults.TestResultListResponse import java.util.concurrent.CompletableFuture @@ -37,7 +37,7 @@ class TestResultServiceAsyncImpl internal constructor(private val clientOptions: class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : TestResultServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsyncImpl.kt index a7b602a5..b3614235 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/DataServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.async.inferencepipelines import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.errorHandler import com.openlayer.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.inferencepipelines.data.DataStreamParams import com.openlayer.api.models.inferencepipelines.data.DataStreamResponse import java.util.concurrent.CompletableFuture @@ -38,7 +38,7 @@ class DataServiceAsyncImpl internal constructor(private val clientOptions: Clien class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : DataServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val streamHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsyncImpl.kt index 14e43222..50b06e66 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/RowServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.async.inferencepipelines import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.errorHandler import com.openlayer.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.inferencepipelines.rows.RowUpdateParams import com.openlayer.api.models.inferencepipelines.rows.RowUpdateResponse import java.util.concurrent.CompletableFuture @@ -38,7 +38,7 @@ class RowServiceAsyncImpl internal constructor(private val clientOptions: Client class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : RowServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncImpl.kt index 996335c6..c0ea06fa 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.async.inferencepipelines import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.errorHandler import com.openlayer.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.inferencepipelines.testresults.TestResultListParams import com.openlayer.api.models.inferencepipelines.testresults.TestResultListResponse import java.util.concurrent.CompletableFuture @@ -37,7 +37,7 @@ class TestResultServiceAsyncImpl internal constructor(private val clientOptions: class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : TestResultServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt index 3960b323..0558d15b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.async.projects import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.errorHandler import com.openlayer.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.projects.commits.CommitCreateParams import com.openlayer.api.models.projects.commits.CommitCreateResponse import com.openlayer.api.models.projects.commits.CommitListParams @@ -47,7 +47,7 @@ class CommitServiceAsyncImpl internal constructor(private val clientOptions: Cli class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : CommitServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt index 357027bb..eebe0dcb 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.async.projects import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.errorHandler import com.openlayer.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineCreateParams import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineCreateResponse import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineListParams @@ -47,7 +47,7 @@ internal constructor(private val clientOptions: ClientOptions) : InferencePipeli class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : InferencePipelineServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt index 2a0390f5..eef0b53d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.async.storage import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.errorHandler import com.openlayer.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateParams import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateResponse import java.util.concurrent.CompletableFuture @@ -38,7 +38,7 @@ class PresignedUrlServiceAsyncImpl internal constructor(private val clientOption class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : PresignedUrlServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt index 57bfda49..98799c85 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.blocking import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.errorHandler import com.openlayer.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.commits.CommitRetrieveParams import com.openlayer.api.models.commits.CommitRetrieveResponse import com.openlayer.api.services.blocking.commits.TestResultService @@ -42,7 +42,7 @@ class CommitServiceImpl internal constructor(private val clientOptions: ClientOp class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : CommitService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val testResults: TestResultService.WithRawResponse by lazy { TestResultServiceImpl.WithRawResponseImpl(clientOptions) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt index cc013f6f..d2b9adbb 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.blocking import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.emptyHandler import com.openlayer.api.core.handlers.errorHandler @@ -16,7 +17,6 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.inferencepipelines.InferencePipelineDeleteParams import com.openlayer.api.models.inferencepipelines.InferencePipelineRetrieveParams import com.openlayer.api.models.inferencepipelines.InferencePipelineRetrieveResponse @@ -72,7 +72,7 @@ class InferencePipelineServiceImpl internal constructor(private val clientOption class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : InferencePipelineService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val data: DataService.WithRawResponse by lazy { DataServiceImpl.WithRawResponseImpl(clientOptions) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt index 4de2f6c5..354e63f8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.blocking import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.errorHandler import com.openlayer.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.projects.ProjectCreateParams import com.openlayer.api.models.projects.ProjectCreateResponse import com.openlayer.api.models.projects.ProjectListParams @@ -60,7 +60,7 @@ class ProjectServiceImpl internal constructor(private val clientOptions: ClientO class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : ProjectService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val commits: CommitService.WithRawResponse by lazy { CommitServiceImpl.WithRawResponseImpl(clientOptions) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt index f9bbc61f..2a5a5e91 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.blocking.commits import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.errorHandler import com.openlayer.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.commits.testresults.TestResultListParams import com.openlayer.api.models.commits.testresults.TestResultListResponse @@ -36,7 +36,7 @@ class TestResultServiceImpl internal constructor(private val clientOptions: Clie class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : TestResultService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataServiceImpl.kt index e7643803..2f1b4e10 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/DataServiceImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.blocking.inferencepipelines import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.errorHandler import com.openlayer.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.inferencepipelines.data.DataStreamParams import com.openlayer.api.models.inferencepipelines.data.DataStreamResponse @@ -36,7 +36,7 @@ class DataServiceImpl internal constructor(private val clientOptions: ClientOpti class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : DataService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val streamHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowServiceImpl.kt index 085ddf73..0762fdb9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/RowServiceImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.blocking.inferencepipelines import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.errorHandler import com.openlayer.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.inferencepipelines.rows.RowUpdateParams import com.openlayer.api.models.inferencepipelines.rows.RowUpdateResponse @@ -36,7 +36,7 @@ class RowServiceImpl internal constructor(private val clientOptions: ClientOptio class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : RowService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceImpl.kt index 32b10215..ca926f79 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.blocking.inferencepipelines import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.errorHandler import com.openlayer.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.inferencepipelines.testresults.TestResultListParams import com.openlayer.api.models.inferencepipelines.testresults.TestResultListResponse @@ -36,7 +36,7 @@ class TestResultServiceImpl internal constructor(private val clientOptions: Clie class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : TestResultService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt index db0c3c0a..1342de0e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.blocking.projects import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.errorHandler import com.openlayer.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.projects.commits.CommitCreateParams import com.openlayer.api.models.projects.commits.CommitCreateResponse import com.openlayer.api.models.projects.commits.CommitListParams @@ -46,7 +46,7 @@ class CommitServiceImpl internal constructor(private val clientOptions: ClientOp class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : CommitService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt index 8603b8ee..194d911d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.blocking.projects import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.errorHandler import com.openlayer.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineCreateParams import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineCreateResponse import com.openlayer.api.models.projects.inferencepipelines.InferencePipelineListParams @@ -46,7 +46,7 @@ class InferencePipelineServiceImpl internal constructor(private val clientOption class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : InferencePipelineService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt index aff6f743..76933320 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt @@ -3,6 +3,7 @@ package com.openlayer.api.services.blocking.storage import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.handlers.errorHandler import com.openlayer.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.core.http.json import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateParams import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateResponse @@ -37,7 +37,7 @@ class PresignedUrlServiceImpl internal constructor(private val clientOptions: Cl class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : PresignedUrlService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt index 951d0b2d..bcc988e0 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt @@ -16,7 +16,6 @@ import com.openlayer.api.core.jsonMapper import com.openlayer.api.errors.BadRequestException import com.openlayer.api.errors.InternalServerException import com.openlayer.api.errors.NotFoundException -import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.errors.OpenlayerException import com.openlayer.api.errors.PermissionDeniedException import com.openlayer.api.errors.RateLimitException @@ -35,12 +34,9 @@ internal class ErrorHandlingTest { companion object { - private val ERROR: OpenlayerError = - OpenlayerError.builder() - .putAdditionalProperty("errorProperty", JsonValue.from("42")) - .build() + private val ERROR_JSON: JsonValue = JsonValue.from(mapOf("errorProperty" to "42")) - private val ERROR_JSON: ByteArray = jsonMapper().writeValueAsBytes(ERROR) + private val ERROR_JSON_BYTES: ByteArray = jsonMapper().writeValueAsBytes(ERROR_JSON) private const val HEADER_NAME: String = "Error-Header" @@ -65,7 +61,9 @@ internal class ErrorHandlingTest { val dataService = client.inferencePipelines().data() stubFor( post(anyUrl()) - .willReturn(status(400).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) + .willReturn( + status(400).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON_BYTES) + ) ) val e = @@ -108,8 +106,8 @@ internal class ErrorHandlingTest { } assertThat(e.statusCode()).isEqualTo(400) - assertThat(e.error()).isEqualTo(ERROR) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + assertThat(e.body()).isEqualTo(ERROR_JSON) } @Test @@ -117,7 +115,9 @@ internal class ErrorHandlingTest { val dataService = client.inferencePipelines().data() stubFor( post(anyUrl()) - .willReturn(status(401).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) + .willReturn( + status(401).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON_BYTES) + ) ) val e = @@ -160,8 +160,8 @@ internal class ErrorHandlingTest { } assertThat(e.statusCode()).isEqualTo(401) - assertThat(e.error()).isEqualTo(ERROR) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + assertThat(e.body()).isEqualTo(ERROR_JSON) } @Test @@ -169,7 +169,9 @@ internal class ErrorHandlingTest { val dataService = client.inferencePipelines().data() stubFor( post(anyUrl()) - .willReturn(status(403).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) + .willReturn( + status(403).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON_BYTES) + ) ) val e = @@ -212,8 +214,8 @@ internal class ErrorHandlingTest { } assertThat(e.statusCode()).isEqualTo(403) - assertThat(e.error()).isEqualTo(ERROR) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + assertThat(e.body()).isEqualTo(ERROR_JSON) } @Test @@ -221,7 +223,9 @@ internal class ErrorHandlingTest { val dataService = client.inferencePipelines().data() stubFor( post(anyUrl()) - .willReturn(status(404).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) + .willReturn( + status(404).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON_BYTES) + ) ) val e = @@ -264,8 +268,8 @@ internal class ErrorHandlingTest { } assertThat(e.statusCode()).isEqualTo(404) - assertThat(e.error()).isEqualTo(ERROR) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + assertThat(e.body()).isEqualTo(ERROR_JSON) } @Test @@ -273,7 +277,9 @@ internal class ErrorHandlingTest { val dataService = client.inferencePipelines().data() stubFor( post(anyUrl()) - .willReturn(status(422).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) + .willReturn( + status(422).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON_BYTES) + ) ) val e = @@ -316,8 +322,8 @@ internal class ErrorHandlingTest { } assertThat(e.statusCode()).isEqualTo(422) - assertThat(e.error()).isEqualTo(ERROR) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + assertThat(e.body()).isEqualTo(ERROR_JSON) } @Test @@ -325,7 +331,9 @@ internal class ErrorHandlingTest { val dataService = client.inferencePipelines().data() stubFor( post(anyUrl()) - .willReturn(status(429).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) + .willReturn( + status(429).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON_BYTES) + ) ) val e = @@ -368,8 +376,8 @@ internal class ErrorHandlingTest { } assertThat(e.statusCode()).isEqualTo(429) - assertThat(e.error()).isEqualTo(ERROR) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + assertThat(e.body()).isEqualTo(ERROR_JSON) } @Test @@ -377,7 +385,9 @@ internal class ErrorHandlingTest { val dataService = client.inferencePipelines().data() stubFor( post(anyUrl()) - .willReturn(status(500).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) + .willReturn( + status(500).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON_BYTES) + ) ) val e = @@ -420,8 +430,8 @@ internal class ErrorHandlingTest { } assertThat(e.statusCode()).isEqualTo(500) - assertThat(e.error()).isEqualTo(ERROR) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + assertThat(e.body()).isEqualTo(ERROR_JSON) } @Test @@ -429,7 +439,9 @@ internal class ErrorHandlingTest { val dataService = client.inferencePipelines().data() stubFor( post(anyUrl()) - .willReturn(status(999).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) + .willReturn( + status(999).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON_BYTES) + ) ) val e = @@ -472,8 +484,8 @@ internal class ErrorHandlingTest { } assertThat(e.statusCode()).isEqualTo(999) - assertThat(e.error()).isEqualTo(ERROR) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + assertThat(e.body()).isEqualTo(ERROR_JSON) } @Test From ac5dc3bb775247428b484019d4f5a936877dac0e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 21 Mar 2025 05:29:25 +0000 Subject: [PATCH 28/74] docs: refine comments on multipart params (#94) chore(internal): make multipart assertions more robust chore(internal): remove unnecessary `assertNotNull` calls --- .../openlayer/api/core/http/HttpRequestBodies.kt | 13 ++++++------- .../InferencePipelineUpdateParamsTest.kt | 4 ---- .../inferencepipelines/data/DataStreamParamsTest.kt | 3 --- .../inferencepipelines/rows/RowUpdateParamsTest.kt | 3 --- .../api/models/projects/ProjectCreateParamsTest.kt | 3 --- .../projects/commits/CommitCreateParamsTest.kt | 3 --- .../InferencePipelineCreateParamsTest.kt | 3 --- 7 files changed, 6 insertions(+), 26 deletions(-) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBodies.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBodies.kt index 6166963c..39005535 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBodies.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBodies.kt @@ -9,7 +9,6 @@ import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.databind.node.JsonNodeType import com.openlayer.api.core.MultipartField import com.openlayer.api.errors.OpenlayerInvalidDataException -import java.io.ByteArrayInputStream import java.io.InputStream import java.io.OutputStream import kotlin.jvm.optionals.getOrNull @@ -74,12 +73,12 @@ internal fun multipartFormData( when (node.nodeType) { JsonNodeType.MISSING, JsonNodeType.NULL -> emptySequence() - JsonNodeType.BINARY -> sequenceOf(name to ByteArrayInputStream(node.binaryValue())) - JsonNodeType.STRING -> sequenceOf(name to node.textValue().toInputStream()) + JsonNodeType.BINARY -> sequenceOf(name to node.binaryValue().inputStream()) + JsonNodeType.STRING -> sequenceOf(name to node.textValue().inputStream()) JsonNodeType.BOOLEAN -> - sequenceOf(name to node.booleanValue().toString().toInputStream()) + sequenceOf(name to node.booleanValue().toString().inputStream()) JsonNodeType.NUMBER -> - sequenceOf(name to node.numberValue().toString().toInputStream()) + sequenceOf(name to node.numberValue().toString().inputStream()) JsonNodeType.ARRAY -> sequenceOf( name to @@ -104,7 +103,7 @@ internal fun multipartFormData( } } .joinToString(",") - .toInputStream() + .inputStream() ) JsonNodeType.OBJECT -> node.fields().asSequence().flatMap { (key, value) -> @@ -117,7 +116,7 @@ internal fun multipartFormData( ) } - private fun String.toInputStream(): InputStream = ByteArrayInputStream(toByteArray()) + private fun String.inputStream(): InputStream = toByteArray().inputStream() override fun writeTo(outputStream: OutputStream) = entity.writeTo(outputStream) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParamsTest.kt index b06b9fa1..f02bcc14 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParamsTest.kt @@ -2,7 +2,6 @@ package com.openlayer.api.models.inferencepipelines -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -42,7 +41,6 @@ internal class InferencePipelineUpdateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.description()).contains("This pipeline is used for production.") assertThat(body.name()).contains("production") assertThat(body.referenceDatasetUri()).contains("referenceDatasetUri") @@ -56,7 +54,5 @@ internal class InferencePipelineUpdateParamsTest { .build() val body = params._body() - - assertNotNull(body) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParamsTest.kt index e262bd4e..4cfa2546 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParamsTest.kt @@ -3,7 +3,6 @@ package com.openlayer.api.models.inferencepipelines.data import com.openlayer.api.core.JsonValue -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -109,7 +108,6 @@ internal class DataStreamParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.config()) .isEqualTo( DataStreamParams.Config.ofLlmData( @@ -167,7 +165,6 @@ internal class DataStreamParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.config()) .isEqualTo( DataStreamParams.Config.ofLlmData( diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt index 73cabb67..7048734d 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParamsTest.kt @@ -4,7 +4,6 @@ package com.openlayer.api.models.inferencepipelines.rows import com.openlayer.api.core.JsonValue import com.openlayer.api.core.http.QueryParams -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -98,7 +97,6 @@ internal class RowUpdateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body._row()).isEqualTo(JsonValue.from(mapOf())) assertThat(body.config()) .contains( @@ -122,7 +120,6 @@ internal class RowUpdateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body._row()).isEqualTo(JsonValue.from(mapOf())) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateParamsTest.kt index a6dd32da..e9c15aa9 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateParamsTest.kt @@ -3,7 +3,6 @@ package com.openlayer.api.models.projects import java.time.OffsetDateTime -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -97,7 +96,6 @@ internal class ProjectCreateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.creatorId()).contains("589ece63-49a2-41b4-98e1-10547761d4b0") assertThat(body.dateCreated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) @@ -167,7 +165,6 @@ internal class ProjectCreateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.creatorId()).contains("589ece63-49a2-41b4-98e1-10547761d4b0") assertThat(body.dateCreated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt index e9648b98..465adccc 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt @@ -3,7 +3,6 @@ package com.openlayer.api.models.projects.commits import java.time.OffsetDateTime -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -138,7 +137,6 @@ internal class CommitCreateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.commit()) .isEqualTo( @@ -215,7 +213,6 @@ internal class CommitCreateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.commit()) .isEqualTo( diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt index 60fb7650..22054f17 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt @@ -4,7 +4,6 @@ package com.openlayer.api.models.projects.inferencepipelines import java.time.LocalDate import java.time.OffsetDateTime -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -235,7 +234,6 @@ internal class InferencePipelineCreateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.dateCreated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) assertThat(body.dateLastEvaluated()) @@ -362,7 +360,6 @@ internal class InferencePipelineCreateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.dateCreated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) assertThat(body.dateLastEvaluated()) From 5c782e5d75daafb3eea58bbe5c834a3cf3444783 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 22 Mar 2025 04:49:39 +0000 Subject: [PATCH 29/74] chore(internal): fix example formatting (#95) --- openlayer-java-example/build.gradle.kts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/openlayer-java-example/build.gradle.kts b/openlayer-java-example/build.gradle.kts index 20cb067a..24ee916a 100644 --- a/openlayer-java-example/build.gradle.kts +++ b/openlayer-java-example/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("java") + id("openlayer.java") application } @@ -11,10 +11,9 @@ dependencies { implementation(project(":openlayer-java")) } -java { +tasks.withType().configureEach { // Allow using more modern APIs, like `List.of` and `Map.of`, in examples. - sourceCompatibility = JavaVersion.VERSION_1_9 - targetCompatibility = JavaVersion.VERSION_1_9 + options.release.set(9) } application { From 4852f0fc5face081a9d899a940ac15ee771df2e4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 22 Mar 2025 04:53:59 +0000 Subject: [PATCH 30/74] chore(internal): remove unnecessary import (#96) --- .../main/kotlin/com/openlayer/api/core/http/HttpResponse.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponse.kt index 27af0233..c3e59f67 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponse.kt @@ -1,7 +1,8 @@ +// File generated from our OpenAPI spec by Stainless. + package com.openlayer.api.core.http import java.io.InputStream -import java.lang.AutoCloseable interface HttpResponse : AutoCloseable { From 7eafb987ad975163a4bda700271c3c752f6b4430 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 22 Mar 2025 05:06:35 +0000 Subject: [PATCH 31/74] docs: update readme exception docs (#97) --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f2931a45..8afb4d04 100644 --- a/README.md +++ b/README.md @@ -255,16 +255,16 @@ The SDK throws custom unchecked exception types: - [`OpenlayerServiceException`](openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code: - | Status | Exception | - | ------ | ------------------------------- | - | 400 | `BadRequestException` | - | 401 | `AuthenticationException` | - | 403 | `PermissionDeniedException` | - | 404 | `NotFoundException` | - | 422 | `UnprocessableEntityException` | - | 429 | `RateLimitException` | - | 5xx | `InternalServerException` | - | others | `UnexpectedStatusCodeException` | + | Status | Exception | + | ------ | -------------------------------------------------------------------------------------------------------------------------------- | + | 400 | [`BadRequestException`](openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt) | + | 401 | [`UnauthorizedException`](openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt) | + | 403 | [`PermissionDeniedException`](openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt) | + | 404 | [`NotFoundException`](openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt) | + | 422 | [`UnprocessableEntityException`](openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt) | + | 429 | [`RateLimitException`](openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt) | + | 5xx | [`InternalServerException`](openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/InternalServerException.kt) | + | others | [`UnexpectedStatusCodeException`](openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnexpectedStatusCodeException.kt) | - [`OpenlayerIoException`](openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerIoException.kt): I/O networking errors. From dd9ea155bb0a7f67ab500de13ee44def664d253e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 22 Mar 2025 05:09:05 +0000 Subject: [PATCH 32/74] docs: minor readme tweak (#98) --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8afb4d04..12c92b56 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ -The Openlayer Java SDK provides convenient access to the Openlayer REST API from applications written in Java. +The Openlayer Java SDK provides convenient access to the [Openlayer REST API](https://openlayer.com/docs/api-reference/rest/overview) from applications written in Java. It is generated with [Stainless](https://www.stainless.com/). @@ -31,9 +31,9 @@ implementation("com.openlayer.api:openlayer-java:0.1.0-alpha.11") ```xml - com.openlayer.api - openlayer-java - 0.1.0-alpha.11 + com.openlayer.api + openlayer-java + 0.1.0-alpha.11 ``` From 86e936338872071e1dcc80f0549adcb21f8aa205 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Mar 2025 03:16:40 +0000 Subject: [PATCH 33/74] feat(client): support a lower jackson version (#99) feat(client): throw on incompatible jackson version --- .../client/okhttp/OpenlayerOkHttpClient.kt | 11 + .../okhttp/OpenlayerOkHttpClientAsync.kt | 11 + openlayer-java-core/build.gradle.kts | 13 + .../kotlin/com/openlayer/api/core/Check.kt | 46 + .../com/openlayer/api/core/ClientOptions.kt | 14 + .../com/openlayer/api/core/ObjectMappers.kt | 54 +- .../kotlin/com/openlayer/api/core/Values.kt | 20 +- .../api/core/handlers/JsonHandler.kt | 4 +- .../api/errors/BadRequestException.kt | 4 +- .../openlayer/api/errors/NotFoundException.kt | 4 +- .../api/errors/PermissionDeniedException.kt | 4 +- .../api/errors/RateLimitException.kt | 4 +- .../api/errors/UnauthorizedException.kt | 4 +- .../errors/UnprocessableEntityException.kt | 4 +- .../models/commits/CommitRetrieveParams.kt | 22 +- .../models/commits/CommitRetrieveResponse.kt | 393 ++- .../testresults/TestResultListParams.kt | 42 +- .../testresults/TestResultListResponse.kt | 529 ++-- .../InferencePipelineDeleteParams.kt | 47 +- .../InferencePipelineRetrieveParams.kt | 34 +- .../InferencePipelineRetrieveResponse.kt | 892 +++--- .../InferencePipelineUpdateParams.kt | 459 +-- .../InferencePipelineUpdateResponse.kt | 892 +++--- .../data/DataStreamParams.kt | 1232 +++---- .../data/DataStreamResponse.kt | 49 +- .../rows/RowUpdateParams.kt | 419 +-- .../rows/RowUpdateResponse.kt | 52 +- .../testresults/TestResultListParams.kt | 40 +- .../testresults/TestResultListResponse.kt | 529 ++-- .../models/projects/ProjectCreateParams.kt | 1577 ++++----- .../models/projects/ProjectCreateResponse.kt | 369 ++- .../api/models/projects/ProjectListParams.kt | 28 +- .../models/projects/ProjectListResponse.kt | 434 +-- .../projects/commits/CommitCreateParams.kt | 2287 ++++++------- .../projects/commits/CommitCreateResponse.kt | 393 ++- .../projects/commits/CommitListParams.kt | 36 +- .../projects/commits/CommitListResponse.kt | 454 +-- .../InferencePipelineCreateParams.kt | 2818 +++++++++-------- .../InferencePipelineCreateResponse.kt | 892 +++--- .../InferencePipelineListParams.kt | 38 +- .../InferencePipelineListResponse.kt | 962 +++--- .../presignedurl/PresignedUrlCreateParams.kt | 47 +- .../PresignedUrlCreateResponse.kt | 59 +- .../openlayer/api/core/http/SerializerTest.kt | 2 - 44 files changed, 8944 insertions(+), 7280 deletions(-) diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt index 3c01aaec..73445a10 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt @@ -38,6 +38,17 @@ class OpenlayerOkHttpClient private constructor() { this.baseUrl = baseUrl } + /** + * Whether to throw an exception if any of the Jackson versions detected at runtime are + * incompatible with the SDK's minimum supported Jackson version (2.13.4). + * + * Defaults to true. Use extreme caution when disabling this option. There is no guarantee + * that the SDK will work correctly when using an incompatible Jackson version. + */ + fun checkJacksonVersionCompatibility(checkJacksonVersionCompatibility: Boolean) = apply { + clientOptions.checkJacksonVersionCompatibility(checkJacksonVersionCompatibility) + } + fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) } fun clock(clock: Clock) = apply { clientOptions.clock(clock) } diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt index aa03f9cd..54d60721 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt @@ -40,6 +40,17 @@ class OpenlayerOkHttpClientAsync private constructor() { this.baseUrl = baseUrl } + /** + * Whether to throw an exception if any of the Jackson versions detected at runtime are + * incompatible with the SDK's minimum supported Jackson version (2.13.4). + * + * Defaults to true. Use extreme caution when disabling this option. There is no guarantee + * that the SDK will work correctly when using an incompatible Jackson version. + */ + fun checkJacksonVersionCompatibility(checkJacksonVersionCompatibility: Boolean) = apply { + clientOptions.checkJacksonVersionCompatibility(checkJacksonVersionCompatibility) + } + fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) } fun clock(clock: Clock) = apply { clientOptions.clock(clock) } diff --git a/openlayer-java-core/build.gradle.kts b/openlayer-java-core/build.gradle.kts index a6caa5b3..39a6eefe 100644 --- a/openlayer-java-core/build.gradle.kts +++ b/openlayer-java-core/build.gradle.kts @@ -3,6 +3,19 @@ plugins { id("openlayer.publish") } +configurations.all { + resolutionStrategy { + // Compile and test against a lower Jackson version to ensure we're compatible with it. + // We publish with a higher version (see below) to ensure users depend on a secure version by default. + force("com.fasterxml.jackson.core:jackson-core:2.13.4") + force("com.fasterxml.jackson.core:jackson-databind:2.13.4") + force("com.fasterxml.jackson.core:jackson-annotations:2.13.4") + force("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.13.4") + force("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.4") + force("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.4") + } +} + dependencies { api("com.fasterxml.jackson.core:jackson-core:2.18.1") api("com.fasterxml.jackson.core:jackson-databind:2.18.1") diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt index 4101db01..a086432f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt @@ -2,6 +2,9 @@ package com.openlayer.api.core +import com.fasterxml.jackson.core.Version +import com.fasterxml.jackson.core.util.VersionUtil + fun checkRequired(name: String, value: T?): T = checkNotNull(value) { "`$name` is required, but was not set" } @@ -39,3 +42,46 @@ internal fun checkMaxLength(name: String, value: String, maxLength: Int): String "`$name` must have at most length $maxLength, but was ${it.length}" } } + +@JvmSynthetic +internal fun checkJacksonVersionCompatibility() { + val incompatibleJacksonVersions = + RUNTIME_JACKSON_VERSIONS.mapNotNull { + when { + it.majorVersion != MINIMUM_JACKSON_VERSION.majorVersion -> + it to "incompatible major version" + it.minorVersion < MINIMUM_JACKSON_VERSION.minorVersion -> + it to "minor version too low" + it.minorVersion == MINIMUM_JACKSON_VERSION.minorVersion && + it.patchLevel < MINIMUM_JACKSON_VERSION.patchLevel -> + it to "patch version too low" + else -> null + } + } + check(incompatibleJacksonVersions.isEmpty()) { + """ +This SDK depends on Jackson version $MINIMUM_JACKSON_VERSION, but the following incompatible Jackson versions were detected at runtime: + +${incompatibleJacksonVersions.asSequence().map { (version, incompatibilityReason) -> + "- `${version.toFullString().replace("/", ":")}` ($incompatibilityReason)" +}.joinToString("\n")} + +This can happen if you are either: +1. Directly depending on different Jackson versions +2. Depending on some library that depends on different Jackson versions, potentially transitively + +Double-check that you are depending on compatible Jackson versions. + """ + .trimIndent() + } +} + +private val MINIMUM_JACKSON_VERSION: Version = VersionUtil.parseVersion("2.13.4", null, null) +private val RUNTIME_JACKSON_VERSIONS: List = + listOf( + com.fasterxml.jackson.core.json.PackageVersion.VERSION, + com.fasterxml.jackson.databind.cfg.PackageVersion.VERSION, + com.fasterxml.jackson.datatype.jdk8.PackageVersion.VERSION, + com.fasterxml.jackson.datatype.jsr310.PackageVersion.VERSION, + com.fasterxml.jackson.module.kotlin.PackageVersion.VERSION, + ) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt index b1c17e43..39084877 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt @@ -16,6 +16,7 @@ class ClientOptions private constructor( private val originalHttpClient: HttpClient, @get:JvmName("httpClient") val httpClient: HttpClient, + @get:JvmName("checkJacksonVersionCompatibility") val checkJacksonVersionCompatibility: Boolean, @get:JvmName("jsonMapper") val jsonMapper: JsonMapper, @get:JvmName("clock") val clock: Clock, @get:JvmName("baseUrl") val baseUrl: String, @@ -27,6 +28,12 @@ private constructor( private val apiKey: String?, ) { + init { + if (checkJacksonVersionCompatibility) { + checkJacksonVersionCompatibility() + } + } + fun apiKey(): Optional = Optional.ofNullable(apiKey) fun toBuilder() = Builder().from(this) @@ -52,6 +59,7 @@ private constructor( class Builder internal constructor() { private var httpClient: HttpClient? = null + private var checkJacksonVersionCompatibility: Boolean = true private var jsonMapper: JsonMapper = jsonMapper() private var clock: Clock = Clock.systemUTC() private var baseUrl: String = PRODUCTION_URL @@ -65,6 +73,7 @@ private constructor( @JvmSynthetic internal fun from(clientOptions: ClientOptions) = apply { httpClient = clientOptions.originalHttpClient + checkJacksonVersionCompatibility = clientOptions.checkJacksonVersionCompatibility jsonMapper = clientOptions.jsonMapper clock = clientOptions.clock baseUrl = clientOptions.baseUrl @@ -78,6 +87,10 @@ private constructor( fun httpClient(httpClient: HttpClient) = apply { this.httpClient = httpClient } + fun checkJacksonVersionCompatibility(checkJacksonVersionCompatibility: Boolean) = apply { + this.checkJacksonVersionCompatibility = checkJacksonVersionCompatibility + } + fun jsonMapper(jsonMapper: JsonMapper) = apply { this.jsonMapper = jsonMapper } fun clock(clock: Clock) = apply { this.clock = clock } @@ -220,6 +233,7 @@ private constructor( .maxRetries(maxRetries) .build() ), + checkJacksonVersionCompatibility, jsonMapper, clock, baseUrl, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt index f34c69bd..91ac20f1 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt @@ -5,23 +5,19 @@ package com.openlayer.api.core import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.core.JsonGenerator import com.fasterxml.jackson.databind.DeserializationFeature +import com.fasterxml.jackson.databind.MapperFeature import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.databind.cfg.CoercionAction.Fail -import com.fasterxml.jackson.databind.cfg.CoercionInputShape.Integer -import com.fasterxml.jackson.databind.exc.InvalidDefinitionException -import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.databind.module.SimpleModule import com.fasterxml.jackson.datatype.jdk8.Jdk8Module import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule -import com.fasterxml.jackson.module.kotlin.jacksonMapperBuilder -import com.openlayer.api.errors.OpenlayerException -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.fasterxml.jackson.module.kotlin.kotlinModule import java.io.InputStream fun jsonMapper(): JsonMapper = - jacksonMapperBuilder() + JsonMapper.builder() + .addModule(kotlinModule()) .addModule(Jdk8Module()) .addModule(JavaTimeModule()) .addModule(SimpleModule().addSerializer(InputStreamJsonSerializer)) @@ -30,7 +26,12 @@ fun jsonMapper(): JsonMapper = .disable(SerializationFeature.FLUSH_AFTER_WRITE_VALUE) .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .disable(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS) - .withCoercionConfig(String::class.java) { it.setCoercion(Integer, Fail) } + .disable(MapperFeature.ALLOW_COERCION_OF_SCALARS) + .disable(MapperFeature.AUTO_DETECT_CREATORS) + .disable(MapperFeature.AUTO_DETECT_FIELDS) + .disable(MapperFeature.AUTO_DETECT_GETTERS) + .disable(MapperFeature.AUTO_DETECT_IS_GETTERS) + .disable(MapperFeature.AUTO_DETECT_SETTERS) .build() private object InputStreamJsonSerializer : BaseSerializer(InputStream::class) { @@ -47,38 +48,3 @@ private object InputStreamJsonSerializer : BaseSerializer(InputStre } } } - -@JvmSynthetic -internal fun enhanceJacksonException(fallbackMessage: String, e: Exception): Exception { - // These exceptions should only happen if our code is wrong OR if the user is using a binary - // incompatible version of `com.fasterxml.jackson.core:jackson-databind`: - // https://javadoc.io/static/com.fasterxml.jackson.core/jackson-databind/2.18.1/index.html - val isUnexpectedException = - e is UnrecognizedPropertyException || e is InvalidDefinitionException - if (!isUnexpectedException) { - return OpenlayerInvalidDataException(fallbackMessage, e) - } - - val jacksonVersion = JsonMapper::class.java.`package`.implementationVersion - if (jacksonVersion.isNullOrEmpty() || jacksonVersion == COMPILED_JACKSON_VERSION) { - return OpenlayerInvalidDataException(fallbackMessage, e) - } - - return OpenlayerException( - """ - Jackson threw an unexpected exception and its runtime version ($jacksonVersion) mismatches the version the SDK was compiled with ($COMPILED_JACKSON_VERSION). - - You may be using a version of `com.fasterxml.jackson.core:jackson-databind` that's not binary compatible with the SDK. - - This can happen if you are either: - 1. Directly depending on a different Jackson version - 2. Depending on some library that depends on a different Jackson version, potentially transitively - - Double-check that you are depending on a compatible Jackson version. - """ - .trimIndent(), - e, - ) -} - -const val COMPILED_JACKSON_VERSION = "2.18.1" diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt index 3722256a..3fdd3641 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt @@ -1,8 +1,6 @@ package com.openlayer.api.core import com.fasterxml.jackson.annotation.JacksonAnnotationsInside -import com.fasterxml.jackson.annotation.JsonAutoDetect -import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.core.JsonGenerator @@ -451,19 +449,9 @@ private constructor( @JsonInclude(JsonInclude.Include.CUSTOM, valueFilter = JsonField.IsMissing::class) annotation class ExcludeMissing -@JacksonAnnotationsInside -@JsonAutoDetect( - getterVisibility = Visibility.NONE, - isGetterVisibility = Visibility.NONE, - setterVisibility = Visibility.NONE, - creatorVisibility = Visibility.NONE, - fieldVisibility = Visibility.NONE, -) -annotation class NoAutoDetect - class MultipartField private constructor( - @get:JvmName("value") val value: JsonField, + @get:com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: JsonField, @get:JvmName("contentType") val contentType: String, private val filename: String?, ) { @@ -481,11 +469,7 @@ private constructor( @JvmSynthetic internal fun map(transform: (T) -> R): MultipartField = - MultipartField.builder() - .value(value.map(transform)) - .contentType(contentType) - .filename(filename) - .build() + builder().value(value.map(transform)).contentType(contentType).filename(filename).build() /** A builder for [MultipartField]. */ class Builder internal constructor() { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/JsonHandler.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/JsonHandler.kt index 9ed794b1..a020c1c1 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/JsonHandler.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/JsonHandler.kt @@ -4,9 +4,9 @@ package com.openlayer.api.core.handlers import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.openlayer.api.core.enhanceJacksonException import com.openlayer.api.core.http.HttpResponse import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.errors.OpenlayerInvalidDataException @JvmSynthetic internal inline fun jsonHandler(jsonMapper: JsonMapper): Handler = @@ -15,6 +15,6 @@ internal inline fun jsonHandler(jsonMapper: JsonMapper): Handler try { jsonMapper.readValue(response.body(), jacksonTypeRef()) } catch (e: Exception) { - throw enhanceJacksonException("Error reading response", e) + throw OpenlayerInvalidDataException("Error reading response", e) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt index ea4fa913..9acdcaa2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt @@ -12,12 +12,12 @@ class BadRequestException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : OpenlayerServiceException("400: $body", cause) { + override fun statusCode(): Int = 400 + override fun headers(): Headers = headers override fun body(): JsonValue = body - override fun statusCode(): Int = 400 - fun toBuilder() = Builder().from(this) companion object { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt index 7bbae3bb..4bf98a53 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt @@ -12,12 +12,12 @@ class NotFoundException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : OpenlayerServiceException("404: $body", cause) { + override fun statusCode(): Int = 404 + override fun headers(): Headers = headers override fun body(): JsonValue = body - override fun statusCode(): Int = 404 - fun toBuilder() = Builder().from(this) companion object { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt index f931e74c..844dd555 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt @@ -12,12 +12,12 @@ class PermissionDeniedException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : OpenlayerServiceException("403: $body", cause) { + override fun statusCode(): Int = 403 + override fun headers(): Headers = headers override fun body(): JsonValue = body - override fun statusCode(): Int = 403 - fun toBuilder() = Builder().from(this) companion object { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt index fa8e4df3..a3fba535 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt @@ -12,12 +12,12 @@ class RateLimitException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : OpenlayerServiceException("429: $body", cause) { + override fun statusCode(): Int = 429 + override fun headers(): Headers = headers override fun body(): JsonValue = body - override fun statusCode(): Int = 429 - fun toBuilder() = Builder().from(this) companion object { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt index 3a0c1cda..ead1e7c7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt @@ -12,12 +12,12 @@ class UnauthorizedException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : OpenlayerServiceException("401: $body", cause) { + override fun statusCode(): Int = 401 + override fun headers(): Headers = headers override fun body(): JsonValue = body - override fun statusCode(): Int = 401 - fun toBuilder() = Builder().from(this) companion object { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt index ceeaf6b6..10abb5a2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt @@ -12,12 +12,12 @@ class UnprocessableEntityException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : OpenlayerServiceException("422: $body", cause) { + override fun statusCode(): Int = 422 + override fun headers(): Headers = headers override fun body(): JsonValue = body - override fun statusCode(): Int = 422 - fun toBuilder() = Builder().from(this) companion object { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveParams.kt index 9f80ee28..258b399a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveParams.kt @@ -2,7 +2,6 @@ package com.openlayer.api.models.commits -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers @@ -23,16 +22,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _pathParam(index: Int): String = - when (index) { - 0 -> projectVersionId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - fun toBuilder() = Builder().from(this) companion object { @@ -49,7 +38,6 @@ private constructor( } /** A builder for [CommitRetrieveParams]. */ - @NoAutoDetect class Builder internal constructor() { private var projectVersionId: String? = null @@ -185,6 +173,16 @@ private constructor( ) } + fun _pathParam(index: Int): String = + when (index) { + 0 -> projectVersionId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt index 16eef454..31176c2d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt @@ -11,70 +11,96 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.checkRequired -import com.openlayer.api.core.immutableEmptyMap -import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -@NoAutoDetect class CommitRetrieveResponse -@JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("commit") - @ExcludeMissing - private val commit: JsonField = JsonMissing.of(), - @JsonProperty("dateArchived") - @ExcludeMissing - private val dateArchived: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("failingGoalCount") - @ExcludeMissing - private val failingGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("mlModelId") - @ExcludeMissing - private val mlModelId: JsonField = JsonMissing.of(), - @JsonProperty("passingGoalCount") - @ExcludeMissing - private val passingGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("projectId") - @ExcludeMissing - private val projectId: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("statusMessage") - @ExcludeMissing - private val statusMessage: JsonField = JsonMissing.of(), - @JsonProperty("storageUri") - @ExcludeMissing - private val storageUri: JsonField = JsonMissing.of(), - @JsonProperty("totalGoalCount") - @ExcludeMissing - private val totalGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("trainingDatasetId") - @ExcludeMissing - private val trainingDatasetId: JsonField = JsonMissing.of(), - @JsonProperty("validationDatasetId") - @ExcludeMissing - private val validationDatasetId: JsonField = JsonMissing.of(), - @JsonProperty("archived") - @ExcludeMissing - private val archived: JsonField = JsonMissing.of(), - @JsonProperty("deploymentStatus") - @ExcludeMissing - private val deploymentStatus: JsonField = JsonMissing.of(), - @JsonProperty("links") @ExcludeMissing private val links: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val commit: JsonField, + private val dateArchived: JsonField, + private val dateCreated: JsonField, + private val failingGoalCount: JsonField, + private val mlModelId: JsonField, + private val passingGoalCount: JsonField, + private val projectId: JsonField, + private val status: JsonField, + private val statusMessage: JsonField, + private val storageUri: JsonField, + private val totalGoalCount: JsonField, + private val trainingDatasetId: JsonField, + private val validationDatasetId: JsonField, + private val archived: JsonField, + private val deploymentStatus: JsonField, + private val links: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("commit") @ExcludeMissing commit: JsonField = JsonMissing.of(), + @JsonProperty("dateArchived") + @ExcludeMissing + dateArchived: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("failingGoalCount") + @ExcludeMissing + failingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("mlModelId") @ExcludeMissing mlModelId: JsonField = JsonMissing.of(), + @JsonProperty("passingGoalCount") + @ExcludeMissing + passingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("projectId") @ExcludeMissing projectId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + storageUri: JsonField = JsonMissing.of(), + @JsonProperty("totalGoalCount") + @ExcludeMissing + totalGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("trainingDatasetId") + @ExcludeMissing + trainingDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("validationDatasetId") + @ExcludeMissing + validationDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("archived") @ExcludeMissing archived: JsonField = JsonMissing.of(), + @JsonProperty("deploymentStatus") + @ExcludeMissing + deploymentStatus: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing links: JsonField = JsonMissing.of(), + ) : this( + id, + commit, + dateArchived, + dateCreated, + failingGoalCount, + mlModelId, + passingGoalCount, + projectId, + status, + statusMessage, + storageUri, + totalGoalCount, + trainingDatasetId, + validationDatasetId, + archived, + deploymentStatus, + links, + mutableMapOf(), + ) + /** * The project version (commit) id. * @@ -357,36 +383,15 @@ private constructor( */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): CommitRetrieveResponse = apply { - if (validated) { - return@apply - } - - id() - commit().validate() - dateArchived() - dateCreated() - failingGoalCount() - mlModelId() - passingGoalCount() - projectId() - status() - statusMessage() - storageUri() - totalGoalCount() - trainingDatasetId() - validationDatasetId() - archived() - deploymentStatus() - links().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -781,53 +786,103 @@ private constructor( archived, deploymentStatus, links, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): CommitRetrieveResponse = apply { + if (validated) { + return@apply + } + + id() + commit().validate() + dateArchived() + dateCreated() + failingGoalCount() + mlModelId() + passingGoalCount() + projectId() + status() + statusMessage() + storageUri() + totalGoalCount() + trainingDatasetId() + validationDatasetId() + archived() + deploymentStatus() + links().ifPresent { it.validate() } + validated = true + } + /** The details of a commit (project version). */ - @NoAutoDetect class Commit - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("authorId") - @ExcludeMissing - private val authorId: JsonField = JsonMissing.of(), - @JsonProperty("fileSize") - @ExcludeMissing - private val fileSize: JsonField = JsonMissing.of(), - @JsonProperty("message") - @ExcludeMissing - private val message: JsonField = JsonMissing.of(), - @JsonProperty("mlModelId") - @ExcludeMissing - private val mlModelId: JsonField = JsonMissing.of(), - @JsonProperty("storageUri") - @ExcludeMissing - private val storageUri: JsonField = JsonMissing.of(), - @JsonProperty("trainingDatasetId") - @ExcludeMissing - private val trainingDatasetId: JsonField = JsonMissing.of(), - @JsonProperty("validationDatasetId") - @ExcludeMissing - private val validationDatasetId: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("gitCommitRef") - @ExcludeMissing - private val gitCommitRef: JsonField = JsonMissing.of(), - @JsonProperty("gitCommitSha") - @ExcludeMissing - private val gitCommitSha: JsonField = JsonMissing.of(), - @JsonProperty("gitCommitUrl") - @ExcludeMissing - private val gitCommitUrl: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val authorId: JsonField, + private val fileSize: JsonField, + private val message: JsonField, + private val mlModelId: JsonField, + private val storageUri: JsonField, + private val trainingDatasetId: JsonField, + private val validationDatasetId: JsonField, + private val dateCreated: JsonField, + private val gitCommitRef: JsonField, + private val gitCommitSha: JsonField, + private val gitCommitUrl: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("authorId") + @ExcludeMissing + authorId: JsonField = JsonMissing.of(), + @JsonProperty("fileSize") @ExcludeMissing fileSize: JsonField = JsonMissing.of(), + @JsonProperty("message") @ExcludeMissing message: JsonField = JsonMissing.of(), + @JsonProperty("mlModelId") + @ExcludeMissing + mlModelId: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + storageUri: JsonField = JsonMissing.of(), + @JsonProperty("trainingDatasetId") + @ExcludeMissing + trainingDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("validationDatasetId") + @ExcludeMissing + validationDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitRef") + @ExcludeMissing + gitCommitRef: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitSha") + @ExcludeMissing + gitCommitSha: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitUrl") + @ExcludeMissing + gitCommitUrl: JsonField = JsonMissing.of(), + ) : this( + id, + authorId, + fileSize, + message, + mlModelId, + storageUri, + trainingDatasetId, + validationDatasetId, + dateCreated, + gitCommitRef, + gitCommitSha, + gitCommitUrl, + mutableMapOf(), + ) + /** * The commit id. * @@ -1033,31 +1088,15 @@ private constructor( @ExcludeMissing fun _gitCommitUrl(): JsonField = gitCommitUrl + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Commit = apply { - if (validated) { - return@apply - } - - id() - authorId() - fileSize() - message() - mlModelId() - storageUri() - trainingDatasetId() - validationDatasetId() - dateCreated() - gitCommitRef() - gitCommitSha() - gitCommitUrl() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1351,10 +1390,32 @@ private constructor( gitCommitRef, gitCommitSha, gitCommitUrl, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Commit = apply { + if (validated) { + return@apply + } + + id() + authorId() + fileSize() + message() + mlModelId() + storageUri() + trainingDatasetId() + validationDatasetId() + dateCreated() + gitCommitRef() + gitCommitSha() + gitCommitUrl() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1501,15 +1562,17 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class Links - @JsonCreator private constructor( - @JsonProperty("app") @ExcludeMissing private val app: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val app: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing app: JsonField = JsonMissing.of() + ) : this(app, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -1523,20 +1586,15 @@ private constructor( */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Links = apply { - if (validated) { - return@apply - } - - app() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1608,7 +1666,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): Links = - Links(checkRequired("app", app), additionalProperties.toImmutable()) + Links(checkRequired("app", app), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt index f1bd55d7..19d68260 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt @@ -5,7 +5,6 @@ package com.openlayer.api.models.commits.testresults import com.fasterxml.jackson.annotation.JsonCreator import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers @@ -55,26 +54,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _pathParam(index: Int): String = - when (index) { - 0 -> projectVersionId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - includeArchived?.let { put("includeArchived", it.toString()) } - page?.let { put("page", it.toString()) } - perPage?.let { put("perPage", it.toString()) } - status?.let { put("status", it.toString()) } - type?.let { put("type", it.toString()) } - putAll(additionalQueryParams) - } - .build() - fun toBuilder() = Builder().from(this) companion object { @@ -91,7 +70,6 @@ private constructor( } /** A builder for [TestResultListParams]. */ - @NoAutoDetect class Builder internal constructor() { private var projectVersionId: String? = null @@ -302,6 +280,26 @@ private constructor( ) } + fun _pathParam(index: Int): String = + when (index) { + 0 -> projectVersionId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + includeArchived?.let { put("includeArchived", it.toString()) } + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + status?.let { put("status", it.toString()) } + type?.let { put("type", it.toString()) } + putAll(additionalQueryParams) + } + .build() + /** * Filter list of test results by status. Available statuses are `running`, `passing`, * `failing`, `skipped`, and `error`. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt index c52ee6fd..c369a606 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt @@ -20,28 +20,28 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired import com.openlayer.api.core.getOrThrow -import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -@NoAutoDetect class TestResultListResponse -@JsonCreator private constructor( - @JsonProperty("items") - @ExcludeMissing - private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val items: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -55,20 +55,15 @@ private constructor( */ @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): TestResultListResponse = apply { - if (validated) { - return@apply - } - - items().forEach { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -154,47 +149,79 @@ private constructor( fun build(): TestResultListResponse = TestResultListResponse( checkRequired("items", items).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): TestResultListResponse = apply { + if (validated) { + return@apply + } + + items().forEach { it.validate() } + validated = true + } + class Item - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateDataEnds") - @ExcludeMissing - private val dateDataEnds: JsonField = JsonMissing.of(), - @JsonProperty("dateDataStarts") - @ExcludeMissing - private val dateDataStarts: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("inferencePipelineId") - @ExcludeMissing - private val inferencePipelineId: JsonField = JsonMissing.of(), - @JsonProperty("projectVersionId") - @ExcludeMissing - private val projectVersionId: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("statusMessage") - @ExcludeMissing - private val statusMessage: JsonField = JsonMissing.of(), - @JsonProperty("goal") @ExcludeMissing private val goal: JsonField = JsonMissing.of(), - @JsonProperty("goalId") - @ExcludeMissing - private val goalId: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val dateCreated: JsonField, + private val dateDataEnds: JsonField, + private val dateDataStarts: JsonField, + private val dateUpdated: JsonField, + private val inferencePipelineId: JsonField, + private val projectVersionId: JsonField, + private val status: JsonField, + private val statusMessage: JsonField, + private val goal: JsonField, + private val goalId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateDataEnds") + @ExcludeMissing + dateDataEnds: JsonField = JsonMissing.of(), + @JsonProperty("dateDataStarts") + @ExcludeMissing + dateDataStarts: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineId") + @ExcludeMissing + inferencePipelineId: JsonField = JsonMissing.of(), + @JsonProperty("projectVersionId") + @ExcludeMissing + projectVersionId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("goal") @ExcludeMissing goal: JsonField = JsonMissing.of(), + @JsonProperty("goalId") @ExcludeMissing goalId: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateDataEnds, + dateDataStarts, + dateUpdated, + inferencePipelineId, + projectVersionId, + status, + statusMessage, + goal, + goalId, + mutableMapOf(), + ) + /** * Project version (commit) id. * @@ -382,30 +409,15 @@ private constructor( */ @JsonProperty("goalId") @ExcludeMissing fun _goalId(): JsonField = goalId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Item = apply { - if (validated) { - return@apply - } - - id() - dateCreated() - dateDataEnds() - dateDataStarts() - dateUpdated() - inferencePipelineId() - projectVersionId() - status() - statusMessage() - goal().ifPresent { it.validate() } - goalId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -692,10 +704,31 @@ private constructor( checkRequired("statusMessage", statusMessage), goal, goalId, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateDataEnds() + dateDataStarts() + dateUpdated() + inferencePipelineId() + projectVersionId() + status() + statusMessage() + goal().ifPresent { it.validate() } + goalId() + validated = true + } + /** The status of the test. */ class Status @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -817,80 +850,119 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class Goal - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("commentCount") - @ExcludeMissing - private val commentCount: JsonField = JsonMissing.of(), - @JsonProperty("creatorId") - @ExcludeMissing - private val creatorId: JsonField = JsonMissing.of(), - @JsonProperty("dateArchived") - @ExcludeMissing - private val dateArchived: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonValue = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("number") - @ExcludeMissing - private val number: JsonField = JsonMissing.of(), - @JsonProperty("originProjectVersionId") - @ExcludeMissing - private val originProjectVersionId: JsonField = JsonMissing.of(), - @JsonProperty("subtype") - @ExcludeMissing - private val subtype: JsonField = JsonMissing.of(), - @JsonProperty("suggested") - @ExcludeMissing - private val suggested: JsonField = JsonMissing.of(), - @JsonProperty("thresholds") - @ExcludeMissing - private val thresholds: JsonField> = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonProperty("archived") - @ExcludeMissing - private val archived: JsonField = JsonMissing.of(), - @JsonProperty("delayWindow") - @ExcludeMissing - private val delayWindow: JsonField = JsonMissing.of(), - @JsonProperty("evaluationWindow") - @ExcludeMissing - private val evaluationWindow: JsonField = JsonMissing.of(), - @JsonProperty("usesMlModel") - @ExcludeMissing - private val usesMlModel: JsonField = JsonMissing.of(), - @JsonProperty("usesProductionData") - @ExcludeMissing - private val usesProductionData: JsonField = JsonMissing.of(), - @JsonProperty("usesReferenceDataset") - @ExcludeMissing - private val usesReferenceDataset: JsonField = JsonMissing.of(), - @JsonProperty("usesTrainingDataset") - @ExcludeMissing - private val usesTrainingDataset: JsonField = JsonMissing.of(), - @JsonProperty("usesValidationDataset") - @ExcludeMissing - private val usesValidationDataset: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val commentCount: JsonField, + private val creatorId: JsonField, + private val dateArchived: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val description: JsonValue, + private val name: JsonField, + private val number: JsonField, + private val originProjectVersionId: JsonField, + private val subtype: JsonField, + private val suggested: JsonField, + private val thresholds: JsonField>, + private val type: JsonField, + private val archived: JsonField, + private val delayWindow: JsonField, + private val evaluationWindow: JsonField, + private val usesMlModel: JsonField, + private val usesProductionData: JsonField, + private val usesReferenceDataset: JsonField, + private val usesTrainingDataset: JsonField, + private val usesValidationDataset: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("commentCount") + @ExcludeMissing + commentCount: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateArchived") + @ExcludeMissing + dateArchived: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonValue = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("number") @ExcludeMissing number: JsonField = JsonMissing.of(), + @JsonProperty("originProjectVersionId") + @ExcludeMissing + originProjectVersionId: JsonField = JsonMissing.of(), + @JsonProperty("subtype") + @ExcludeMissing + subtype: JsonField = JsonMissing.of(), + @JsonProperty("suggested") + @ExcludeMissing + suggested: JsonField = JsonMissing.of(), + @JsonProperty("thresholds") + @ExcludeMissing + thresholds: JsonField> = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("archived") + @ExcludeMissing + archived: JsonField = JsonMissing.of(), + @JsonProperty("delayWindow") + @ExcludeMissing + delayWindow: JsonField = JsonMissing.of(), + @JsonProperty("evaluationWindow") + @ExcludeMissing + evaluationWindow: JsonField = JsonMissing.of(), + @JsonProperty("usesMlModel") + @ExcludeMissing + usesMlModel: JsonField = JsonMissing.of(), + @JsonProperty("usesProductionData") + @ExcludeMissing + usesProductionData: JsonField = JsonMissing.of(), + @JsonProperty("usesReferenceDataset") + @ExcludeMissing + usesReferenceDataset: JsonField = JsonMissing.of(), + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + usesTrainingDataset: JsonField = JsonMissing.of(), + @JsonProperty("usesValidationDataset") + @ExcludeMissing + usesValidationDataset: JsonField = JsonMissing.of(), + ) : this( + id, + commentCount, + creatorId, + dateArchived, + dateCreated, + dateUpdated, + description, + name, + number, + originProjectVersionId, + subtype, + suggested, + thresholds, + type, + archived, + delayWindow, + evaluationWindow, + usesMlModel, + usesProductionData, + usesReferenceDataset, + usesTrainingDataset, + usesValidationDataset, + mutableMapOf(), + ) + /** * The test id. * @@ -1274,40 +1346,15 @@ private constructor( @ExcludeMissing fun _usesValidationDataset(): JsonField = usesValidationDataset + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Goal = apply { - if (validated) { - return@apply - } - - id() - commentCount() - creatorId() - dateArchived() - dateCreated() - dateUpdated() - name() - number() - originProjectVersionId() - subtype() - suggested() - thresholds().forEach { it.validate() } - type() - archived() - delayWindow() - evaluationWindow() - usesMlModel() - usesProductionData() - usesReferenceDataset() - usesTrainingDataset() - usesValidationDataset() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1806,33 +1853,77 @@ private constructor( usesReferenceDataset, usesTrainingDataset, usesValidationDataset, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): Goal = apply { + if (validated) { + return@apply + } + + id() + commentCount() + creatorId() + dateArchived() + dateCreated() + dateUpdated() + name() + number() + originProjectVersionId() + subtype() + suggested() + thresholds().forEach { it.validate() } + type() + archived() + delayWindow() + evaluationWindow() + usesMlModel() + usesProductionData() + usesReferenceDataset() + usesTrainingDataset() + usesValidationDataset() + validated = true + } + class Threshold - @JsonCreator private constructor( - @JsonProperty("insightName") - @ExcludeMissing - private val insightName: JsonField = JsonMissing.of(), - @JsonProperty("insightParameters") - @ExcludeMissing - private val insightParameters: JsonField> = JsonMissing.of(), - @JsonProperty("measurement") - @ExcludeMissing - private val measurement: JsonField = JsonMissing.of(), - @JsonProperty("operator") - @ExcludeMissing - private val operator: JsonField = JsonMissing.of(), - @JsonProperty("value") - @ExcludeMissing - private val value: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val insightName: JsonField, + private val insightParameters: JsonField>, + private val measurement: JsonField, + private val operator: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("insightName") + @ExcludeMissing + insightName: JsonField = JsonMissing.of(), + @JsonProperty("insightParameters") + @ExcludeMissing + insightParameters: JsonField> = JsonMissing.of(), + @JsonProperty("measurement") + @ExcludeMissing + measurement: JsonField = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + operator: JsonField = JsonMissing.of(), + @JsonProperty("value") + @ExcludeMissing + value: JsonField = JsonMissing.of(), + ) : this( + insightName, + insightParameters, + measurement, + operator, + value, + mutableMapOf(), + ) + /** * The insight name to be evaluated. * @@ -1923,24 +2014,15 @@ private constructor( */ @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Threshold = apply { - if (validated) { - return@apply - } - - insightName() - insightParameters() - measurement() - operator() - value().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2094,10 +2176,25 @@ private constructor( measurement, operator, value, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Threshold = apply { + if (validated) { + return@apply + } + + insightName() + insightParameters() + measurement() + operator() + value().ifPresent { it.validate() } + validated = true + } + /** The value to be compared. */ @JsonDeserialize(using = Value.Deserializer::class) @JsonSerialize(using = Value.Serializer::class) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt index c14f9ba7..c796b320 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt @@ -2,13 +2,15 @@ package com.openlayer.api.models.inferencepipelines +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams -import com.openlayer.api.core.toImmutable +import java.util.Collections import java.util.Objects import java.util.Optional @@ -18,7 +20,7 @@ private constructor( private val inferencePipelineId: String, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, + private val additionalBodyProperties: MutableMap, ) : Params { fun inferencePipelineId(): String = inferencePipelineId @@ -27,21 +29,15 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun _body(): Optional> = - Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - - fun _pathParam(index: Int): String = - when (index) { - 0 -> inferencePipelineId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders + @JsonAnySetter + private fun putAdditionalBodyProperty(key: String, value: JsonValue) { + additionalBodyProperties.put(key, value) + } - override fun _queryParams(): QueryParams = additionalQueryParams + @JsonAnyGetter + @ExcludeMissing + fun _additionalBodyProperties(): Map = + Collections.unmodifiableMap(additionalBodyProperties) fun toBuilder() = Builder().from(this) @@ -60,7 +56,6 @@ private constructor( } /** A builder for [InferencePipelineDeleteParams]. */ - @NoAutoDetect class Builder internal constructor() { private var inferencePipelineId: String? = null @@ -218,10 +213,24 @@ private constructor( checkRequired("inferencePipelineId", inferencePipelineId), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), + additionalBodyProperties.toMutableMap(), ) } + @JvmSynthetic + internal fun _body(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + + fun _pathParam(index: Int): String = + when (index) { + 0 -> inferencePipelineId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt index e4e48e37..3110a204 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt @@ -5,7 +5,6 @@ package com.openlayer.api.models.inferencepipelines import com.fasterxml.jackson.annotation.JsonCreator import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers @@ -34,22 +33,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _pathParam(index: Int): String = - when (index) { - 0 -> inferencePipelineId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - expand?.let { put("expand", it.joinToString(",") { it.toString() }) } - putAll(additionalQueryParams) - } - .build() - fun toBuilder() = Builder().from(this) companion object { @@ -67,7 +50,6 @@ private constructor( } /** A builder for [InferencePipelineRetrieveParams]. */ - @NoAutoDetect class Builder internal constructor() { private var inferencePipelineId: String? = null @@ -223,6 +205,22 @@ private constructor( ) } + fun _pathParam(index: Int): String = + when (index) { + 0 -> inferencePipelineId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + expand?.let { put("expand", it.joinToString(",") { it.toString() }) } + putAll(additionalQueryParams) + } + .build() + class Expand @JsonCreator private constructor(private val value: JsonField) : Enum { /** diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt index 28df1f63..05bbb2ae 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt @@ -11,73 +11,106 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired -import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.LocalDate import java.time.OffsetDateTime +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -@NoAutoDetect class InferencePipelineRetrieveResponse -@JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateLastEvaluated") - @ExcludeMissing - private val dateLastEvaluated: JsonField = JsonMissing.of(), - @JsonProperty("dateLastSampleReceived") - @ExcludeMissing - private val dateLastSampleReceived: JsonField = JsonMissing.of(), - @JsonProperty("dateOfNextEvaluation") - @ExcludeMissing - private val dateOfNextEvaluation: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("failingGoalCount") - @ExcludeMissing - private val failingGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("links") @ExcludeMissing private val links: JsonField = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), - @JsonProperty("passingGoalCount") - @ExcludeMissing - private val passingGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("projectId") - @ExcludeMissing - private val projectId: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("statusMessage") - @ExcludeMissing - private val statusMessage: JsonField = JsonMissing.of(), - @JsonProperty("totalGoalCount") - @ExcludeMissing - private val totalGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("project") - @ExcludeMissing - private val project: JsonField = JsonMissing.of(), - @JsonProperty("workspace") - @ExcludeMissing - private val workspace: JsonField = JsonMissing.of(), - @JsonProperty("workspaceId") - @ExcludeMissing - private val workspaceId: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val dateCreated: JsonField, + private val dateLastEvaluated: JsonField, + private val dateLastSampleReceived: JsonField, + private val dateOfNextEvaluation: JsonField, + private val dateUpdated: JsonField, + private val description: JsonField, + private val failingGoalCount: JsonField, + private val links: JsonField, + private val name: JsonField, + private val passingGoalCount: JsonField, + private val projectId: JsonField, + private val status: JsonField, + private val statusMessage: JsonField, + private val totalGoalCount: JsonField, + private val project: JsonField, + private val workspace: JsonField, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastSampleReceived") + @ExcludeMissing + dateLastSampleReceived: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("failingGoalCount") + @ExcludeMissing + failingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing links: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("passingGoalCount") + @ExcludeMissing + passingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("projectId") @ExcludeMissing projectId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("totalGoalCount") + @ExcludeMissing + totalGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("project") @ExcludeMissing project: JsonField = JsonMissing.of(), + @JsonProperty("workspace") + @ExcludeMissing + workspace: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateLastEvaluated, + dateLastSampleReceived, + dateOfNextEvaluation, + dateUpdated, + description, + failingGoalCount, + links, + name, + passingGoalCount, + projectId, + status, + statusMessage, + totalGoalCount, + project, + workspace, + workspaceId, + mutableMapOf(), + ) + /** * The inference pipeline id. * @@ -371,37 +404,15 @@ private constructor( */ @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): InferencePipelineRetrieveResponse = apply { - if (validated) { - return@apply - } - - id() - dateCreated() - dateLastEvaluated() - dateLastSampleReceived() - dateOfNextEvaluation() - dateUpdated() - description() - failingGoalCount() - links().validate() - name() - passingGoalCount() - projectId() - status() - statusMessage() - totalGoalCount() - project().ifPresent { it.validate() } - workspace().ifPresent { it.validate() } - workspaceId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -809,19 +820,49 @@ private constructor( project, workspace, workspaceId, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): InferencePipelineRetrieveResponse = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateLastEvaluated() + dateLastSampleReceived() + dateOfNextEvaluation() + dateUpdated() + description() + failingGoalCount() + links().validate() + name() + passingGoalCount() + projectId() + status() + statusMessage() + totalGoalCount() + project().ifPresent { it.validate() } + workspace().ifPresent { it.validate() } + workspaceId() + validated = true + } + class Links - @JsonCreator private constructor( - @JsonProperty("app") @ExcludeMissing private val app: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val app: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing app: JsonField = JsonMissing.of() + ) : this(app, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -835,20 +876,15 @@ private constructor( */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Links = apply { - if (validated) { - return@apply - } - - app() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -920,7 +956,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): Links = - Links(checkRequired("app", app), additionalProperties.toImmutable()) + Links(checkRequired("app", app), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true } override fun equals(other: Any?): Boolean { @@ -1065,60 +1112,87 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class Project - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("creatorId") - @ExcludeMissing - private val creatorId: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("developmentGoalCount") - @ExcludeMissing - private val developmentGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("goalCount") - @ExcludeMissing - private val goalCount: JsonField = JsonMissing.of(), - @JsonProperty("inferencePipelineCount") - @ExcludeMissing - private val inferencePipelineCount: JsonField = JsonMissing.of(), - @JsonProperty("links") - @ExcludeMissing - private val links: JsonField = JsonMissing.of(), - @JsonProperty("monitoringGoalCount") - @ExcludeMissing - private val monitoringGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("source") - @ExcludeMissing - private val source: JsonField = JsonMissing.of(), - @JsonProperty("taskType") - @ExcludeMissing - private val taskType: JsonField = JsonMissing.of(), - @JsonProperty("versionCount") - @ExcludeMissing - private val versionCount: JsonField = JsonMissing.of(), - @JsonProperty("workspaceId") - @ExcludeMissing - private val workspaceId: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("gitRepo") - @ExcludeMissing - private val gitRepo: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val developmentGoalCount: JsonField, + private val goalCount: JsonField, + private val inferencePipelineCount: JsonField, + private val links: JsonField, + private val monitoringGoalCount: JsonField, + private val name: JsonField, + private val source: JsonField, + private val taskType: JsonField, + private val versionCount: JsonField, + private val workspaceId: JsonField, + private val description: JsonField, + private val gitRepo: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("developmentGoalCount") + @ExcludeMissing + developmentGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("goalCount") + @ExcludeMissing + goalCount: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + inferencePipelineCount: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing links: JsonField = JsonMissing.of(), + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + monitoringGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("source") @ExcludeMissing source: JsonField = JsonMissing.of(), + @JsonProperty("taskType") + @ExcludeMissing + taskType: JsonField = JsonMissing.of(), + @JsonProperty("versionCount") + @ExcludeMissing + versionCount: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("gitRepo") @ExcludeMissing gitRepo: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + developmentGoalCount, + goalCount, + inferencePipelineCount, + links, + monitoringGoalCount, + name, + source, + taskType, + versionCount, + workspaceId, + description, + gitRepo, + mutableMapOf(), + ) + /** * The project id. * @@ -1380,35 +1454,15 @@ private constructor( */ @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Project = apply { - if (validated) { - return@apply - } - - id() - creatorId() - dateCreated() - dateUpdated() - developmentGoalCount() - goalCount() - inferencePipelineCount() - links().validate() - monitoringGoalCount() - name() - source() - taskType() - versionCount() - workspaceId() - description() - gitRepo().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1767,22 +1821,48 @@ private constructor( checkRequired("workspaceId", workspaceId), description, gitRepo, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Project = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + developmentGoalCount() + goalCount() + inferencePipelineCount() + links().validate() + monitoringGoalCount() + name() + source() + taskType() + versionCount() + workspaceId() + description() + gitRepo().ifPresent { it.validate() } + validated = true + } + /** Links to the project. */ - @NoAutoDetect class Links - @JsonCreator private constructor( - @JsonProperty("app") - @ExcludeMissing - private val app: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val app: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing app: JsonField = JsonMissing.of() + ) : this(app, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -1797,20 +1877,15 @@ private constructor( */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Links = apply { - if (validated) { - return@apply - } - - app() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1885,7 +1960,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): Links = - Links(checkRequired("app", app), additionalProperties.toImmutable()) + Links(checkRequired("app", app), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true } override fun equals(other: Any?): Boolean { @@ -2130,50 +2216,67 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class GitRepo - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("dateConnected") - @ExcludeMissing - private val dateConnected: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("gitAccountId") - @ExcludeMissing - private val gitAccountId: JsonField = JsonMissing.of(), - @JsonProperty("gitId") - @ExcludeMissing - private val gitId: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("private") - @ExcludeMissing - private val private_: JsonField = JsonMissing.of(), - @JsonProperty("projectId") - @ExcludeMissing - private val projectId: JsonField = JsonMissing.of(), - @JsonProperty("slug") - @ExcludeMissing - private val slug: JsonField = JsonMissing.of(), - @JsonProperty("url") - @ExcludeMissing - private val url: JsonField = JsonMissing.of(), - @JsonProperty("branch") - @ExcludeMissing - private val branch: JsonField = JsonMissing.of(), - @JsonProperty("rootDir") - @ExcludeMissing - private val rootDir: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val dateConnected: JsonField, + private val dateUpdated: JsonField, + private val gitAccountId: JsonField, + private val gitId: JsonField, + private val name: JsonField, + private val private_: JsonField, + private val projectId: JsonField, + private val slug: JsonField, + private val url: JsonField, + private val branch: JsonField, + private val rootDir: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateConnected") + @ExcludeMissing + dateConnected: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("gitAccountId") + @ExcludeMissing + gitAccountId: JsonField = JsonMissing.of(), + @JsonProperty("gitId") @ExcludeMissing gitId: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("private") + @ExcludeMissing + private_: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("url") @ExcludeMissing url: JsonField = JsonMissing.of(), + @JsonProperty("branch") + @ExcludeMissing + branch: JsonField = JsonMissing.of(), + @JsonProperty("rootDir") + @ExcludeMissing + rootDir: JsonField = JsonMissing.of(), + ) : this( + id, + dateConnected, + dateUpdated, + gitAccountId, + gitId, + name, + private_, + projectId, + slug, + url, + branch, + rootDir, + mutableMapOf(), + ) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -2353,31 +2456,15 @@ private constructor( */ @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): GitRepo = apply { - if (validated) { - return@apply - } - - id() - dateConnected() - dateUpdated() - gitAccountId() - gitId() - name() - private_() - projectId() - slug() - url() - branch() - rootDir() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2634,10 +2721,32 @@ private constructor( checkRequired("url", url), branch, rootDir, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): GitRepo = apply { + if (validated) { + return@apply + } + + id() + dateConnected() + dateUpdated() + gitAccountId() + gitId() + name() + private_() + projectId() + slug() + url() + branch() + rootDir() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2674,60 +2783,89 @@ private constructor( "Project{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, developmentGoalCount=$developmentGoalCount, goalCount=$goalCount, inferencePipelineCount=$inferencePipelineCount, links=$links, monitoringGoalCount=$monitoringGoalCount, name=$name, source=$source, taskType=$taskType, versionCount=$versionCount, workspaceId=$workspaceId, description=$description, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Workspace - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("creatorId") - @ExcludeMissing - private val creatorId: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("inviteCount") - @ExcludeMissing - private val inviteCount: JsonField = JsonMissing.of(), - @JsonProperty("memberCount") - @ExcludeMissing - private val memberCount: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("periodEndDate") - @ExcludeMissing - private val periodEndDate: JsonField = JsonMissing.of(), - @JsonProperty("periodStartDate") - @ExcludeMissing - private val periodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("projectCount") - @ExcludeMissing - private val projectCount: JsonField = JsonMissing.of(), - @JsonProperty("slug") - @ExcludeMissing - private val slug: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("inviteCode") - @ExcludeMissing - private val inviteCode: JsonField = JsonMissing.of(), - @JsonProperty("monthlyUsage") - @ExcludeMissing - private val monthlyUsage: JsonField> = JsonMissing.of(), - @JsonProperty("samlOnlyAccess") - @ExcludeMissing - private val samlOnlyAccess: JsonField = JsonMissing.of(), - @JsonProperty("wildcardDomains") - @ExcludeMissing - private val wildcardDomains: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val inviteCount: JsonField, + private val memberCount: JsonField, + private val name: JsonField, + private val periodEndDate: JsonField, + private val periodStartDate: JsonField, + private val projectCount: JsonField, + private val slug: JsonField, + private val status: JsonField, + private val inviteCode: JsonField, + private val monthlyUsage: JsonField>, + private val samlOnlyAccess: JsonField, + private val wildcardDomains: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("inviteCount") + @ExcludeMissing + inviteCount: JsonField = JsonMissing.of(), + @JsonProperty("memberCount") + @ExcludeMissing + memberCount: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("periodEndDate") + @ExcludeMissing + periodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("periodStartDate") + @ExcludeMissing + periodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("projectCount") + @ExcludeMissing + projectCount: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("inviteCode") + @ExcludeMissing + inviteCode: JsonField = JsonMissing.of(), + @JsonProperty("monthlyUsage") + @ExcludeMissing + monthlyUsage: JsonField> = JsonMissing.of(), + @JsonProperty("samlOnlyAccess") + @ExcludeMissing + samlOnlyAccess: JsonField = JsonMissing.of(), + @JsonProperty("wildcardDomains") + @ExcludeMissing + wildcardDomains: JsonField> = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + inviteCount, + memberCount, + name, + periodEndDate, + periodStartDate, + projectCount, + slug, + status, + inviteCode, + monthlyUsage, + samlOnlyAccess, + wildcardDomains, + mutableMapOf(), + ) + /** * The workspace id. * @@ -2996,35 +3134,15 @@ private constructor( @ExcludeMissing fun _wildcardDomains(): JsonField> = wildcardDomains + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Workspace = apply { - if (validated) { - return@apply - } - - id() - creatorId() - dateCreated() - dateUpdated() - inviteCount() - memberCount() - name() - periodEndDate() - periodStartDate() - projectCount() - slug() - status() - inviteCode() - monthlyUsage().ifPresent { it.forEach { it.validate() } } - samlOnlyAccess() - wildcardDomains() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3399,10 +3517,36 @@ private constructor( (monthlyUsage ?: JsonMissing.of()).map { it.toImmutable() }, samlOnlyAccess, (wildcardDomains ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Workspace = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + inviteCount() + memberCount() + name() + periodEndDate() + periodStartDate() + projectCount() + slug() + status() + inviteCode() + monthlyUsage().ifPresent { it.forEach { it.validate() } } + samlOnlyAccess() + wildcardDomains() + validated = true + } + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -3541,23 +3685,27 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class MonthlyUsage - @JsonCreator private constructor( - @JsonProperty("executionTimeMs") - @ExcludeMissing - private val executionTimeMs: JsonField = JsonMissing.of(), - @JsonProperty("monthYear") - @ExcludeMissing - private val monthYear: JsonField = JsonMissing.of(), - @JsonProperty("predictionCount") - @ExcludeMissing - private val predictionCount: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val executionTimeMs: JsonField, + private val monthYear: JsonField, + private val predictionCount: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("executionTimeMs") + @ExcludeMissing + executionTimeMs: JsonField = JsonMissing.of(), + @JsonProperty("monthYear") + @ExcludeMissing + monthYear: JsonField = JsonMissing.of(), + @JsonProperty("predictionCount") + @ExcludeMissing + predictionCount: JsonField = JsonMissing.of(), + ) : this(executionTimeMs, monthYear, predictionCount, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -3609,22 +3757,15 @@ private constructor( @ExcludeMissing fun _predictionCount(): JsonField = predictionCount + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): MonthlyUsage = apply { - if (validated) { - return@apply - } - - executionTimeMs() - monthYear() - predictionCount() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3737,10 +3878,23 @@ private constructor( executionTimeMs, monthYear, predictionCount, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): MonthlyUsage = apply { + if (validated) { + return@apply + } + + executionTimeMs() + monthYear() + predictionCount() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt index 80e906c2..af5a8c0b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt @@ -10,14 +10,12 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams -import com.openlayer.api.core.immutableEmptyMap -import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -86,229 +84,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): Body = body - - fun _pathParam(index: Int): String = - when (index) { - 0 -> inferencePipelineId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - @NoAutoDetect - class Body - @JsonCreator - private constructor( - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("referenceDatasetUri") - @ExcludeMissing - private val referenceDatasetUri: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** - * The inference pipeline description. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) - - /** - * The inference pipeline name. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - - /** - * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to - * handle your reference dataset updates. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun referenceDatasetUri(): Optional = - Optional.ofNullable(referenceDatasetUri.getNullable("referenceDatasetUri")) - - /** - * Returns the raw JSON value of [description]. - * - * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("description") - @ExcludeMissing - fun _description(): JsonField = description - - /** - * Returns the raw JSON value of [name]. - * - * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** - * Returns the raw JSON value of [referenceDatasetUri]. - * - * Unlike [referenceDatasetUri], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("referenceDatasetUri") - @ExcludeMissing - fun _referenceDatasetUri(): JsonField = referenceDatasetUri - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - description() - name() - referenceDatasetUri() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Body]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var description: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var referenceDatasetUri: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - description = body.description - name = body.name - referenceDatasetUri = body.referenceDatasetUri - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** The inference pipeline description. */ - fun description(description: String?) = description(JsonField.ofNullable(description)) - - /** Alias for calling [Builder.description] with `description.orElse(null)`. */ - fun description(description: Optional) = description(description.getOrNull()) - - /** - * Sets [Builder.description] to an arbitrary JSON value. - * - * You should usually call [Builder.description] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun description(description: JsonField) = apply { - this.description = description - } - - /** The inference pipeline name. */ - fun name(name: String) = name(JsonField.of(name)) - - /** - * Sets [Builder.name] to an arbitrary JSON value. - * - * You should usually call [Builder.name] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun name(name: JsonField) = apply { this.name = name } - - /** - * The storage uri of your reference dataset. We recommend using the Python SDK or the - * UI to handle your reference dataset updates. - */ - fun referenceDatasetUri(referenceDatasetUri: String?) = - referenceDatasetUri(JsonField.ofNullable(referenceDatasetUri)) - - /** - * Alias for calling [Builder.referenceDatasetUri] with - * `referenceDatasetUri.orElse(null)`. - */ - fun referenceDatasetUri(referenceDatasetUri: Optional) = - referenceDatasetUri(referenceDatasetUri.getOrNull()) - - /** - * Sets [Builder.referenceDatasetUri] to an arbitrary JSON value. - * - * You should usually call [Builder.referenceDatasetUri] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun referenceDatasetUri(referenceDatasetUri: JsonField) = apply { - this.referenceDatasetUri = referenceDatasetUri - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Body = - Body(description, name, referenceDatasetUri, additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Body && description == other.description && name == other.name && referenceDatasetUri == other.referenceDatasetUri && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(description, name, referenceDatasetUri, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{description=$description, name=$name, referenceDatasetUri=$referenceDatasetUri, additionalProperties=$additionalProperties}" - } - fun toBuilder() = Builder().from(this) companion object { @@ -326,7 +101,6 @@ private constructor( } /** A builder for [InferencePipelineUpdateParams]. */ - @NoAutoDetect class Builder internal constructor() { private var inferencePipelineId: String? = null @@ -535,6 +309,237 @@ private constructor( ) } + @JvmSynthetic internal fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> inferencePipelineId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + private constructor( + private val description: JsonField, + private val name: JsonField, + private val referenceDatasetUri: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("referenceDatasetUri") + @ExcludeMissing + referenceDatasetUri: JsonField = JsonMissing.of(), + ) : this(description, name, referenceDatasetUri, mutableMapOf()) + + /** + * The inference pipeline description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) + + /** + * The inference pipeline name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + + /** + * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to + * handle your reference dataset updates. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun referenceDatasetUri(): Optional = + Optional.ofNullable(referenceDatasetUri.getNullable("referenceDatasetUri")) + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [referenceDatasetUri]. + * + * Unlike [referenceDatasetUri], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("referenceDatasetUri") + @ExcludeMissing + fun _referenceDatasetUri(): JsonField = referenceDatasetUri + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Body]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var description: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var referenceDatasetUri: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + description = body.description + name = body.name + referenceDatasetUri = body.referenceDatasetUri + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The inference pipeline description. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** The inference pipeline name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * The storage uri of your reference dataset. We recommend using the Python SDK or the + * UI to handle your reference dataset updates. + */ + fun referenceDatasetUri(referenceDatasetUri: String?) = + referenceDatasetUri(JsonField.ofNullable(referenceDatasetUri)) + + /** + * Alias for calling [Builder.referenceDatasetUri] with + * `referenceDatasetUri.orElse(null)`. + */ + fun referenceDatasetUri(referenceDatasetUri: Optional) = + referenceDatasetUri(referenceDatasetUri.getOrNull()) + + /** + * Sets [Builder.referenceDatasetUri] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceDatasetUri] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun referenceDatasetUri(referenceDatasetUri: JsonField) = apply { + this.referenceDatasetUri = referenceDatasetUri + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Body = + Body(description, name, referenceDatasetUri, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + description() + name() + referenceDatasetUri() + validated = true + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Body && description == other.description && name == other.name && referenceDatasetUri == other.referenceDatasetUri && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(description, name, referenceDatasetUri, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{description=$description, name=$name, referenceDatasetUri=$referenceDatasetUri, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt index c6eaa8a7..72473965 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt @@ -11,73 +11,106 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired -import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.LocalDate import java.time.OffsetDateTime +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -@NoAutoDetect class InferencePipelineUpdateResponse -@JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateLastEvaluated") - @ExcludeMissing - private val dateLastEvaluated: JsonField = JsonMissing.of(), - @JsonProperty("dateLastSampleReceived") - @ExcludeMissing - private val dateLastSampleReceived: JsonField = JsonMissing.of(), - @JsonProperty("dateOfNextEvaluation") - @ExcludeMissing - private val dateOfNextEvaluation: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("failingGoalCount") - @ExcludeMissing - private val failingGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("links") @ExcludeMissing private val links: JsonField = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), - @JsonProperty("passingGoalCount") - @ExcludeMissing - private val passingGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("projectId") - @ExcludeMissing - private val projectId: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("statusMessage") - @ExcludeMissing - private val statusMessage: JsonField = JsonMissing.of(), - @JsonProperty("totalGoalCount") - @ExcludeMissing - private val totalGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("project") - @ExcludeMissing - private val project: JsonField = JsonMissing.of(), - @JsonProperty("workspace") - @ExcludeMissing - private val workspace: JsonField = JsonMissing.of(), - @JsonProperty("workspaceId") - @ExcludeMissing - private val workspaceId: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val dateCreated: JsonField, + private val dateLastEvaluated: JsonField, + private val dateLastSampleReceived: JsonField, + private val dateOfNextEvaluation: JsonField, + private val dateUpdated: JsonField, + private val description: JsonField, + private val failingGoalCount: JsonField, + private val links: JsonField, + private val name: JsonField, + private val passingGoalCount: JsonField, + private val projectId: JsonField, + private val status: JsonField, + private val statusMessage: JsonField, + private val totalGoalCount: JsonField, + private val project: JsonField, + private val workspace: JsonField, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastSampleReceived") + @ExcludeMissing + dateLastSampleReceived: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("failingGoalCount") + @ExcludeMissing + failingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing links: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("passingGoalCount") + @ExcludeMissing + passingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("projectId") @ExcludeMissing projectId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("totalGoalCount") + @ExcludeMissing + totalGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("project") @ExcludeMissing project: JsonField = JsonMissing.of(), + @JsonProperty("workspace") + @ExcludeMissing + workspace: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateLastEvaluated, + dateLastSampleReceived, + dateOfNextEvaluation, + dateUpdated, + description, + failingGoalCount, + links, + name, + passingGoalCount, + projectId, + status, + statusMessage, + totalGoalCount, + project, + workspace, + workspaceId, + mutableMapOf(), + ) + /** * The inference pipeline id. * @@ -371,37 +404,15 @@ private constructor( */ @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): InferencePipelineUpdateResponse = apply { - if (validated) { - return@apply - } - - id() - dateCreated() - dateLastEvaluated() - dateLastSampleReceived() - dateOfNextEvaluation() - dateUpdated() - description() - failingGoalCount() - links().validate() - name() - passingGoalCount() - projectId() - status() - statusMessage() - totalGoalCount() - project().ifPresent { it.validate() } - workspace().ifPresent { it.validate() } - workspaceId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -809,19 +820,49 @@ private constructor( project, workspace, workspaceId, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): InferencePipelineUpdateResponse = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateLastEvaluated() + dateLastSampleReceived() + dateOfNextEvaluation() + dateUpdated() + description() + failingGoalCount() + links().validate() + name() + passingGoalCount() + projectId() + status() + statusMessage() + totalGoalCount() + project().ifPresent { it.validate() } + workspace().ifPresent { it.validate() } + workspaceId() + validated = true + } + class Links - @JsonCreator private constructor( - @JsonProperty("app") @ExcludeMissing private val app: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val app: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing app: JsonField = JsonMissing.of() + ) : this(app, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -835,20 +876,15 @@ private constructor( */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Links = apply { - if (validated) { - return@apply - } - - app() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -920,7 +956,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): Links = - Links(checkRequired("app", app), additionalProperties.toImmutable()) + Links(checkRequired("app", app), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true } override fun equals(other: Any?): Boolean { @@ -1065,60 +1112,87 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class Project - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("creatorId") - @ExcludeMissing - private val creatorId: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("developmentGoalCount") - @ExcludeMissing - private val developmentGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("goalCount") - @ExcludeMissing - private val goalCount: JsonField = JsonMissing.of(), - @JsonProperty("inferencePipelineCount") - @ExcludeMissing - private val inferencePipelineCount: JsonField = JsonMissing.of(), - @JsonProperty("links") - @ExcludeMissing - private val links: JsonField = JsonMissing.of(), - @JsonProperty("monitoringGoalCount") - @ExcludeMissing - private val monitoringGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("source") - @ExcludeMissing - private val source: JsonField = JsonMissing.of(), - @JsonProperty("taskType") - @ExcludeMissing - private val taskType: JsonField = JsonMissing.of(), - @JsonProperty("versionCount") - @ExcludeMissing - private val versionCount: JsonField = JsonMissing.of(), - @JsonProperty("workspaceId") - @ExcludeMissing - private val workspaceId: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("gitRepo") - @ExcludeMissing - private val gitRepo: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val developmentGoalCount: JsonField, + private val goalCount: JsonField, + private val inferencePipelineCount: JsonField, + private val links: JsonField, + private val monitoringGoalCount: JsonField, + private val name: JsonField, + private val source: JsonField, + private val taskType: JsonField, + private val versionCount: JsonField, + private val workspaceId: JsonField, + private val description: JsonField, + private val gitRepo: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("developmentGoalCount") + @ExcludeMissing + developmentGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("goalCount") + @ExcludeMissing + goalCount: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + inferencePipelineCount: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing links: JsonField = JsonMissing.of(), + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + monitoringGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("source") @ExcludeMissing source: JsonField = JsonMissing.of(), + @JsonProperty("taskType") + @ExcludeMissing + taskType: JsonField = JsonMissing.of(), + @JsonProperty("versionCount") + @ExcludeMissing + versionCount: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("gitRepo") @ExcludeMissing gitRepo: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + developmentGoalCount, + goalCount, + inferencePipelineCount, + links, + monitoringGoalCount, + name, + source, + taskType, + versionCount, + workspaceId, + description, + gitRepo, + mutableMapOf(), + ) + /** * The project id. * @@ -1380,35 +1454,15 @@ private constructor( */ @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Project = apply { - if (validated) { - return@apply - } - - id() - creatorId() - dateCreated() - dateUpdated() - developmentGoalCount() - goalCount() - inferencePipelineCount() - links().validate() - monitoringGoalCount() - name() - source() - taskType() - versionCount() - workspaceId() - description() - gitRepo().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1767,22 +1821,48 @@ private constructor( checkRequired("workspaceId", workspaceId), description, gitRepo, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Project = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + developmentGoalCount() + goalCount() + inferencePipelineCount() + links().validate() + monitoringGoalCount() + name() + source() + taskType() + versionCount() + workspaceId() + description() + gitRepo().ifPresent { it.validate() } + validated = true + } + /** Links to the project. */ - @NoAutoDetect class Links - @JsonCreator private constructor( - @JsonProperty("app") - @ExcludeMissing - private val app: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val app: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing app: JsonField = JsonMissing.of() + ) : this(app, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -1797,20 +1877,15 @@ private constructor( */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Links = apply { - if (validated) { - return@apply - } - - app() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1885,7 +1960,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): Links = - Links(checkRequired("app", app), additionalProperties.toImmutable()) + Links(checkRequired("app", app), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true } override fun equals(other: Any?): Boolean { @@ -2130,50 +2216,67 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class GitRepo - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("dateConnected") - @ExcludeMissing - private val dateConnected: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("gitAccountId") - @ExcludeMissing - private val gitAccountId: JsonField = JsonMissing.of(), - @JsonProperty("gitId") - @ExcludeMissing - private val gitId: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("private") - @ExcludeMissing - private val private_: JsonField = JsonMissing.of(), - @JsonProperty("projectId") - @ExcludeMissing - private val projectId: JsonField = JsonMissing.of(), - @JsonProperty("slug") - @ExcludeMissing - private val slug: JsonField = JsonMissing.of(), - @JsonProperty("url") - @ExcludeMissing - private val url: JsonField = JsonMissing.of(), - @JsonProperty("branch") - @ExcludeMissing - private val branch: JsonField = JsonMissing.of(), - @JsonProperty("rootDir") - @ExcludeMissing - private val rootDir: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val dateConnected: JsonField, + private val dateUpdated: JsonField, + private val gitAccountId: JsonField, + private val gitId: JsonField, + private val name: JsonField, + private val private_: JsonField, + private val projectId: JsonField, + private val slug: JsonField, + private val url: JsonField, + private val branch: JsonField, + private val rootDir: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateConnected") + @ExcludeMissing + dateConnected: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("gitAccountId") + @ExcludeMissing + gitAccountId: JsonField = JsonMissing.of(), + @JsonProperty("gitId") @ExcludeMissing gitId: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("private") + @ExcludeMissing + private_: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("url") @ExcludeMissing url: JsonField = JsonMissing.of(), + @JsonProperty("branch") + @ExcludeMissing + branch: JsonField = JsonMissing.of(), + @JsonProperty("rootDir") + @ExcludeMissing + rootDir: JsonField = JsonMissing.of(), + ) : this( + id, + dateConnected, + dateUpdated, + gitAccountId, + gitId, + name, + private_, + projectId, + slug, + url, + branch, + rootDir, + mutableMapOf(), + ) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -2353,31 +2456,15 @@ private constructor( */ @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): GitRepo = apply { - if (validated) { - return@apply - } - - id() - dateConnected() - dateUpdated() - gitAccountId() - gitId() - name() - private_() - projectId() - slug() - url() - branch() - rootDir() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2634,10 +2721,32 @@ private constructor( checkRequired("url", url), branch, rootDir, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): GitRepo = apply { + if (validated) { + return@apply + } + + id() + dateConnected() + dateUpdated() + gitAccountId() + gitId() + name() + private_() + projectId() + slug() + url() + branch() + rootDir() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2674,60 +2783,89 @@ private constructor( "Project{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, developmentGoalCount=$developmentGoalCount, goalCount=$goalCount, inferencePipelineCount=$inferencePipelineCount, links=$links, monitoringGoalCount=$monitoringGoalCount, name=$name, source=$source, taskType=$taskType, versionCount=$versionCount, workspaceId=$workspaceId, description=$description, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Workspace - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("creatorId") - @ExcludeMissing - private val creatorId: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("inviteCount") - @ExcludeMissing - private val inviteCount: JsonField = JsonMissing.of(), - @JsonProperty("memberCount") - @ExcludeMissing - private val memberCount: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("periodEndDate") - @ExcludeMissing - private val periodEndDate: JsonField = JsonMissing.of(), - @JsonProperty("periodStartDate") - @ExcludeMissing - private val periodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("projectCount") - @ExcludeMissing - private val projectCount: JsonField = JsonMissing.of(), - @JsonProperty("slug") - @ExcludeMissing - private val slug: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("inviteCode") - @ExcludeMissing - private val inviteCode: JsonField = JsonMissing.of(), - @JsonProperty("monthlyUsage") - @ExcludeMissing - private val monthlyUsage: JsonField> = JsonMissing.of(), - @JsonProperty("samlOnlyAccess") - @ExcludeMissing - private val samlOnlyAccess: JsonField = JsonMissing.of(), - @JsonProperty("wildcardDomains") - @ExcludeMissing - private val wildcardDomains: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val inviteCount: JsonField, + private val memberCount: JsonField, + private val name: JsonField, + private val periodEndDate: JsonField, + private val periodStartDate: JsonField, + private val projectCount: JsonField, + private val slug: JsonField, + private val status: JsonField, + private val inviteCode: JsonField, + private val monthlyUsage: JsonField>, + private val samlOnlyAccess: JsonField, + private val wildcardDomains: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("inviteCount") + @ExcludeMissing + inviteCount: JsonField = JsonMissing.of(), + @JsonProperty("memberCount") + @ExcludeMissing + memberCount: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("periodEndDate") + @ExcludeMissing + periodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("periodStartDate") + @ExcludeMissing + periodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("projectCount") + @ExcludeMissing + projectCount: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("inviteCode") + @ExcludeMissing + inviteCode: JsonField = JsonMissing.of(), + @JsonProperty("monthlyUsage") + @ExcludeMissing + monthlyUsage: JsonField> = JsonMissing.of(), + @JsonProperty("samlOnlyAccess") + @ExcludeMissing + samlOnlyAccess: JsonField = JsonMissing.of(), + @JsonProperty("wildcardDomains") + @ExcludeMissing + wildcardDomains: JsonField> = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + inviteCount, + memberCount, + name, + periodEndDate, + periodStartDate, + projectCount, + slug, + status, + inviteCode, + monthlyUsage, + samlOnlyAccess, + wildcardDomains, + mutableMapOf(), + ) + /** * The workspace id. * @@ -2996,35 +3134,15 @@ private constructor( @ExcludeMissing fun _wildcardDomains(): JsonField> = wildcardDomains + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Workspace = apply { - if (validated) { - return@apply - } - - id() - creatorId() - dateCreated() - dateUpdated() - inviteCount() - memberCount() - name() - periodEndDate() - periodStartDate() - projectCount() - slug() - status() - inviteCode() - monthlyUsage().ifPresent { it.forEach { it.validate() } } - samlOnlyAccess() - wildcardDomains() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3399,10 +3517,36 @@ private constructor( (monthlyUsage ?: JsonMissing.of()).map { it.toImmutable() }, samlOnlyAccess, (wildcardDomains ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Workspace = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + inviteCount() + memberCount() + name() + periodEndDate() + periodStartDate() + projectCount() + slug() + status() + inviteCode() + monthlyUsage().ifPresent { it.forEach { it.validate() } } + samlOnlyAccess() + wildcardDomains() + validated = true + } + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -3541,23 +3685,27 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class MonthlyUsage - @JsonCreator private constructor( - @JsonProperty("executionTimeMs") - @ExcludeMissing - private val executionTimeMs: JsonField = JsonMissing.of(), - @JsonProperty("monthYear") - @ExcludeMissing - private val monthYear: JsonField = JsonMissing.of(), - @JsonProperty("predictionCount") - @ExcludeMissing - private val predictionCount: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val executionTimeMs: JsonField, + private val monthYear: JsonField, + private val predictionCount: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("executionTimeMs") + @ExcludeMissing + executionTimeMs: JsonField = JsonMissing.of(), + @JsonProperty("monthYear") + @ExcludeMissing + monthYear: JsonField = JsonMissing.of(), + @JsonProperty("predictionCount") + @ExcludeMissing + predictionCount: JsonField = JsonMissing.of(), + ) : this(executionTimeMs, monthYear, predictionCount, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -3609,22 +3757,15 @@ private constructor( @ExcludeMissing fun _predictionCount(): JsonField = predictionCount + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): MonthlyUsage = apply { - if (validated) { - return@apply - } - - executionTimeMs() - monthYear() - predictionCount() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3737,10 +3878,23 @@ private constructor( executionTimeMs, monthYear, predictionCount, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): MonthlyUsage = apply { + if (validated) { + return@apply + } + + executionTimeMs() + monthYear() + predictionCount() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt index 9eec4f7e..5176b620 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt @@ -19,16 +19,15 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired import com.openlayer.api.core.getOrThrow import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams -import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -80,228 +79,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): Body = body - - fun _pathParam(index: Int): String = - when (index) { - 0 -> inferencePipelineId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - @NoAutoDetect - class Body - @JsonCreator - private constructor( - @JsonProperty("config") - @ExcludeMissing - private val config: JsonField = JsonMissing.of(), - @JsonProperty("rows") - @ExcludeMissing - private val rows: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** - * Configuration for the data stream. Depends on your **Openlayer project task type**. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun config(): Config = config.getRequired("config") - - /** - * A list of inference data points with inputs and outputs - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun rows(): List = rows.getRequired("rows") - - /** - * Returns the raw JSON value of [config]. - * - * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("config") @ExcludeMissing fun _config(): JsonField = config - - /** - * Returns the raw JSON value of [rows]. - * - * Unlike [rows], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("rows") @ExcludeMissing fun _rows(): JsonField> = rows - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - config().validate() - rows().forEach { it.validate() } - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Body]. - * - * The following fields are required: - * ```java - * .config() - * .rows() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var config: JsonField? = null - private var rows: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - config = body.config - rows = body.rows.map { it.toMutableList() } - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** - * Configuration for the data stream. Depends on your **Openlayer project task type**. - */ - fun config(config: Config) = config(JsonField.of(config)) - - /** - * Sets [Builder.config] to an arbitrary JSON value. - * - * You should usually call [Builder.config] with a well-typed [Config] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun config(config: JsonField) = apply { this.config = config } - - /** Alias for calling [config] with `Config.ofLlmData(llmData)`. */ - fun config(llmData: Config.LlmData) = config(Config.ofLlmData(llmData)) - - /** - * Alias for calling [config] with - * `Config.ofTabularClassificationData(tabularClassificationData)`. - */ - fun config(tabularClassificationData: Config.TabularClassificationData) = - config(Config.ofTabularClassificationData(tabularClassificationData)) - - /** - * Alias for calling [config] with - * `Config.ofTabularRegressionData(tabularRegressionData)`. - */ - fun config(tabularRegressionData: Config.TabularRegressionData) = - config(Config.ofTabularRegressionData(tabularRegressionData)) - - /** - * Alias for calling [config] with - * `Config.ofTextClassificationData(textClassificationData)`. - */ - fun config(textClassificationData: Config.TextClassificationData) = - config(Config.ofTextClassificationData(textClassificationData)) - - /** A list of inference data points with inputs and outputs */ - fun rows(rows: List) = rows(JsonField.of(rows)) - - /** - * Sets [Builder.rows] to an arbitrary JSON value. - * - * You should usually call [Builder.rows] with a well-typed `List` value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun rows(rows: JsonField>) = apply { - this.rows = rows.map { it.toMutableList() } - } - - /** - * Adds a single [Row] to [rows]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addRow(row: Row) = apply { - rows = - (rows ?: JsonField.of(mutableListOf())).also { checkKnown("rows", it).add(row) } - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .config() - * .rows() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body( - checkRequired("config", config), - checkRequired("rows", rows).map { it.toImmutable() }, - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Body && config == other.config && rows == other.rows && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(config, rows, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{config=$config, rows=$rows, additionalProperties=$additionalProperties}" - } - fun toBuilder() = Builder().from(this) companion object { @@ -320,7 +97,6 @@ private constructor( } /** A builder for [DataStreamParams]. */ - @NoAutoDetect class Builder internal constructor() { private var inferencePipelineId: String? = null @@ -440,99 +216,326 @@ private constructor( this.additionalHeaders.putAll(additionalHeaders) } - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [DataStreamParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .inferencePipelineId() + * .config() + * .rows() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DataStreamParams = + DataStreamParams( + checkRequired("inferencePipelineId", inferencePipelineId), + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + @JvmSynthetic internal fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> inferencePipelineId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + private constructor( + private val config: JsonField, + private val rows: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("config") @ExcludeMissing config: JsonField = JsonMissing.of(), + @JsonProperty("rows") @ExcludeMissing rows: JsonField> = JsonMissing.of(), + ) : this(config, rows, mutableMapOf()) + + /** + * Configuration for the data stream. Depends on your **Openlayer project task type**. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun config(): Config = config.getRequired("config") + + /** + * A list of inference data points with inputs and outputs + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun rows(): List = rows.getRequired("rows") + + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("config") @ExcludeMissing fun _config(): JsonField = config + + /** + * Returns the raw JSON value of [rows]. + * + * Unlike [rows], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("rows") @ExcludeMissing fun _rows(): JsonField> = rows + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .config() + * .rows() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var config: JsonField? = null + private var rows: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + config = body.config + rows = body.rows.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** + * Configuration for the data stream. Depends on your **Openlayer project task type**. + */ + fun config(config: Config) = config(JsonField.of(config)) + + /** + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [Config] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun config(config: JsonField) = apply { this.config = config } + + /** Alias for calling [config] with `Config.ofLlmData(llmData)`. */ + fun config(llmData: Config.LlmData) = config(Config.ofLlmData(llmData)) + + /** + * Alias for calling [config] with + * `Config.ofTabularClassificationData(tabularClassificationData)`. + */ + fun config(tabularClassificationData: Config.TabularClassificationData) = + config(Config.ofTabularClassificationData(tabularClassificationData)) + + /** + * Alias for calling [config] with + * `Config.ofTabularRegressionData(tabularRegressionData)`. + */ + fun config(tabularRegressionData: Config.TabularRegressionData) = + config(Config.ofTabularRegressionData(tabularRegressionData)) + + /** + * Alias for calling [config] with + * `Config.ofTextClassificationData(textClassificationData)`. + */ + fun config(textClassificationData: Config.TextClassificationData) = + config(Config.ofTextClassificationData(textClassificationData)) - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } + /** A list of inference data points with inputs and outputs */ + fun rows(rows: List) = rows(JsonField.of(rows)) - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + /** + * Sets [Builder.rows] to an arbitrary JSON value. + * + * You should usually call [Builder.rows] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun rows(rows: JsonField>) = apply { + this.rows = rows.map { it.toMutableList() } + } - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + /** + * Adds a single [Row] to [rows]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addRow(row: Row) = apply { + rows = + (rows ?: JsonField.of(mutableListOf())).also { checkKnown("rows", it).add(row) } + } - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .config() + * .rows() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("config", config), + checkRequired("rows", rows).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) } - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } + private var validated: Boolean = false - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) + fun validate(): Body = apply { + if (validated) { + return@apply } - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) + config().validate() + rows().forEach { it.validate() } + validated = true } - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) + return /* spotless:off */ other is Body && config == other.config && rows == other.rows && additionalProperties == other.additionalProperties /* spotless:on */ } - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(config, rows, additionalProperties) } + /* spotless:on */ - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } + override fun hashCode(): Int = hashCode - /** - * Returns an immutable instance of [DataStreamParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .inferencePipelineId() - * .config() - * .rows() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): DataStreamParams = - DataStreamParams( - checkRequired("inferencePipelineId", inferencePipelineId), - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) + override fun toString() = + "Body{config=$config, rows=$rows, additionalProperties=$additionalProperties}" } /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ @@ -742,50 +745,75 @@ private constructor( } } - @NoAutoDetect class LlmData - @JsonCreator private constructor( - @JsonProperty("outputColumnName") - @ExcludeMissing - private val outputColumnName: JsonField = JsonMissing.of(), - @JsonProperty("contextColumnName") - @ExcludeMissing - private val contextColumnName: JsonField = JsonMissing.of(), - @JsonProperty("costColumnName") - @ExcludeMissing - private val costColumnName: JsonField = JsonMissing.of(), - @JsonProperty("groundTruthColumnName") - @ExcludeMissing - private val groundTruthColumnName: JsonField = JsonMissing.of(), - @JsonProperty("inferenceIdColumnName") - @ExcludeMissing - private val inferenceIdColumnName: JsonField = JsonMissing.of(), - @JsonProperty("inputVariableNames") - @ExcludeMissing - private val inputVariableNames: JsonField> = JsonMissing.of(), - @JsonProperty("latencyColumnName") - @ExcludeMissing - private val latencyColumnName: JsonField = JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonValue = JsonMissing.of(), - @JsonProperty("numOfTokenColumnName") - @ExcludeMissing - private val numOfTokenColumnName: JsonField = JsonMissing.of(), - @JsonProperty("prompt") - @ExcludeMissing - private val prompt: JsonField> = JsonMissing.of(), - @JsonProperty("questionColumnName") - @ExcludeMissing - private val questionColumnName: JsonField = JsonMissing.of(), - @JsonProperty("timestampColumnName") - @ExcludeMissing - private val timestampColumnName: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val outputColumnName: JsonField, + private val contextColumnName: JsonField, + private val costColumnName: JsonField, + private val groundTruthColumnName: JsonField, + private val inferenceIdColumnName: JsonField, + private val inputVariableNames: JsonField>, + private val latencyColumnName: JsonField, + private val metadata: JsonValue, + private val numOfTokenColumnName: JsonField, + private val prompt: JsonField>, + private val questionColumnName: JsonField, + private val timestampColumnName: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("outputColumnName") + @ExcludeMissing + outputColumnName: JsonField = JsonMissing.of(), + @JsonProperty("contextColumnName") + @ExcludeMissing + contextColumnName: JsonField = JsonMissing.of(), + @JsonProperty("costColumnName") + @ExcludeMissing + costColumnName: JsonField = JsonMissing.of(), + @JsonProperty("groundTruthColumnName") + @ExcludeMissing + groundTruthColumnName: JsonField = JsonMissing.of(), + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + inferenceIdColumnName: JsonField = JsonMissing.of(), + @JsonProperty("inputVariableNames") + @ExcludeMissing + inputVariableNames: JsonField> = JsonMissing.of(), + @JsonProperty("latencyColumnName") + @ExcludeMissing + latencyColumnName: JsonField = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(), + @JsonProperty("numOfTokenColumnName") + @ExcludeMissing + numOfTokenColumnName: JsonField = JsonMissing.of(), + @JsonProperty("prompt") + @ExcludeMissing + prompt: JsonField> = JsonMissing.of(), + @JsonProperty("questionColumnName") + @ExcludeMissing + questionColumnName: JsonField = JsonMissing.of(), + @JsonProperty("timestampColumnName") + @ExcludeMissing + timestampColumnName: JsonField = JsonMissing.of(), + ) : this( + outputColumnName, + contextColumnName, + costColumnName, + groundTruthColumnName, + inferenceIdColumnName, + inputVariableNames, + latencyColumnName, + metadata, + numOfTokenColumnName, + prompt, + questionColumnName, + timestampColumnName, + mutableMapOf(), + ) + /** * Name of the column with the model outputs. * @@ -998,30 +1026,15 @@ private constructor( @ExcludeMissing fun _timestampColumnName(): JsonField = timestampColumnName + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): LlmData = apply { - if (validated) { - return@apply - } - - outputColumnName() - contextColumnName() - costColumnName() - groundTruthColumnName() - inferenceIdColumnName() - inputVariableNames() - latencyColumnName() - numOfTokenColumnName() - prompt().ifPresent { it.forEach { it.validate() } } - questionColumnName() - timestampColumnName() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1333,24 +1346,46 @@ private constructor( (prompt ?: JsonMissing.of()).map { it.toImmutable() }, questionColumnName, timestampColumnName, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): LlmData = apply { + if (validated) { + return@apply + } + + outputColumnName() + contextColumnName() + costColumnName() + groundTruthColumnName() + inferenceIdColumnName() + inputVariableNames() + latencyColumnName() + numOfTokenColumnName() + prompt().ifPresent { it.forEach { it.validate() } } + questionColumnName() + timestampColumnName() + validated = true + } + class Prompt - @JsonCreator private constructor( - @JsonProperty("content") - @ExcludeMissing - private val content: JsonField = JsonMissing.of(), - @JsonProperty("role") - @ExcludeMissing - private val role: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val content: JsonField, + private val role: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("content") + @ExcludeMissing + content: JsonField = JsonMissing.of(), + @JsonProperty("role") @ExcludeMissing role: JsonField = JsonMissing.of(), + ) : this(content, role, mutableMapOf()) + /** * Content of the prompt. * @@ -1383,23 +1418,17 @@ private constructor( * type. */ @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Prompt = apply { - if (validated) { - return@apply - } - - content() - role() - validated = true + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + fun toBuilder() = Builder().from(this) companion object { @@ -1473,7 +1502,19 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Prompt = Prompt(content, role, additionalProperties.toImmutable()) + fun build(): Prompt = Prompt(content, role, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Prompt = apply { + if (validated) { + return@apply + } + + content() + role() + validated = true } override fun equals(other: Any?): Boolean { @@ -1512,44 +1553,65 @@ private constructor( "LlmData{outputColumnName=$outputColumnName, contextColumnName=$contextColumnName, costColumnName=$costColumnName, groundTruthColumnName=$groundTruthColumnName, inferenceIdColumnName=$inferenceIdColumnName, inputVariableNames=$inputVariableNames, latencyColumnName=$latencyColumnName, metadata=$metadata, numOfTokenColumnName=$numOfTokenColumnName, prompt=$prompt, questionColumnName=$questionColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" } - @NoAutoDetect class TabularClassificationData - @JsonCreator private constructor( - @JsonProperty("classNames") - @ExcludeMissing - private val classNames: JsonField> = JsonMissing.of(), - @JsonProperty("categoricalFeatureNames") - @ExcludeMissing - private val categoricalFeatureNames: JsonField> = JsonMissing.of(), - @JsonProperty("featureNames") - @ExcludeMissing - private val featureNames: JsonField> = JsonMissing.of(), - @JsonProperty("inferenceIdColumnName") - @ExcludeMissing - private val inferenceIdColumnName: JsonField = JsonMissing.of(), - @JsonProperty("labelColumnName") - @ExcludeMissing - private val labelColumnName: JsonField = JsonMissing.of(), - @JsonProperty("latencyColumnName") - @ExcludeMissing - private val latencyColumnName: JsonField = JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonValue = JsonMissing.of(), - @JsonProperty("predictionsColumnName") - @ExcludeMissing - private val predictionsColumnName: JsonField = JsonMissing.of(), - @JsonProperty("predictionScoresColumnName") - @ExcludeMissing - private val predictionScoresColumnName: JsonField = JsonMissing.of(), - @JsonProperty("timestampColumnName") - @ExcludeMissing - private val timestampColumnName: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val classNames: JsonField>, + private val categoricalFeatureNames: JsonField>, + private val featureNames: JsonField>, + private val inferenceIdColumnName: JsonField, + private val labelColumnName: JsonField, + private val latencyColumnName: JsonField, + private val metadata: JsonValue, + private val predictionsColumnName: JsonField, + private val predictionScoresColumnName: JsonField, + private val timestampColumnName: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("classNames") + @ExcludeMissing + classNames: JsonField> = JsonMissing.of(), + @JsonProperty("categoricalFeatureNames") + @ExcludeMissing + categoricalFeatureNames: JsonField> = JsonMissing.of(), + @JsonProperty("featureNames") + @ExcludeMissing + featureNames: JsonField> = JsonMissing.of(), + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + inferenceIdColumnName: JsonField = JsonMissing.of(), + @JsonProperty("labelColumnName") + @ExcludeMissing + labelColumnName: JsonField = JsonMissing.of(), + @JsonProperty("latencyColumnName") + @ExcludeMissing + latencyColumnName: JsonField = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(), + @JsonProperty("predictionsColumnName") + @ExcludeMissing + predictionsColumnName: JsonField = JsonMissing.of(), + @JsonProperty("predictionScoresColumnName") + @ExcludeMissing + predictionScoresColumnName: JsonField = JsonMissing.of(), + @JsonProperty("timestampColumnName") + @ExcludeMissing + timestampColumnName: JsonField = JsonMissing.of(), + ) : this( + classNames, + categoricalFeatureNames, + featureNames, + inferenceIdColumnName, + labelColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + predictionScoresColumnName, + timestampColumnName, + mutableMapOf(), + ) + /** * List of class names indexed by label integer in the dataset. E.g. * ["Retained", "Exited"] when 0, 1 are in your label column. @@ -1731,28 +1793,15 @@ private constructor( @ExcludeMissing fun _timestampColumnName(): JsonField = timestampColumnName + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): TabularClassificationData = apply { - if (validated) { - return@apply - } - - classNames() - categoricalFeatureNames() - featureNames() - inferenceIdColumnName() - labelColumnName() - latencyColumnName() - predictionsColumnName() - predictionScoresColumnName() - timestampColumnName() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2044,10 +2093,29 @@ private constructor( predictionsColumnName, predictionScoresColumnName, timestampColumnName, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): TabularClassificationData = apply { + if (validated) { + return@apply + } + + classNames() + categoricalFeatureNames() + featureNames() + inferenceIdColumnName() + labelColumnName() + latencyColumnName() + predictionsColumnName() + predictionScoresColumnName() + timestampColumnName() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2066,38 +2134,55 @@ private constructor( "TabularClassificationData{classNames=$classNames, categoricalFeatureNames=$categoricalFeatureNames, featureNames=$featureNames, inferenceIdColumnName=$inferenceIdColumnName, labelColumnName=$labelColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, predictionScoresColumnName=$predictionScoresColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" } - @NoAutoDetect class TabularRegressionData - @JsonCreator private constructor( - @JsonProperty("categoricalFeatureNames") - @ExcludeMissing - private val categoricalFeatureNames: JsonField> = JsonMissing.of(), - @JsonProperty("featureNames") - @ExcludeMissing - private val featureNames: JsonField> = JsonMissing.of(), - @JsonProperty("inferenceIdColumnName") - @ExcludeMissing - private val inferenceIdColumnName: JsonField = JsonMissing.of(), - @JsonProperty("latencyColumnName") - @ExcludeMissing - private val latencyColumnName: JsonField = JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonValue = JsonMissing.of(), - @JsonProperty("predictionsColumnName") - @ExcludeMissing - private val predictionsColumnName: JsonField = JsonMissing.of(), - @JsonProperty("targetColumnName") - @ExcludeMissing - private val targetColumnName: JsonField = JsonMissing.of(), - @JsonProperty("timestampColumnName") - @ExcludeMissing - private val timestampColumnName: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val categoricalFeatureNames: JsonField>, + private val featureNames: JsonField>, + private val inferenceIdColumnName: JsonField, + private val latencyColumnName: JsonField, + private val metadata: JsonValue, + private val predictionsColumnName: JsonField, + private val targetColumnName: JsonField, + private val timestampColumnName: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("categoricalFeatureNames") + @ExcludeMissing + categoricalFeatureNames: JsonField> = JsonMissing.of(), + @JsonProperty("featureNames") + @ExcludeMissing + featureNames: JsonField> = JsonMissing.of(), + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + inferenceIdColumnName: JsonField = JsonMissing.of(), + @JsonProperty("latencyColumnName") + @ExcludeMissing + latencyColumnName: JsonField = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(), + @JsonProperty("predictionsColumnName") + @ExcludeMissing + predictionsColumnName: JsonField = JsonMissing.of(), + @JsonProperty("targetColumnName") + @ExcludeMissing + targetColumnName: JsonField = JsonMissing.of(), + @JsonProperty("timestampColumnName") + @ExcludeMissing + timestampColumnName: JsonField = JsonMissing.of(), + ) : this( + categoricalFeatureNames, + featureNames, + inferenceIdColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + targetColumnName, + timestampColumnName, + mutableMapOf(), + ) + /** * Array with the names of all categorical features in the dataset. E.g. * ["Gender", "Geography"]. @@ -2237,26 +2322,15 @@ private constructor( @ExcludeMissing fun _timestampColumnName(): JsonField = timestampColumnName + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): TabularRegressionData = apply { - if (validated) { - return@apply - } - - categoricalFeatureNames() - featureNames() - inferenceIdColumnName() - latencyColumnName() - predictionsColumnName() - targetColumnName() - timestampColumnName() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2477,10 +2551,27 @@ private constructor( predictionsColumnName, targetColumnName, timestampColumnName, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): TabularRegressionData = apply { + if (validated) { + return@apply + } + + categoricalFeatureNames() + featureNames() + inferenceIdColumnName() + latencyColumnName() + predictionsColumnName() + targetColumnName() + timestampColumnName() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2499,41 +2590,60 @@ private constructor( "TabularRegressionData{categoricalFeatureNames=$categoricalFeatureNames, featureNames=$featureNames, inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, targetColumnName=$targetColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" } - @NoAutoDetect class TextClassificationData - @JsonCreator private constructor( - @JsonProperty("classNames") - @ExcludeMissing - private val classNames: JsonField> = JsonMissing.of(), - @JsonProperty("inferenceIdColumnName") - @ExcludeMissing - private val inferenceIdColumnName: JsonField = JsonMissing.of(), - @JsonProperty("labelColumnName") - @ExcludeMissing - private val labelColumnName: JsonField = JsonMissing.of(), - @JsonProperty("latencyColumnName") - @ExcludeMissing - private val latencyColumnName: JsonField = JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonValue = JsonMissing.of(), - @JsonProperty("predictionsColumnName") - @ExcludeMissing - private val predictionsColumnName: JsonField = JsonMissing.of(), - @JsonProperty("predictionScoresColumnName") - @ExcludeMissing - private val predictionScoresColumnName: JsonField = JsonMissing.of(), - @JsonProperty("textColumnName") - @ExcludeMissing - private val textColumnName: JsonField = JsonMissing.of(), - @JsonProperty("timestampColumnName") - @ExcludeMissing - private val timestampColumnName: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val classNames: JsonField>, + private val inferenceIdColumnName: JsonField, + private val labelColumnName: JsonField, + private val latencyColumnName: JsonField, + private val metadata: JsonValue, + private val predictionsColumnName: JsonField, + private val predictionScoresColumnName: JsonField, + private val textColumnName: JsonField, + private val timestampColumnName: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("classNames") + @ExcludeMissing + classNames: JsonField> = JsonMissing.of(), + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + inferenceIdColumnName: JsonField = JsonMissing.of(), + @JsonProperty("labelColumnName") + @ExcludeMissing + labelColumnName: JsonField = JsonMissing.of(), + @JsonProperty("latencyColumnName") + @ExcludeMissing + latencyColumnName: JsonField = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(), + @JsonProperty("predictionsColumnName") + @ExcludeMissing + predictionsColumnName: JsonField = JsonMissing.of(), + @JsonProperty("predictionScoresColumnName") + @ExcludeMissing + predictionScoresColumnName: JsonField = JsonMissing.of(), + @JsonProperty("textColumnName") + @ExcludeMissing + textColumnName: JsonField = JsonMissing.of(), + @JsonProperty("timestampColumnName") + @ExcludeMissing + timestampColumnName: JsonField = JsonMissing.of(), + ) : this( + classNames, + inferenceIdColumnName, + labelColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + predictionScoresColumnName, + textColumnName, + timestampColumnName, + mutableMapOf(), + ) + /** * List of class names indexed by label integer in the dataset. E.g. * ["Retained", "Exited"] when 0, 1 are in your label column. @@ -2695,27 +2805,15 @@ private constructor( @ExcludeMissing fun _timestampColumnName(): JsonField = timestampColumnName + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): TextClassificationData = apply { - if (validated) { - return@apply - } - - classNames() - inferenceIdColumnName() - labelColumnName() - latencyColumnName() - predictionsColumnName() - predictionScoresColumnName() - textColumnName() - timestampColumnName() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2958,10 +3056,28 @@ private constructor( predictionScoresColumnName, textColumnName, timestampColumnName, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): TextClassificationData = apply { + if (validated) { + return@apply + } + + classNames() + inferenceIdColumnName() + labelColumnName() + latencyColumnName() + predictionsColumnName() + predictionScoresColumnName() + textColumnName() + timestampColumnName() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2981,27 +3097,19 @@ private constructor( } } - @NoAutoDetect - class Row - @JsonCreator - private constructor( + class Row private constructor(private val additionalProperties: MutableMap) { + + @JsonCreator private constructor() : this(mutableMapOf()) + @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap() - ) { + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Row = apply { - if (validated) { - return@apply - } - - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3045,7 +3153,17 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Row = Row(additionalProperties.toImmutable()) + fun build(): Row = Row(additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Row = apply { + if (validated) { + return@apply + } + + validated = true } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt index fa5e0cbc..b66a3fd8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt @@ -11,23 +11,22 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.checkRequired -import com.openlayer.api.core.immutableEmptyMap -import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections import java.util.Objects -@NoAutoDetect class DataStreamResponse -@JsonCreator private constructor( - @JsonProperty("success") - @ExcludeMissing - private val success: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val success: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("success") @ExcludeMissing success: JsonField = JsonMissing.of() + ) : this(success, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -41,20 +40,15 @@ private constructor( */ @JsonProperty("success") @ExcludeMissing fun _success(): JsonField = success + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): DataStreamResponse = apply { - if (validated) { - return@apply - } - - success() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -127,10 +121,21 @@ private constructor( fun build(): DataStreamResponse = DataStreamResponse( checkRequired("success", success), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): DataStreamResponse = apply { + if (validated) { + return@apply + } + + success() + validated = true + } + class Success @JsonCreator private constructor(private val value: JsonField) : Enum { /** diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt index 788d0350..800f644c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt @@ -10,14 +10,12 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams -import com.openlayer.api.core.immutableEmptyMap -import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -58,164 +56,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): Body = body - - fun _pathParam(index: Int): String = - when (index) { - 0 -> inferencePipelineId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - put("inferenceId", inferenceId) - putAll(additionalQueryParams) - } - .build() - - @NoAutoDetect - class Body - @JsonCreator - private constructor( - @JsonProperty("row") @ExcludeMissing private val row: JsonValue = JsonMissing.of(), - @JsonProperty("config") - @ExcludeMissing - private val config: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - @JsonProperty("row") @ExcludeMissing fun _row(): JsonValue = row - - /** - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun config(): Optional = Optional.ofNullable(config.getNullable("config")) - - /** - * Returns the raw JSON value of [config]. - * - * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("config") @ExcludeMissing fun _config(): JsonField = config - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - config().ifPresent { it.validate() } - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Body]. - * - * The following fields are required: - * ```java - * .row() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var row: JsonValue? = null - private var config: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - row = body.row - config = body.config - additionalProperties = body.additionalProperties.toMutableMap() - } - - fun row(row: JsonValue) = apply { this.row = row } - - fun config(config: Config?) = config(JsonField.ofNullable(config)) - - /** Alias for calling [Builder.config] with `config.orElse(null)`. */ - fun config(config: Optional) = config(config.getOrNull()) - - /** - * Sets [Builder.config] to an arbitrary JSON value. - * - * You should usually call [Builder.config] with a well-typed [Config] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun config(config: JsonField) = apply { this.config = config } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .row() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body(checkRequired("row", row), config, additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Body && row == other.row && config == other.config && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(row, config, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{row=$row, config=$config, additionalProperties=$additionalProperties}" - } - fun toBuilder() = Builder().from(this) companion object { @@ -234,7 +74,6 @@ private constructor( } /** A builder for [RowUpdateParams]. */ - @NoAutoDetect class Builder internal constructor() { private var inferencePipelineId: String? = null @@ -415,29 +254,207 @@ private constructor( ) } - @NoAutoDetect - class Config - @JsonCreator + @JvmSynthetic internal fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> inferencePipelineId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + put("inferenceId", inferenceId) + putAll(additionalQueryParams) + } + .build() + + class Body private constructor( - @JsonProperty("groundTruthColumnName") - @ExcludeMissing - private val groundTruthColumnName: JsonField = JsonMissing.of(), - @JsonProperty("humanFeedbackColumnName") - @ExcludeMissing - private val humanFeedbackColumnName: JsonField = JsonMissing.of(), - @JsonProperty("inferenceIdColumnName") - @ExcludeMissing - private val inferenceIdColumnName: JsonField = JsonMissing.of(), - @JsonProperty("latencyColumnName") - @ExcludeMissing - private val latencyColumnName: JsonField = JsonMissing.of(), - @JsonProperty("timestampColumnName") - @ExcludeMissing - private val timestampColumnName: JsonField = JsonMissing.of(), + private val row: JsonValue, + private val config: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("row") @ExcludeMissing row: JsonValue = JsonMissing.of(), + @JsonProperty("config") @ExcludeMissing config: JsonField = JsonMissing.of(), + ) : this(row, config, mutableMapOf()) + + @JsonProperty("row") @ExcludeMissing fun _row(): JsonValue = row + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun config(): Optional = Optional.ofNullable(config.getNullable("config")) + + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("config") @ExcludeMissing fun _config(): JsonField = config + @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .row() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var row: JsonValue? = null + private var config: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + row = body.row + config = body.config + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun row(row: JsonValue) = apply { this.row = row } + + fun config(config: Config?) = config(JsonField.ofNullable(config)) + + /** Alias for calling [Builder.config] with `config.orElse(null)`. */ + fun config(config: Optional) = config(config.getOrNull()) + + /** + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [Config] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun config(config: JsonField) = apply { this.config = config } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .row() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body(checkRequired("row", row), config, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + config().ifPresent { it.validate() } + validated = true + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Body && row == other.row && config == other.config && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(row, config, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{row=$row, config=$config, additionalProperties=$additionalProperties}" + } + + class Config + private constructor( + private val groundTruthColumnName: JsonField, + private val humanFeedbackColumnName: JsonField, + private val inferenceIdColumnName: JsonField, + private val latencyColumnName: JsonField, + private val timestampColumnName: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("groundTruthColumnName") + @ExcludeMissing + groundTruthColumnName: JsonField = JsonMissing.of(), + @JsonProperty("humanFeedbackColumnName") + @ExcludeMissing + humanFeedbackColumnName: JsonField = JsonMissing.of(), + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + inferenceIdColumnName: JsonField = JsonMissing.of(), + @JsonProperty("latencyColumnName") + @ExcludeMissing + latencyColumnName: JsonField = JsonMissing.of(), + @JsonProperty("timestampColumnName") + @ExcludeMissing + timestampColumnName: JsonField = JsonMissing.of(), + ) : this( + groundTruthColumnName, + humanFeedbackColumnName, + inferenceIdColumnName, + latencyColumnName, + timestampColumnName, + mutableMapOf(), + ) + /** * Name of the column with the ground truths. * @@ -535,24 +552,15 @@ private constructor( @ExcludeMissing fun _timestampColumnName(): JsonField = timestampColumnName + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Config = apply { - if (validated) { - return@apply - } - - groundTruthColumnName() - humanFeedbackColumnName() - inferenceIdColumnName() - latencyColumnName() - timestampColumnName() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -728,10 +736,25 @@ private constructor( inferenceIdColumnName, latencyColumnName, timestampColumnName, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Config = apply { + if (validated) { + return@apply + } + + groundTruthColumnName() + humanFeedbackColumnName() + inferenceIdColumnName() + latencyColumnName() + timestampColumnName() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt index c857c633..c1867d00 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt @@ -11,23 +11,22 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.checkRequired -import com.openlayer.api.core.immutableEmptyMap -import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections import java.util.Objects -@NoAutoDetect class RowUpdateResponse -@JsonCreator private constructor( - @JsonProperty("success") - @ExcludeMissing - private val success: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val success: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("success") @ExcludeMissing success: JsonField = JsonMissing.of() + ) : this(success, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -41,20 +40,15 @@ private constructor( */ @JsonProperty("success") @ExcludeMissing fun _success(): JsonField = success + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): RowUpdateResponse = apply { - if (validated) { - return@apply - } - - success() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -125,7 +119,21 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): RowUpdateResponse = - RowUpdateResponse(checkRequired("success", success), additionalProperties.toImmutable()) + RowUpdateResponse( + checkRequired("success", success), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): RowUpdateResponse = apply { + if (validated) { + return@apply + } + + success() + validated = true } class Success @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt index e28f7732..4724a06f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt @@ -5,7 +5,6 @@ package com.openlayer.api.models.inferencepipelines.testresults import com.fasterxml.jackson.annotation.JsonCreator import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers @@ -51,25 +50,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _pathParam(index: Int): String = - when (index) { - 0 -> inferencePipelineId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - page?.let { put("page", it.toString()) } - perPage?.let { put("perPage", it.toString()) } - status?.let { put("status", it.toString()) } - type?.let { put("type", it.toString()) } - putAll(additionalQueryParams) - } - .build() - fun toBuilder() = Builder().from(this) companion object { @@ -86,7 +66,6 @@ private constructor( } /** A builder for [TestResultListParams]. */ - @NoAutoDetect class Builder internal constructor() { private var inferencePipelineId: String? = null @@ -278,6 +257,25 @@ private constructor( ) } + fun _pathParam(index: Int): String = + when (index) { + 0 -> inferencePipelineId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + status?.let { put("status", it.toString()) } + type?.let { put("type", it.toString()) } + putAll(additionalQueryParams) + } + .build() + /** * Filter list of test results by status. Available statuses are `running`, `passing`, * `failing`, `skipped`, and `error`. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt index 0db24df5..e5b5efb6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt @@ -20,28 +20,28 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired import com.openlayer.api.core.getOrThrow -import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -@NoAutoDetect class TestResultListResponse -@JsonCreator private constructor( - @JsonProperty("items") - @ExcludeMissing - private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val items: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -55,20 +55,15 @@ private constructor( */ @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): TestResultListResponse = apply { - if (validated) { - return@apply - } - - items().forEach { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -154,47 +149,79 @@ private constructor( fun build(): TestResultListResponse = TestResultListResponse( checkRequired("items", items).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): TestResultListResponse = apply { + if (validated) { + return@apply + } + + items().forEach { it.validate() } + validated = true + } + class Item - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateDataEnds") - @ExcludeMissing - private val dateDataEnds: JsonField = JsonMissing.of(), - @JsonProperty("dateDataStarts") - @ExcludeMissing - private val dateDataStarts: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("inferencePipelineId") - @ExcludeMissing - private val inferencePipelineId: JsonField = JsonMissing.of(), - @JsonProperty("projectVersionId") - @ExcludeMissing - private val projectVersionId: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("statusMessage") - @ExcludeMissing - private val statusMessage: JsonField = JsonMissing.of(), - @JsonProperty("goal") @ExcludeMissing private val goal: JsonField = JsonMissing.of(), - @JsonProperty("goalId") - @ExcludeMissing - private val goalId: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val dateCreated: JsonField, + private val dateDataEnds: JsonField, + private val dateDataStarts: JsonField, + private val dateUpdated: JsonField, + private val inferencePipelineId: JsonField, + private val projectVersionId: JsonField, + private val status: JsonField, + private val statusMessage: JsonField, + private val goal: JsonField, + private val goalId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateDataEnds") + @ExcludeMissing + dateDataEnds: JsonField = JsonMissing.of(), + @JsonProperty("dateDataStarts") + @ExcludeMissing + dateDataStarts: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineId") + @ExcludeMissing + inferencePipelineId: JsonField = JsonMissing.of(), + @JsonProperty("projectVersionId") + @ExcludeMissing + projectVersionId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("goal") @ExcludeMissing goal: JsonField = JsonMissing.of(), + @JsonProperty("goalId") @ExcludeMissing goalId: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateDataEnds, + dateDataStarts, + dateUpdated, + inferencePipelineId, + projectVersionId, + status, + statusMessage, + goal, + goalId, + mutableMapOf(), + ) + /** * Project version (commit) id. * @@ -382,30 +409,15 @@ private constructor( */ @JsonProperty("goalId") @ExcludeMissing fun _goalId(): JsonField = goalId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Item = apply { - if (validated) { - return@apply - } - - id() - dateCreated() - dateDataEnds() - dateDataStarts() - dateUpdated() - inferencePipelineId() - projectVersionId() - status() - statusMessage() - goal().ifPresent { it.validate() } - goalId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -692,10 +704,31 @@ private constructor( checkRequired("statusMessage", statusMessage), goal, goalId, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateDataEnds() + dateDataStarts() + dateUpdated() + inferencePipelineId() + projectVersionId() + status() + statusMessage() + goal().ifPresent { it.validate() } + goalId() + validated = true + } + /** The status of the test. */ class Status @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -817,80 +850,119 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class Goal - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("commentCount") - @ExcludeMissing - private val commentCount: JsonField = JsonMissing.of(), - @JsonProperty("creatorId") - @ExcludeMissing - private val creatorId: JsonField = JsonMissing.of(), - @JsonProperty("dateArchived") - @ExcludeMissing - private val dateArchived: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonValue = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("number") - @ExcludeMissing - private val number: JsonField = JsonMissing.of(), - @JsonProperty("originProjectVersionId") - @ExcludeMissing - private val originProjectVersionId: JsonField = JsonMissing.of(), - @JsonProperty("subtype") - @ExcludeMissing - private val subtype: JsonField = JsonMissing.of(), - @JsonProperty("suggested") - @ExcludeMissing - private val suggested: JsonField = JsonMissing.of(), - @JsonProperty("thresholds") - @ExcludeMissing - private val thresholds: JsonField> = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonProperty("archived") - @ExcludeMissing - private val archived: JsonField = JsonMissing.of(), - @JsonProperty("delayWindow") - @ExcludeMissing - private val delayWindow: JsonField = JsonMissing.of(), - @JsonProperty("evaluationWindow") - @ExcludeMissing - private val evaluationWindow: JsonField = JsonMissing.of(), - @JsonProperty("usesMlModel") - @ExcludeMissing - private val usesMlModel: JsonField = JsonMissing.of(), - @JsonProperty("usesProductionData") - @ExcludeMissing - private val usesProductionData: JsonField = JsonMissing.of(), - @JsonProperty("usesReferenceDataset") - @ExcludeMissing - private val usesReferenceDataset: JsonField = JsonMissing.of(), - @JsonProperty("usesTrainingDataset") - @ExcludeMissing - private val usesTrainingDataset: JsonField = JsonMissing.of(), - @JsonProperty("usesValidationDataset") - @ExcludeMissing - private val usesValidationDataset: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val commentCount: JsonField, + private val creatorId: JsonField, + private val dateArchived: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val description: JsonValue, + private val name: JsonField, + private val number: JsonField, + private val originProjectVersionId: JsonField, + private val subtype: JsonField, + private val suggested: JsonField, + private val thresholds: JsonField>, + private val type: JsonField, + private val archived: JsonField, + private val delayWindow: JsonField, + private val evaluationWindow: JsonField, + private val usesMlModel: JsonField, + private val usesProductionData: JsonField, + private val usesReferenceDataset: JsonField, + private val usesTrainingDataset: JsonField, + private val usesValidationDataset: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("commentCount") + @ExcludeMissing + commentCount: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateArchived") + @ExcludeMissing + dateArchived: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonValue = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("number") @ExcludeMissing number: JsonField = JsonMissing.of(), + @JsonProperty("originProjectVersionId") + @ExcludeMissing + originProjectVersionId: JsonField = JsonMissing.of(), + @JsonProperty("subtype") + @ExcludeMissing + subtype: JsonField = JsonMissing.of(), + @JsonProperty("suggested") + @ExcludeMissing + suggested: JsonField = JsonMissing.of(), + @JsonProperty("thresholds") + @ExcludeMissing + thresholds: JsonField> = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("archived") + @ExcludeMissing + archived: JsonField = JsonMissing.of(), + @JsonProperty("delayWindow") + @ExcludeMissing + delayWindow: JsonField = JsonMissing.of(), + @JsonProperty("evaluationWindow") + @ExcludeMissing + evaluationWindow: JsonField = JsonMissing.of(), + @JsonProperty("usesMlModel") + @ExcludeMissing + usesMlModel: JsonField = JsonMissing.of(), + @JsonProperty("usesProductionData") + @ExcludeMissing + usesProductionData: JsonField = JsonMissing.of(), + @JsonProperty("usesReferenceDataset") + @ExcludeMissing + usesReferenceDataset: JsonField = JsonMissing.of(), + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + usesTrainingDataset: JsonField = JsonMissing.of(), + @JsonProperty("usesValidationDataset") + @ExcludeMissing + usesValidationDataset: JsonField = JsonMissing.of(), + ) : this( + id, + commentCount, + creatorId, + dateArchived, + dateCreated, + dateUpdated, + description, + name, + number, + originProjectVersionId, + subtype, + suggested, + thresholds, + type, + archived, + delayWindow, + evaluationWindow, + usesMlModel, + usesProductionData, + usesReferenceDataset, + usesTrainingDataset, + usesValidationDataset, + mutableMapOf(), + ) + /** * The test id. * @@ -1274,40 +1346,15 @@ private constructor( @ExcludeMissing fun _usesValidationDataset(): JsonField = usesValidationDataset + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Goal = apply { - if (validated) { - return@apply - } - - id() - commentCount() - creatorId() - dateArchived() - dateCreated() - dateUpdated() - name() - number() - originProjectVersionId() - subtype() - suggested() - thresholds().forEach { it.validate() } - type() - archived() - delayWindow() - evaluationWindow() - usesMlModel() - usesProductionData() - usesReferenceDataset() - usesTrainingDataset() - usesValidationDataset() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1806,33 +1853,77 @@ private constructor( usesReferenceDataset, usesTrainingDataset, usesValidationDataset, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): Goal = apply { + if (validated) { + return@apply + } + + id() + commentCount() + creatorId() + dateArchived() + dateCreated() + dateUpdated() + name() + number() + originProjectVersionId() + subtype() + suggested() + thresholds().forEach { it.validate() } + type() + archived() + delayWindow() + evaluationWindow() + usesMlModel() + usesProductionData() + usesReferenceDataset() + usesTrainingDataset() + usesValidationDataset() + validated = true + } + class Threshold - @JsonCreator private constructor( - @JsonProperty("insightName") - @ExcludeMissing - private val insightName: JsonField = JsonMissing.of(), - @JsonProperty("insightParameters") - @ExcludeMissing - private val insightParameters: JsonField> = JsonMissing.of(), - @JsonProperty("measurement") - @ExcludeMissing - private val measurement: JsonField = JsonMissing.of(), - @JsonProperty("operator") - @ExcludeMissing - private val operator: JsonField = JsonMissing.of(), - @JsonProperty("value") - @ExcludeMissing - private val value: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val insightName: JsonField, + private val insightParameters: JsonField>, + private val measurement: JsonField, + private val operator: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("insightName") + @ExcludeMissing + insightName: JsonField = JsonMissing.of(), + @JsonProperty("insightParameters") + @ExcludeMissing + insightParameters: JsonField> = JsonMissing.of(), + @JsonProperty("measurement") + @ExcludeMissing + measurement: JsonField = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + operator: JsonField = JsonMissing.of(), + @JsonProperty("value") + @ExcludeMissing + value: JsonField = JsonMissing.of(), + ) : this( + insightName, + insightParameters, + measurement, + operator, + value, + mutableMapOf(), + ) + /** * The insight name to be evaluated. * @@ -1923,24 +2014,15 @@ private constructor( */ @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Threshold = apply { - if (validated) { - return@apply - } - - insightName() - insightParameters() - measurement() - operator() - value().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2094,10 +2176,25 @@ private constructor( measurement, operator, value, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Threshold = apply { + if (validated) { + return@apply + } + + insightName() + insightParameters() + measurement() + operator() + value().ifPresent { it.validate() } + validated = true + } + /** The value to be compared. */ @JsonDeserialize(using = Value.Deserializer::class) @JsonSerialize(using = Value.Serializer::class) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt index 49da43f3..dd9e55ce 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt @@ -11,15 +11,13 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams -import com.openlayer.api.core.immutableEmptyMap -import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -279,276 +277,711 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams + fun toBuilder() = Builder().from(this) - @NoAutoDetect - class Body - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("creatorId") - @ExcludeMissing - private val creatorId: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("developmentGoalCount") - @ExcludeMissing - private val developmentGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("goalCount") - @ExcludeMissing - private val goalCount: JsonField = JsonMissing.of(), - @JsonProperty("inferencePipelineCount") - @ExcludeMissing - private val inferencePipelineCount: JsonField = JsonMissing.of(), - @JsonProperty("links") - @ExcludeMissing - private val links: JsonField = JsonMissing.of(), - @JsonProperty("monitoringGoalCount") - @ExcludeMissing - private val monitoringGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("source") - @ExcludeMissing - private val source: JsonField = JsonMissing.of(), - @JsonProperty("taskType") - @ExcludeMissing - private val taskType: JsonField = JsonMissing.of(), - @JsonProperty("versionCount") - @ExcludeMissing - private val versionCount: JsonField = JsonMissing.of(), - @JsonProperty("workspaceId") - @ExcludeMissing - private val workspaceId: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("gitRepo") - @ExcludeMissing - private val gitRepo: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { /** - * The project id. + * Returns a mutable builder for constructing an instance of [ProjectCreateParams]. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` */ - fun id(): String = id.getRequired("id") + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ProjectCreateParams]. */ + class Builder internal constructor() { + + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(projectCreateParams: ProjectCreateParams) = apply { + body = projectCreateParams.body.toBuilder() + additionalHeaders = projectCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = projectCreateParams.additionalQueryParams.toBuilder() + } + + /** The project id. */ + fun id(id: String) = apply { body.id(id) } /** - * The project creator id. + * Sets [Builder.id] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + fun id(id: JsonField) = apply { body.id(id) } + + /** The project creator id. */ + fun creatorId(creatorId: String?) = apply { body.creatorId(creatorId) } + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) /** - * The project creation date. + * Sets [Builder.creatorId] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + fun creatorId(creatorId: JsonField) = apply { body.creatorId(creatorId) } + + /** The project creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = apply { body.dateCreated(dateCreated) } /** - * The project last updated date. + * Sets [Builder.dateCreated] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + fun dateCreated(dateCreated: JsonField) = apply { + body.dateCreated(dateCreated) + } + + /** The project last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = apply { body.dateUpdated(dateUpdated) } /** - * The number of tests in the development mode of the project. + * Sets [Builder.dateUpdated] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") + fun dateUpdated(dateUpdated: JsonField) = apply { + body.dateUpdated(dateUpdated) + } + + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: Long) = apply { + body.developmentGoalCount(developmentGoalCount) + } /** - * The total number of tests in the project. + * Sets [Builder.developmentGoalCount] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.developmentGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun goalCount(): Long = goalCount.getRequired("goalCount") + fun developmentGoalCount(developmentGoalCount: JsonField) = apply { + body.developmentGoalCount(developmentGoalCount) + } + + /** The total number of tests in the project. */ + fun goalCount(goalCount: Long) = apply { body.goalCount(goalCount) } /** - * The number of inference pipelines in the project. + * Sets [Builder.goalCount] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.goalCount] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun inferencePipelineCount(): Long = - inferencePipelineCount.getRequired("inferencePipelineCount") + fun goalCount(goalCount: JsonField) = apply { body.goalCount(goalCount) } + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(inferencePipelineCount: Long) = apply { + body.inferencePipelineCount(inferencePipelineCount) + } /** - * Links to the project. + * Sets [Builder.inferencePipelineCount] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.inferencePipelineCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun links(): Links = links.getRequired("links") + fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { + body.inferencePipelineCount(inferencePipelineCount) + } + + /** Links to the project. */ + fun links(links: Links) = apply { body.links(links) } /** - * The number of tests in the monitoring mode of the project. + * Sets [Builder.links] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") + fun links(links: JsonField) = apply { body.links(links) } + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(monitoringGoalCount: Long) = apply { + body.monitoringGoalCount(monitoringGoalCount) + } /** - * The project name. + * Sets [Builder.monitoringGoalCount] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.monitoringGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun name(): String = name.getRequired("name") + fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { + body.monitoringGoalCount(monitoringGoalCount) + } + + /** The project name. */ + fun name(name: String) = apply { body.name(name) } /** - * The source of the project. + * Sets [Builder.name] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun source(): Optional = Optional.ofNullable(source.getNullable("source")) + fun name(name: JsonField) = apply { body.name(name) } + + /** The source of the project. */ + fun source(source: Source?) = apply { body.source(source) } + + /** Alias for calling [Builder.source] with `source.orElse(null)`. */ + fun source(source: Optional) = source(source.getOrNull()) /** - * The task type of the project. + * Sets [Builder.source] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.source] with a well-typed [Source] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun taskType(): TaskType = taskType.getRequired("taskType") + fun source(source: JsonField) = apply { body.source(source) } + + /** The task type of the project. */ + fun taskType(taskType: TaskType) = apply { body.taskType(taskType) } /** - * The number of versions (commits) in the project. + * Sets [Builder.taskType] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.taskType] with a well-typed [TaskType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun versionCount(): Long = versionCount.getRequired("versionCount") + fun taskType(taskType: JsonField) = apply { body.taskType(taskType) } + + /** The number of versions (commits) in the project. */ + fun versionCount(versionCount: Long) = apply { body.versionCount(versionCount) } /** - * The workspace id. + * Sets [Builder.versionCount] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). + * You should usually call [Builder.versionCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun versionCount(versionCount: JsonField) = apply { body.versionCount(versionCount) } + + /** The workspace id. */ + fun workspaceId(workspaceId: String?) = apply { body.workspaceId(workspaceId) } + + /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) /** - * The project description. + * Sets [Builder.workspaceId] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). + * You should usually call [Builder.workspaceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun workspaceId(workspaceId: JsonField) = apply { body.workspaceId(workspaceId) } - /** - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) + /** The project description. */ + fun description(description: String?) = apply { body.description(description) } + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) /** - * Returns the raw JSON value of [id]. + * Sets [Builder.description] to an arbitrary JSON value. * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + fun description(description: JsonField) = apply { body.description(description) } + + fun gitRepo(gitRepo: GitRepo?) = apply { body.gitRepo(gitRepo) } + + /** Alias for calling [Builder.gitRepo] with `gitRepo.orElse(null)`. */ + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) /** - * Returns the raw JSON value of [creatorId]. + * Sets [Builder.gitRepo] to an arbitrary JSON value. * - * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.gitRepo] with a well-typed [GitRepo] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId + fun gitRepo(gitRepo: JsonField) = apply { body.gitRepo(gitRepo) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } /** - * Returns the raw JSON value of [dateCreated]. + * Returns an immutable instance of [ProjectCreateParams]. * - * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated(): JsonField = dateCreated + fun build(): ProjectCreateParams = + ProjectCreateParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + @JvmSynthetic internal fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + private constructor( + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val developmentGoalCount: JsonField, + private val goalCount: JsonField, + private val inferencePipelineCount: JsonField, + private val links: JsonField, + private val monitoringGoalCount: JsonField, + private val name: JsonField, + private val source: JsonField, + private val taskType: JsonField, + private val versionCount: JsonField, + private val workspaceId: JsonField, + private val description: JsonField, + private val gitRepo: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("developmentGoalCount") + @ExcludeMissing + developmentGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("goalCount") + @ExcludeMissing + goalCount: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + inferencePipelineCount: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing links: JsonField = JsonMissing.of(), + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + monitoringGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("source") @ExcludeMissing source: JsonField = JsonMissing.of(), + @JsonProperty("taskType") + @ExcludeMissing + taskType: JsonField = JsonMissing.of(), + @JsonProperty("versionCount") + @ExcludeMissing + versionCount: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("gitRepo") @ExcludeMissing gitRepo: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + developmentGoalCount, + goalCount, + inferencePipelineCount, + links, + monitoringGoalCount, + name, + source, + taskType, + versionCount, + workspaceId, + description, + gitRepo, + mutableMapOf(), + ) /** - * Returns the raw JSON value of [dateUpdated]. + * The project id. * - * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated(): JsonField = dateUpdated + fun id(): String = id.getRequired("id") /** - * Returns the raw JSON value of [developmentGoalCount]. + * The project creator id. * - * Unlike [developmentGoalCount], this method doesn't throw if the JSON field has an - * unexpected type. + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ - @JsonProperty("developmentGoalCount") - @ExcludeMissing - fun _developmentGoalCount(): JsonField = developmentGoalCount + fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) /** - * Returns the raw JSON value of [goalCount]. + * The project creation date. * - * Unlike [goalCount], this method doesn't throw if the JSON field has an unexpected type. + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") /** - * Returns the raw JSON value of [inferencePipelineCount]. + * The project last updated date. * - * Unlike [inferencePipelineCount], this method doesn't throw if the JSON field has an - * unexpected type. + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - @JsonProperty("inferencePipelineCount") - @ExcludeMissing - fun _inferencePipelineCount(): JsonField = inferencePipelineCount + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** - * Returns the raw JSON value of [links]. + * The number of tests in the development mode of the project. * - * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links + fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") /** - * Returns the raw JSON value of [monitoringGoalCount]. + * The total number of tests in the project. * - * Unlike [monitoringGoalCount], this method doesn't throw if the JSON field has an - * unexpected type. + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - @JsonProperty("monitoringGoalCount") - @ExcludeMissing - fun _monitoringGoalCount(): JsonField = monitoringGoalCount + fun goalCount(): Long = goalCount.getRequired("goalCount") /** - * Returns the raw JSON value of [name]. + * The number of inference pipelines in the project. * - * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. - */ + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun inferencePipelineCount(): Long = + inferencePipelineCount.getRequired("inferencePipelineCount") + + /** + * Links to the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun links(): Links = links.getRequired("links") + + /** + * The number of tests in the monitoring mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") + + /** + * The project name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * The source of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun source(): Optional = Optional.ofNullable(source.getNullable("source")) + + /** + * The task type of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun taskType(): TaskType = taskType.getRequired("taskType") + + /** + * The number of versions (commits) in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun versionCount(): Long = versionCount.getRequired("versionCount") + + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) + + /** + * The project description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [developmentGoalCount]. + * + * Unlike [developmentGoalCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("developmentGoalCount") + @ExcludeMissing + fun _developmentGoalCount(): JsonField = developmentGoalCount + + /** + * Returns the raw JSON value of [goalCount]. + * + * Unlike [goalCount], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount + + /** + * Returns the raw JSON value of [inferencePipelineCount]. + * + * Unlike [inferencePipelineCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + fun _inferencePipelineCount(): JsonField = inferencePipelineCount + + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links + + /** + * Returns the raw JSON value of [monitoringGoalCount]. + * + * Unlike [monitoringGoalCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + fun _monitoringGoalCount(): JsonField = monitoringGoalCount + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** @@ -600,35 +1033,15 @@ private constructor( */ @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - id() - creatorId() - dateCreated() - dateUpdated() - developmentGoalCount() - goalCount() - inferencePipelineCount() - links().validate() - monitoringGoalCount() - name() - source() - taskType() - versionCount() - workspaceId() - description() - gitRepo().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -917,517 +1330,136 @@ private constructor( fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) /** - * Sets [Builder.gitRepo] to an arbitrary JSON value. - * - * You should usually call [Builder.gitRepo] with a well-typed [GitRepo] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .creatorId() - * .dateCreated() - * .dateUpdated() - * .developmentGoalCount() - * .goalCount() - * .inferencePipelineCount() - * .links() - * .monitoringGoalCount() - * .name() - * .source() - * .taskType() - * .versionCount() - * .workspaceId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body( - checkRequired("id", id), - checkRequired("creatorId", creatorId), - checkRequired("dateCreated", dateCreated), - checkRequired("dateUpdated", dateUpdated), - checkRequired("developmentGoalCount", developmentGoalCount), - checkRequired("goalCount", goalCount), - checkRequired("inferencePipelineCount", inferencePipelineCount), - checkRequired("links", links), - checkRequired("monitoringGoalCount", monitoringGoalCount), - checkRequired("name", name), - checkRequired("source", source), - checkRequired("taskType", taskType), - checkRequired("versionCount", versionCount), - checkRequired("workspaceId", workspaceId), - description, - gitRepo, - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Body && id == other.id && creatorId == other.creatorId && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && developmentGoalCount == other.developmentGoalCount && goalCount == other.goalCount && inferencePipelineCount == other.inferencePipelineCount && links == other.links && monitoringGoalCount == other.monitoringGoalCount && name == other.name && source == other.source && taskType == other.taskType && versionCount == other.versionCount && workspaceId == other.workspaceId && description == other.description && gitRepo == other.gitRepo && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, creatorId, dateCreated, dateUpdated, developmentGoalCount, goalCount, inferencePipelineCount, links, monitoringGoalCount, name, source, taskType, versionCount, workspaceId, description, gitRepo, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, developmentGoalCount=$developmentGoalCount, goalCount=$goalCount, inferencePipelineCount=$inferencePipelineCount, links=$links, monitoringGoalCount=$monitoringGoalCount, name=$name, source=$source, taskType=$taskType, versionCount=$versionCount, workspaceId=$workspaceId, description=$description, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" - } - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [ProjectCreateParams]. - * - * The following fields are required: - * ```java - * .id() - * .creatorId() - * .dateCreated() - * .dateUpdated() - * .developmentGoalCount() - * .goalCount() - * .inferencePipelineCount() - * .links() - * .monitoringGoalCount() - * .name() - * .source() - * .taskType() - * .versionCount() - * .workspaceId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [ProjectCreateParams]. */ - @NoAutoDetect - class Builder internal constructor() { - - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(projectCreateParams: ProjectCreateParams) = apply { - body = projectCreateParams.body.toBuilder() - additionalHeaders = projectCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = projectCreateParams.additionalQueryParams.toBuilder() - } - - /** The project id. */ - fun id(id: String) = apply { body.id(id) } - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun id(id: JsonField) = apply { body.id(id) } - - /** The project creator id. */ - fun creatorId(creatorId: String?) = apply { body.creatorId(creatorId) } - - /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ - fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) - - /** - * Sets [Builder.creatorId] to an arbitrary JSON value. - * - * You should usually call [Builder.creatorId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun creatorId(creatorId: JsonField) = apply { body.creatorId(creatorId) } - - /** The project creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = apply { body.dateCreated(dateCreated) } - - /** - * Sets [Builder.dateCreated] to an arbitrary JSON value. - * - * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun dateCreated(dateCreated: JsonField) = apply { - body.dateCreated(dateCreated) - } - - /** The project last updated date. */ - fun dateUpdated(dateUpdated: OffsetDateTime) = apply { body.dateUpdated(dateUpdated) } - - /** - * Sets [Builder.dateUpdated] to an arbitrary JSON value. - * - * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun dateUpdated(dateUpdated: JsonField) = apply { - body.dateUpdated(dateUpdated) - } - - /** The number of tests in the development mode of the project. */ - fun developmentGoalCount(developmentGoalCount: Long) = apply { - body.developmentGoalCount(developmentGoalCount) - } - - /** - * Sets [Builder.developmentGoalCount] to an arbitrary JSON value. - * - * You should usually call [Builder.developmentGoalCount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun developmentGoalCount(developmentGoalCount: JsonField) = apply { - body.developmentGoalCount(developmentGoalCount) - } - - /** The total number of tests in the project. */ - fun goalCount(goalCount: Long) = apply { body.goalCount(goalCount) } - - /** - * Sets [Builder.goalCount] to an arbitrary JSON value. - * - * You should usually call [Builder.goalCount] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun goalCount(goalCount: JsonField) = apply { body.goalCount(goalCount) } - - /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(inferencePipelineCount: Long) = apply { - body.inferencePipelineCount(inferencePipelineCount) - } - - /** - * Sets [Builder.inferencePipelineCount] to an arbitrary JSON value. - * - * You should usually call [Builder.inferencePipelineCount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { - body.inferencePipelineCount(inferencePipelineCount) - } - - /** Links to the project. */ - fun links(links: Links) = apply { body.links(links) } - - /** - * Sets [Builder.links] to an arbitrary JSON value. - * - * You should usually call [Builder.links] with a well-typed [Links] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun links(links: JsonField) = apply { body.links(links) } - - /** The number of tests in the monitoring mode of the project. */ - fun monitoringGoalCount(monitoringGoalCount: Long) = apply { - body.monitoringGoalCount(monitoringGoalCount) - } - - /** - * Sets [Builder.monitoringGoalCount] to an arbitrary JSON value. - * - * You should usually call [Builder.monitoringGoalCount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { - body.monitoringGoalCount(monitoringGoalCount) - } - - /** The project name. */ - fun name(name: String) = apply { body.name(name) } - - /** - * Sets [Builder.name] to an arbitrary JSON value. - * - * You should usually call [Builder.name] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun name(name: JsonField) = apply { body.name(name) } - - /** The source of the project. */ - fun source(source: Source?) = apply { body.source(source) } - - /** Alias for calling [Builder.source] with `source.orElse(null)`. */ - fun source(source: Optional) = source(source.getOrNull()) - - /** - * Sets [Builder.source] to an arbitrary JSON value. - * - * You should usually call [Builder.source] with a well-typed [Source] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun source(source: JsonField) = apply { body.source(source) } - - /** The task type of the project. */ - fun taskType(taskType: TaskType) = apply { body.taskType(taskType) } - - /** - * Sets [Builder.taskType] to an arbitrary JSON value. - * - * You should usually call [Builder.taskType] with a well-typed [TaskType] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun taskType(taskType: JsonField) = apply { body.taskType(taskType) } - - /** The number of versions (commits) in the project. */ - fun versionCount(versionCount: Long) = apply { body.versionCount(versionCount) } - - /** - * Sets [Builder.versionCount] to an arbitrary JSON value. - * - * You should usually call [Builder.versionCount] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun versionCount(versionCount: JsonField) = apply { body.versionCount(versionCount) } - - /** The workspace id. */ - fun workspaceId(workspaceId: String?) = apply { body.workspaceId(workspaceId) } - - /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ - fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) - - /** - * Sets [Builder.workspaceId] to an arbitrary JSON value. - * - * You should usually call [Builder.workspaceId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun workspaceId(workspaceId: JsonField) = apply { body.workspaceId(workspaceId) } - - /** The project description. */ - fun description(description: String?) = apply { body.description(description) } - - /** Alias for calling [Builder.description] with `description.orElse(null)`. */ - fun description(description: Optional) = description(description.getOrNull()) - - /** - * Sets [Builder.description] to an arbitrary JSON value. - * - * You should usually call [Builder.description] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun description(description: JsonField) = apply { body.description(description) } - - fun gitRepo(gitRepo: GitRepo?) = apply { body.gitRepo(gitRepo) } - - /** Alias for calling [Builder.gitRepo] with `gitRepo.orElse(null)`. */ - fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) - - /** - * Sets [Builder.gitRepo] to an arbitrary JSON value. - * - * You should usually call [Builder.gitRepo] with a well-typed [GitRepo] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun gitRepo(gitRepo: JsonField) = apply { body.gitRepo(gitRepo) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + * Sets [Builder.gitRepo] to an arbitrary JSON value. + * + * You should usually call [Builder.gitRepo] with a well-typed [GitRepo] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("developmentGoalCount", developmentGoalCount), + checkRequired("goalCount", goalCount), + checkRequired("inferencePipelineCount", inferencePipelineCount), + checkRequired("links", links), + checkRequired("monitoringGoalCount", monitoringGoalCount), + checkRequired("name", name), + checkRequired("source", source), + checkRequired("taskType", taskType), + checkRequired("versionCount", versionCount), + checkRequired("workspaceId", workspaceId), + description, + gitRepo, + additionalProperties.toMutableMap(), + ) } - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } + private var validated: Boolean = false - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) + fun validate(): Body = apply { + if (validated) { + return@apply } - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) + id() + creatorId() + dateCreated() + dateUpdated() + developmentGoalCount() + goalCount() + inferencePipelineCount() + links().validate() + monitoringGoalCount() + name() + source() + taskType() + versionCount() + workspaceId() + description() + gitRepo().ifPresent { it.validate() } + validated = true } - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) + return /* spotless:off */ other is Body && id == other.id && creatorId == other.creatorId && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && developmentGoalCount == other.developmentGoalCount && goalCount == other.goalCount && inferencePipelineCount == other.inferencePipelineCount && links == other.links && monitoringGoalCount == other.monitoringGoalCount && name == other.name && source == other.source && taskType == other.taskType && versionCount == other.versionCount && workspaceId == other.workspaceId && description == other.description && gitRepo == other.gitRepo && additionalProperties == other.additionalProperties /* spotless:on */ } - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, creatorId, dateCreated, dateUpdated, developmentGoalCount, goalCount, inferencePipelineCount, links, monitoringGoalCount, name, source, taskType, versionCount, workspaceId, description, gitRepo, additionalProperties) } + /* spotless:on */ - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } + override fun hashCode(): Int = hashCode - /** - * Returns an immutable instance of [ProjectCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .creatorId() - * .dateCreated() - * .dateUpdated() - * .developmentGoalCount() - * .goalCount() - * .inferencePipelineCount() - * .links() - * .monitoringGoalCount() - * .name() - * .source() - * .taskType() - * .versionCount() - * .workspaceId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): ProjectCreateParams = - ProjectCreateParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) + override fun toString() = + "Body{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, developmentGoalCount=$developmentGoalCount, goalCount=$goalCount, inferencePipelineCount=$inferencePipelineCount, links=$links, monitoringGoalCount=$monitoringGoalCount, name=$name, source=$source, taskType=$taskType, versionCount=$versionCount, workspaceId=$workspaceId, description=$description, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" } /** Links to the project. */ - @NoAutoDetect class Links - @JsonCreator private constructor( - @JsonProperty("app") @ExcludeMissing private val app: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val app: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing app: JsonField = JsonMissing.of() + ) : this(app, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -1441,20 +1473,15 @@ private constructor( */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Links = apply { - if (validated) { - return@apply - } - - app() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1526,7 +1553,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): Links = - Links(checkRequired("app", app), additionalProperties.toImmutable()) + Links(checkRequired("app", app), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true } override fun equals(other: Any?): Boolean { @@ -1766,46 +1804,63 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class GitRepo - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("dateConnected") - @ExcludeMissing - private val dateConnected: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("gitAccountId") - @ExcludeMissing - private val gitAccountId: JsonField = JsonMissing.of(), - @JsonProperty("gitId") - @ExcludeMissing - private val gitId: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("private") - @ExcludeMissing - private val private_: JsonField = JsonMissing.of(), - @JsonProperty("projectId") - @ExcludeMissing - private val projectId: JsonField = JsonMissing.of(), - @JsonProperty("slug") - @ExcludeMissing - private val slug: JsonField = JsonMissing.of(), - @JsonProperty("url") @ExcludeMissing private val url: JsonField = JsonMissing.of(), - @JsonProperty("branch") - @ExcludeMissing - private val branch: JsonField = JsonMissing.of(), - @JsonProperty("rootDir") - @ExcludeMissing - private val rootDir: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val dateConnected: JsonField, + private val dateUpdated: JsonField, + private val gitAccountId: JsonField, + private val gitId: JsonField, + private val name: JsonField, + private val private_: JsonField, + private val projectId: JsonField, + private val slug: JsonField, + private val url: JsonField, + private val branch: JsonField, + private val rootDir: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateConnected") + @ExcludeMissing + dateConnected: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("gitAccountId") + @ExcludeMissing + gitAccountId: JsonField = JsonMissing.of(), + @JsonProperty("gitId") @ExcludeMissing gitId: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("private") + @ExcludeMissing + private_: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("url") @ExcludeMissing url: JsonField = JsonMissing.of(), + @JsonProperty("branch") @ExcludeMissing branch: JsonField = JsonMissing.of(), + @JsonProperty("rootDir") @ExcludeMissing rootDir: JsonField = JsonMissing.of(), + ) : this( + id, + dateConnected, + dateUpdated, + gitAccountId, + gitId, + name, + private_, + projectId, + slug, + url, + branch, + rootDir, + mutableMapOf(), + ) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -1970,31 +2025,15 @@ private constructor( */ @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): GitRepo = apply { - if (validated) { - return@apply - } - - id() - dateConnected() - dateUpdated() - gitAccountId() - gitId() - name() - private_() - projectId() - slug() - url() - branch() - rootDir() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2247,10 +2286,32 @@ private constructor( checkRequired("url", url), branch, rootDir, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): GitRepo = apply { + if (validated) { + return@apply + } + + id() + dateConnected() + dateUpdated() + gitAccountId() + gitId() + name() + private_() + projectId() + slug() + url() + branch() + rootDir() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt index 9cf60b18..31288f71 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt @@ -11,65 +11,89 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.checkRequired -import com.openlayer.api.core.immutableEmptyMap -import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -@NoAutoDetect class ProjectCreateResponse -@JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("creatorId") - @ExcludeMissing - private val creatorId: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("developmentGoalCount") - @ExcludeMissing - private val developmentGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("goalCount") - @ExcludeMissing - private val goalCount: JsonField = JsonMissing.of(), - @JsonProperty("inferencePipelineCount") - @ExcludeMissing - private val inferencePipelineCount: JsonField = JsonMissing.of(), - @JsonProperty("links") @ExcludeMissing private val links: JsonField = JsonMissing.of(), - @JsonProperty("monitoringGoalCount") - @ExcludeMissing - private val monitoringGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), - @JsonProperty("source") - @ExcludeMissing - private val source: JsonField = JsonMissing.of(), - @JsonProperty("taskType") - @ExcludeMissing - private val taskType: JsonField = JsonMissing.of(), - @JsonProperty("versionCount") - @ExcludeMissing - private val versionCount: JsonField = JsonMissing.of(), - @JsonProperty("workspaceId") - @ExcludeMissing - private val workspaceId: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("gitRepo") - @ExcludeMissing - private val gitRepo: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val developmentGoalCount: JsonField, + private val goalCount: JsonField, + private val inferencePipelineCount: JsonField, + private val links: JsonField, + private val monitoringGoalCount: JsonField, + private val name: JsonField, + private val source: JsonField, + private val taskType: JsonField, + private val versionCount: JsonField, + private val workspaceId: JsonField, + private val description: JsonField, + private val gitRepo: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") @ExcludeMissing creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("developmentGoalCount") + @ExcludeMissing + developmentGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("goalCount") @ExcludeMissing goalCount: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + inferencePipelineCount: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing links: JsonField = JsonMissing.of(), + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + monitoringGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("source") @ExcludeMissing source: JsonField = JsonMissing.of(), + @JsonProperty("taskType") @ExcludeMissing taskType: JsonField = JsonMissing.of(), + @JsonProperty("versionCount") + @ExcludeMissing + versionCount: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("gitRepo") @ExcludeMissing gitRepo: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + developmentGoalCount, + goalCount, + inferencePipelineCount, + links, + monitoringGoalCount, + name, + source, + taskType, + versionCount, + workspaceId, + description, + gitRepo, + mutableMapOf(), + ) + /** * The project id. * @@ -326,35 +350,15 @@ private constructor( */ @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): ProjectCreateResponse = apply { - if (validated) { - return@apply - } - - id() - creatorId() - dateCreated() - dateUpdated() - developmentGoalCount() - goalCount() - inferencePipelineCount() - links().validate() - monitoringGoalCount() - name() - source() - taskType() - versionCount() - workspaceId() - description() - gitRepo().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -701,20 +705,48 @@ private constructor( checkRequired("workspaceId", workspaceId), description, gitRepo, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): ProjectCreateResponse = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + developmentGoalCount() + goalCount() + inferencePipelineCount() + links().validate() + monitoringGoalCount() + name() + source() + taskType() + versionCount() + workspaceId() + description() + gitRepo().ifPresent { it.validate() } + validated = true + } + /** Links to the project. */ - @NoAutoDetect class Links - @JsonCreator private constructor( - @JsonProperty("app") @ExcludeMissing private val app: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val app: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing app: JsonField = JsonMissing.of() + ) : this(app, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -728,20 +760,15 @@ private constructor( */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Links = apply { - if (validated) { - return@apply - } - - app() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -813,7 +840,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): Links = - Links(checkRequired("app", app), additionalProperties.toImmutable()) + Links(checkRequired("app", app), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true } override fun equals(other: Any?): Boolean { @@ -1053,46 +1091,63 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class GitRepo - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("dateConnected") - @ExcludeMissing - private val dateConnected: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("gitAccountId") - @ExcludeMissing - private val gitAccountId: JsonField = JsonMissing.of(), - @JsonProperty("gitId") - @ExcludeMissing - private val gitId: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("private") - @ExcludeMissing - private val private_: JsonField = JsonMissing.of(), - @JsonProperty("projectId") - @ExcludeMissing - private val projectId: JsonField = JsonMissing.of(), - @JsonProperty("slug") - @ExcludeMissing - private val slug: JsonField = JsonMissing.of(), - @JsonProperty("url") @ExcludeMissing private val url: JsonField = JsonMissing.of(), - @JsonProperty("branch") - @ExcludeMissing - private val branch: JsonField = JsonMissing.of(), - @JsonProperty("rootDir") - @ExcludeMissing - private val rootDir: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val dateConnected: JsonField, + private val dateUpdated: JsonField, + private val gitAccountId: JsonField, + private val gitId: JsonField, + private val name: JsonField, + private val private_: JsonField, + private val projectId: JsonField, + private val slug: JsonField, + private val url: JsonField, + private val branch: JsonField, + private val rootDir: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateConnected") + @ExcludeMissing + dateConnected: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("gitAccountId") + @ExcludeMissing + gitAccountId: JsonField = JsonMissing.of(), + @JsonProperty("gitId") @ExcludeMissing gitId: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("private") + @ExcludeMissing + private_: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("url") @ExcludeMissing url: JsonField = JsonMissing.of(), + @JsonProperty("branch") @ExcludeMissing branch: JsonField = JsonMissing.of(), + @JsonProperty("rootDir") @ExcludeMissing rootDir: JsonField = JsonMissing.of(), + ) : this( + id, + dateConnected, + dateUpdated, + gitAccountId, + gitId, + name, + private_, + projectId, + slug, + url, + branch, + rootDir, + mutableMapOf(), + ) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -1257,31 +1312,15 @@ private constructor( */ @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): GitRepo = apply { - if (validated) { - return@apply - } - - id() - dateConnected() - dateUpdated() - gitAccountId() - gitId() - name() - private_() - projectId() - slug() - url() - branch() - rootDir() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1534,10 +1573,32 @@ private constructor( checkRequired("url", url), branch, rootDir, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): GitRepo = apply { + if (validated) { + return@apply + } + + id() + dateConnected() + dateUpdated() + gitAccountId() + gitId() + name() + private_() + projectId() + slug() + url() + branch() + rootDir() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt index cfef6024..2bd38514 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt @@ -5,7 +5,6 @@ package com.openlayer.api.models.projects import com.fasterxml.jackson.annotation.JsonCreator import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams @@ -41,19 +40,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - name?.let { put("name", it) } - page?.let { put("page", it.toString()) } - perPage?.let { put("perPage", it.toString()) } - taskType?.let { put("taskType", it.toString()) } - putAll(additionalQueryParams) - } - .build() - fun toBuilder() = Builder().from(this) companion object { @@ -65,7 +51,6 @@ private constructor( } /** A builder for [ProjectListParams]. */ - @NoAutoDetect class Builder internal constructor() { private var name: String? = null @@ -237,6 +222,19 @@ private constructor( ) } + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + name?.let { put("name", it) } + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + taskType?.let { put("taskType", it.toString()) } + putAll(additionalQueryParams) + } + .build() + /** Filter list of items by task type. */ class TaskType @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt index 42dba5b2..d38c17fb 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt @@ -11,27 +11,27 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired -import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -@NoAutoDetect class ProjectListResponse -@JsonCreator private constructor( - @JsonProperty("items") - @ExcludeMissing - private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val items: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -45,20 +45,15 @@ private constructor( */ @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): ProjectListResponse = apply { - if (validated) { - return@apply - } - - items().forEach { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -144,64 +139,102 @@ private constructor( fun build(): ProjectListResponse = ProjectListResponse( checkRequired("items", items).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): ProjectListResponse = apply { + if (validated) { + return@apply + } + + items().forEach { it.validate() } + validated = true + } + class Item - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("creatorId") - @ExcludeMissing - private val creatorId: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("developmentGoalCount") - @ExcludeMissing - private val developmentGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("goalCount") - @ExcludeMissing - private val goalCount: JsonField = JsonMissing.of(), - @JsonProperty("inferencePipelineCount") - @ExcludeMissing - private val inferencePipelineCount: JsonField = JsonMissing.of(), - @JsonProperty("links") - @ExcludeMissing - private val links: JsonField = JsonMissing.of(), - @JsonProperty("monitoringGoalCount") - @ExcludeMissing - private val monitoringGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("source") - @ExcludeMissing - private val source: JsonField = JsonMissing.of(), - @JsonProperty("taskType") - @ExcludeMissing - private val taskType: JsonField = JsonMissing.of(), - @JsonProperty("versionCount") - @ExcludeMissing - private val versionCount: JsonField = JsonMissing.of(), - @JsonProperty("workspaceId") - @ExcludeMissing - private val workspaceId: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("gitRepo") - @ExcludeMissing - private val gitRepo: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val developmentGoalCount: JsonField, + private val goalCount: JsonField, + private val inferencePipelineCount: JsonField, + private val links: JsonField, + private val monitoringGoalCount: JsonField, + private val name: JsonField, + private val source: JsonField, + private val taskType: JsonField, + private val versionCount: JsonField, + private val workspaceId: JsonField, + private val description: JsonField, + private val gitRepo: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("developmentGoalCount") + @ExcludeMissing + developmentGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("goalCount") + @ExcludeMissing + goalCount: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + inferencePipelineCount: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing links: JsonField = JsonMissing.of(), + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + monitoringGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("source") @ExcludeMissing source: JsonField = JsonMissing.of(), + @JsonProperty("taskType") + @ExcludeMissing + taskType: JsonField = JsonMissing.of(), + @JsonProperty("versionCount") + @ExcludeMissing + versionCount: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("gitRepo") @ExcludeMissing gitRepo: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + developmentGoalCount, + goalCount, + inferencePipelineCount, + links, + monitoringGoalCount, + name, + source, + taskType, + versionCount, + workspaceId, + description, + gitRepo, + mutableMapOf(), + ) + /** * The project id. * @@ -463,35 +496,15 @@ private constructor( */ @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Item = apply { - if (validated) { - return@apply - } - - id() - creatorId() - dateCreated() - dateUpdated() - developmentGoalCount() - goalCount() - inferencePipelineCount() - links().validate() - monitoringGoalCount() - name() - source() - taskType() - versionCount() - workspaceId() - description() - gitRepo().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -850,22 +863,48 @@ private constructor( checkRequired("workspaceId", workspaceId), description, gitRepo, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + developmentGoalCount() + goalCount() + inferencePipelineCount() + links().validate() + monitoringGoalCount() + name() + source() + taskType() + versionCount() + workspaceId() + description() + gitRepo().ifPresent { it.validate() } + validated = true + } + /** Links to the project. */ - @NoAutoDetect class Links - @JsonCreator private constructor( - @JsonProperty("app") - @ExcludeMissing - private val app: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val app: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing app: JsonField = JsonMissing.of() + ) : this(app, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -880,20 +919,15 @@ private constructor( */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Links = apply { - if (validated) { - return@apply - } - - app() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -968,7 +1002,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): Links = - Links(checkRequired("app", app), additionalProperties.toImmutable()) + Links(checkRequired("app", app), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true } override fun equals(other: Any?): Boolean { @@ -1213,50 +1258,67 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class GitRepo - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("dateConnected") - @ExcludeMissing - private val dateConnected: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("gitAccountId") - @ExcludeMissing - private val gitAccountId: JsonField = JsonMissing.of(), - @JsonProperty("gitId") - @ExcludeMissing - private val gitId: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("private") - @ExcludeMissing - private val private_: JsonField = JsonMissing.of(), - @JsonProperty("projectId") - @ExcludeMissing - private val projectId: JsonField = JsonMissing.of(), - @JsonProperty("slug") - @ExcludeMissing - private val slug: JsonField = JsonMissing.of(), - @JsonProperty("url") - @ExcludeMissing - private val url: JsonField = JsonMissing.of(), - @JsonProperty("branch") - @ExcludeMissing - private val branch: JsonField = JsonMissing.of(), - @JsonProperty("rootDir") - @ExcludeMissing - private val rootDir: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val dateConnected: JsonField, + private val dateUpdated: JsonField, + private val gitAccountId: JsonField, + private val gitId: JsonField, + private val name: JsonField, + private val private_: JsonField, + private val projectId: JsonField, + private val slug: JsonField, + private val url: JsonField, + private val branch: JsonField, + private val rootDir: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateConnected") + @ExcludeMissing + dateConnected: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("gitAccountId") + @ExcludeMissing + gitAccountId: JsonField = JsonMissing.of(), + @JsonProperty("gitId") @ExcludeMissing gitId: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("private") + @ExcludeMissing + private_: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("url") @ExcludeMissing url: JsonField = JsonMissing.of(), + @JsonProperty("branch") + @ExcludeMissing + branch: JsonField = JsonMissing.of(), + @JsonProperty("rootDir") + @ExcludeMissing + rootDir: JsonField = JsonMissing.of(), + ) : this( + id, + dateConnected, + dateUpdated, + gitAccountId, + gitId, + name, + private_, + projectId, + slug, + url, + branch, + rootDir, + mutableMapOf(), + ) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -1436,31 +1498,15 @@ private constructor( */ @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): GitRepo = apply { - if (validated) { - return@apply - } - - id() - dateConnected() - dateUpdated() - gitAccountId() - gitId() - name() - private_() - projectId() - slug() - url() - branch() - rootDir() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1717,10 +1763,32 @@ private constructor( checkRequired("url", url), branch, rootDir, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): GitRepo = apply { + if (validated) { + return@apply + } + + id() + dateConnected() + dateUpdated() + gitAccountId() + gitId() + name() + private_() + projectId() + slug() + url() + branch() + rootDir() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt index a0dfdffd..41f05b20 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt @@ -11,15 +11,13 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams -import com.openlayer.api.core.immutableEmptyMap -import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -300,1326 +298,1385 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): Body = body + fun toBuilder() = Builder().from(this) - fun _pathParam(index: Int): String = - when (index) { - 0 -> pathProjectId - else -> "" - } + companion object { - override fun _headers(): Headers = additionalHeaders + /** + * Returns a mutable builder for constructing an instance of [CommitCreateParams]. + * + * The following fields are required: + * ```java + * .pathProjectId() + * .id() + * .commit() + * .dateArchived() + * .dateCreated() + * .failingGoalCount() + * .mlModelId() + * .passingGoalCount() + * .bodyProjectId() + * .status() + * .statusMessage() + * .storageUri() + * .totalGoalCount() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - override fun _queryParams(): QueryParams = additionalQueryParams + /** A builder for [CommitCreateParams]. */ + class Builder internal constructor() { - @NoAutoDetect - class Body - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("commit") - @ExcludeMissing - private val commit: JsonField = JsonMissing.of(), - @JsonProperty("dateArchived") - @ExcludeMissing - private val dateArchived: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("failingGoalCount") - @ExcludeMissing - private val failingGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("mlModelId") - @ExcludeMissing - private val mlModelId: JsonField = JsonMissing.of(), - @JsonProperty("passingGoalCount") - @ExcludeMissing - private val passingGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("projectId") - @ExcludeMissing - private val bodyProjectId: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("statusMessage") - @ExcludeMissing - private val statusMessage: JsonField = JsonMissing.of(), - @JsonProperty("storageUri") - @ExcludeMissing - private val storageUri: JsonField = JsonMissing.of(), - @JsonProperty("totalGoalCount") - @ExcludeMissing - private val totalGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("trainingDatasetId") - @ExcludeMissing - private val trainingDatasetId: JsonField = JsonMissing.of(), - @JsonProperty("validationDatasetId") - @ExcludeMissing - private val validationDatasetId: JsonField = JsonMissing.of(), - @JsonProperty("archived") - @ExcludeMissing - private val archived: JsonField = JsonMissing.of(), - @JsonProperty("deploymentStatus") - @ExcludeMissing - private val deploymentStatus: JsonField = JsonMissing.of(), - @JsonProperty("links") - @ExcludeMissing - private val links: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var pathProjectId: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(commitCreateParams: CommitCreateParams) = apply { + pathProjectId = commitCreateParams.pathProjectId + body = commitCreateParams.body.toBuilder() + additionalHeaders = commitCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = commitCreateParams.additionalQueryParams.toBuilder() + } + + fun pathProjectId(pathProjectId: String) = apply { this.pathProjectId = pathProjectId } + + /** The project version (commit) id. */ + fun id(id: String) = apply { body.id(id) } /** - * The project version (commit) id. + * Sets [Builder.id] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun id(): String = id.getRequired("id") + fun id(id: JsonField) = apply { body.id(id) } + + /** The details of a commit (project version). */ + fun commit(commit: Commit) = apply { body.commit(commit) } /** - * The details of a commit (project version). + * Sets [Builder.commit] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.commit] with a well-typed [Commit] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun commit(): Commit = commit.getRequired("commit") + fun commit(commit: JsonField) = apply { body.commit(commit) } + + /** The commit archive date. */ + fun dateArchived(dateArchived: OffsetDateTime?) = apply { body.dateArchived(dateArchived) } + + /** Alias for calling [Builder.dateArchived] with `dateArchived.orElse(null)`. */ + fun dateArchived(dateArchived: Optional) = + dateArchived(dateArchived.getOrNull()) /** - * The commit archive date. + * Sets [Builder.dateArchived] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). + * You should usually call [Builder.dateArchived] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun dateArchived(): Optional = - Optional.ofNullable(dateArchived.getNullable("dateArchived")) + fun dateArchived(dateArchived: JsonField) = apply { + body.dateArchived(dateArchived) + } + + /** The project version (commit) creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = apply { body.dateCreated(dateCreated) } /** - * The project version (commit) creation date. + * Sets [Builder.dateCreated] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + fun dateCreated(dateCreated: JsonField) = apply { + body.dateCreated(dateCreated) + } + + /** The number of tests that are failing for the commit. */ + fun failingGoalCount(failingGoalCount: Long) = apply { + body.failingGoalCount(failingGoalCount) + } /** - * The number of tests that are failing for the commit. + * Sets [Builder.failingGoalCount] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") + fun failingGoalCount(failingGoalCount: JsonField) = apply { + body.failingGoalCount(failingGoalCount) + } + + /** The model id. */ + fun mlModelId(mlModelId: String?) = apply { body.mlModelId(mlModelId) } + + /** Alias for calling [Builder.mlModelId] with `mlModelId.orElse(null)`. */ + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) /** - * The model id. + * Sets [Builder.mlModelId] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). + * You should usually call [Builder.mlModelId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + fun mlModelId(mlModelId: JsonField) = apply { body.mlModelId(mlModelId) } + + /** The number of tests that are passing for the commit. */ + fun passingGoalCount(passingGoalCount: Long) = apply { + body.passingGoalCount(passingGoalCount) + } /** - * The number of tests that are passing for the commit. + * Sets [Builder.passingGoalCount] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") + fun passingGoalCount(passingGoalCount: JsonField) = apply { + body.passingGoalCount(passingGoalCount) + } + + /** The project id. */ + fun bodyProjectId(bodyProjectId: String) = apply { body.bodyProjectId(bodyProjectId) } /** - * The project id. + * Sets [Builder.bodyProjectId] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.bodyProjectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun bodyProjectId(): String = bodyProjectId.getRequired("projectId") + fun bodyProjectId(bodyProjectId: JsonField) = apply { + body.bodyProjectId(bodyProjectId) + } /** * The commit status. Initially, the commit is `queued`, then, it switches to `running`. * Finally, it can be `paused`, `failed`, or `completed`. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun status(): Status = status.getRequired("status") + fun status(status: Status) = apply { body.status(status) } /** - * The commit status message. + * Sets [Builder.status] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun status(status: JsonField) = apply { body.status(status) } + + /** The commit status message. */ + fun statusMessage(statusMessage: String?) = apply { body.statusMessage(statusMessage) } + + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.getOrNull()) /** - * The storage URI where the commit bundle is stored. + * Sets [Builder.statusMessage] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.statusMessage] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun storageUri(): String = storageUri.getRequired("storageUri") + fun statusMessage(statusMessage: JsonField) = apply { + body.statusMessage(statusMessage) + } + + /** The storage URI where the commit bundle is stored. */ + fun storageUri(storageUri: String) = apply { body.storageUri(storageUri) } /** - * The total number of tests for the commit. + * Sets [Builder.storageUri] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.storageUri] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") + fun storageUri(storageUri: JsonField) = apply { body.storageUri(storageUri) } + + /** The total number of tests for the commit. */ + fun totalGoalCount(totalGoalCount: Long) = apply { body.totalGoalCount(totalGoalCount) } /** - * The training dataset id. + * Sets [Builder.totalGoalCount] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). + * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun trainingDatasetId(): Optional = - Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + fun totalGoalCount(totalGoalCount: JsonField) = apply { + body.totalGoalCount(totalGoalCount) + } - /** - * The validation dataset id. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun validationDatasetId(): Optional = - Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: String?) = apply { + body.trainingDatasetId(trainingDatasetId) + } - /** - * Whether the commit is archived. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) + /** Alias for calling [Builder.trainingDatasetId] with `trainingDatasetId.orElse(null)`. */ + fun trainingDatasetId(trainingDatasetId: Optional) = + trainingDatasetId(trainingDatasetId.getOrNull()) /** - * The deployment status associated with the commit's model. + * Sets [Builder.trainingDatasetId] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). + * You should usually call [Builder.trainingDatasetId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun deploymentStatus(): Optional = - Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + fun trainingDatasetId(trainingDatasetId: JsonField) = apply { + body.trainingDatasetId(trainingDatasetId) + } - /** - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun links(): Optional = Optional.ofNullable(links.getNullable("links")) + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: String?) = apply { + body.validationDatasetId(validationDatasetId) + } /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + * Alias for calling [Builder.validationDatasetId] with `validationDatasetId.orElse(null)`. */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + fun validationDatasetId(validationDatasetId: Optional) = + validationDatasetId(validationDatasetId.getOrNull()) /** - * Returns the raw JSON value of [commit]. + * Sets [Builder.validationDatasetId] to an arbitrary JSON value. * - * Unlike [commit], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.validationDatasetId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - @JsonProperty("commit") @ExcludeMissing fun _commit(): JsonField = commit + fun validationDatasetId(validationDatasetId: JsonField) = apply { + body.validationDatasetId(validationDatasetId) + } - /** - * Returns the raw JSON value of [dateArchived]. - * - * Unlike [dateArchived], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("dateArchived") - @ExcludeMissing - fun _dateArchived(): JsonField = dateArchived + /** Whether the commit is archived. */ + fun archived(archived: Boolean?) = apply { body.archived(archived) } /** - * Returns the raw JSON value of [dateCreated]. + * Alias for [Builder.archived]. * - * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + * This unboxed primitive overload exists for backwards compatibility. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated(): JsonField = dateCreated + fun archived(archived: Boolean) = archived(archived as Boolean?) - /** - * Returns the raw JSON value of [failingGoalCount]. - * - * Unlike [failingGoalCount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("failingGoalCount") - @ExcludeMissing - fun _failingGoalCount(): JsonField = failingGoalCount + /** Alias for calling [Builder.archived] with `archived.orElse(null)`. */ + fun archived(archived: Optional) = archived(archived.getOrNull()) /** - * Returns the raw JSON value of [mlModelId]. + * Sets [Builder.archived] to an arbitrary JSON value. * - * Unlike [mlModelId], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.archived] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId(): JsonField = mlModelId + fun archived(archived: JsonField) = apply { body.archived(archived) } - /** - * Returns the raw JSON value of [passingGoalCount]. - * - * Unlike [passingGoalCount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("passingGoalCount") - @ExcludeMissing - fun _passingGoalCount(): JsonField = passingGoalCount + /** The deployment status associated with the commit's model. */ + fun deploymentStatus(deploymentStatus: String) = apply { + body.deploymentStatus(deploymentStatus) + } /** - * Returns the raw JSON value of [bodyProjectId]. + * Sets [Builder.deploymentStatus] to an arbitrary JSON value. * - * Unlike [bodyProjectId], this method doesn't throw if the JSON field has an unexpected - * type. + * You should usually call [Builder.deploymentStatus] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - @JsonProperty("projectId") - @ExcludeMissing - fun _bodyProjectId(): JsonField = bodyProjectId + fun deploymentStatus(deploymentStatus: JsonField) = apply { + body.deploymentStatus(deploymentStatus) + } - /** - * Returns the raw JSON value of [status]. - * - * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + fun links(links: Links) = apply { body.links(links) } /** - * Returns the raw JSON value of [statusMessage]. + * Sets [Builder.links] to an arbitrary JSON value. * - * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected - * type. + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - @JsonProperty("statusMessage") - @ExcludeMissing - fun _statusMessage(): JsonField = statusMessage + fun links(links: JsonField) = apply { body.links(links) } - /** - * Returns the raw JSON value of [storageUri]. - * - * Unlike [storageUri], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("storageUri") - @ExcludeMissing - fun _storageUri(): JsonField = storageUri + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } - /** - * Returns the raw JSON value of [totalGoalCount]. - * - * Unlike [totalGoalCount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("totalGoalCount") - @ExcludeMissing - fun _totalGoalCount(): JsonField = totalGoalCount + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } - /** - * Returns the raw JSON value of [trainingDatasetId]. - * - * Unlike [trainingDatasetId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("trainingDatasetId") - @ExcludeMissing - fun _trainingDatasetId(): JsonField = trainingDatasetId + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } - /** - * Returns the raw JSON value of [validationDatasetId]. - * - * Unlike [validationDatasetId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("validationDatasetId") - @ExcludeMissing - fun _validationDatasetId(): JsonField = validationDatasetId + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - /** - * Returns the raw JSON value of [archived]. - * - * Unlike [archived], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } - /** - * Returns the raw JSON value of [deploymentStatus]. - * - * Unlike [deploymentStatus], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("deploymentStatus") - @ExcludeMissing - fun _deploymentStatus(): JsonField = deploymentStatus + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - /** - * Returns the raw JSON value of [links]. - * - * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } - private var validated: Boolean = false + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } - fun validate(): Body = apply { - if (validated) { - return@apply - } + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } - id() - commit().validate() - dateArchived() - dateCreated() - failingGoalCount() - mlModelId() - passingGoalCount() - bodyProjectId() - status() - statusMessage() - storageUri() - totalGoalCount() - trainingDatasetId() - validationDatasetId() - archived() - deploymentStatus() - links().ifPresent { it.validate() } - validated = true + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) } - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Body]. - * - * The following fields are required: - * ```java - * .id() - * .commit() - * .dateArchived() - * .dateCreated() - * .failingGoalCount() - * .mlModelId() - * .passingGoalCount() - * .bodyProjectId() - * .status() - * .statusMessage() - * .storageUri() - * .totalGoalCount() - * .trainingDatasetId() - * .validationDatasetId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var commit: JsonField? = null - private var dateArchived: JsonField? = null - private var dateCreated: JsonField? = null - private var failingGoalCount: JsonField? = null - private var mlModelId: JsonField? = null - private var passingGoalCount: JsonField? = null - private var bodyProjectId: JsonField? = null - private var status: JsonField? = null - private var statusMessage: JsonField? = null - private var storageUri: JsonField? = null - private var totalGoalCount: JsonField? = null - private var trainingDatasetId: JsonField? = null - private var validationDatasetId: JsonField? = null - private var archived: JsonField = JsonMissing.of() - private var deploymentStatus: JsonField = JsonMissing.of() - private var links: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - id = body.id - commit = body.commit - dateArchived = body.dateArchived - dateCreated = body.dateCreated - failingGoalCount = body.failingGoalCount - mlModelId = body.mlModelId - passingGoalCount = body.passingGoalCount - bodyProjectId = body.bodyProjectId - status = body.status - statusMessage = body.statusMessage - storageUri = body.storageUri - totalGoalCount = body.totalGoalCount - trainingDatasetId = body.trainingDatasetId - validationDatasetId = body.validationDatasetId - archived = body.archived - deploymentStatus = body.deploymentStatus - links = body.links - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** The project version (commit) id. */ - fun id(id: String) = id(JsonField.of(id)) - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun id(id: JsonField) = apply { this.id = id } - - /** The details of a commit (project version). */ - fun commit(commit: Commit) = commit(JsonField.of(commit)) - - /** - * Sets [Builder.commit] to an arbitrary JSON value. - * - * You should usually call [Builder.commit] with a well-typed [Commit] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun commit(commit: JsonField) = apply { this.commit = commit } - - /** The commit archive date. */ - fun dateArchived(dateArchived: OffsetDateTime?) = - dateArchived(JsonField.ofNullable(dateArchived)) - - /** Alias for calling [Builder.dateArchived] with `dateArchived.orElse(null)`. */ - fun dateArchived(dateArchived: Optional) = - dateArchived(dateArchived.getOrNull()) - - /** - * Sets [Builder.dateArchived] to an arbitrary JSON value. - * - * You should usually call [Builder.dateArchived] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun dateArchived(dateArchived: JsonField) = apply { - this.dateArchived = dateArchived - } - - /** The project version (commit) creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - - /** - * Sets [Builder.dateCreated] to an arbitrary JSON value. - * - * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun dateCreated(dateCreated: JsonField) = apply { - this.dateCreated = dateCreated - } - - /** The number of tests that are failing for the commit. */ - fun failingGoalCount(failingGoalCount: Long) = - failingGoalCount(JsonField.of(failingGoalCount)) - - /** - * Sets [Builder.failingGoalCount] to an arbitrary JSON value. - * - * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun failingGoalCount(failingGoalCount: JsonField) = apply { - this.failingGoalCount = failingGoalCount - } - - /** The model id. */ - fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) - - /** Alias for calling [Builder.mlModelId] with `mlModelId.orElse(null)`. */ - fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) - - /** - * Sets [Builder.mlModelId] to an arbitrary JSON value. - * - * You should usually call [Builder.mlModelId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } - - /** The number of tests that are passing for the commit. */ - fun passingGoalCount(passingGoalCount: Long) = - passingGoalCount(JsonField.of(passingGoalCount)) - - /** - * Sets [Builder.passingGoalCount] to an arbitrary JSON value. - * - * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun passingGoalCount(passingGoalCount: JsonField) = apply { - this.passingGoalCount = passingGoalCount - } - - /** The project id. */ - fun bodyProjectId(bodyProjectId: String) = bodyProjectId(JsonField.of(bodyProjectId)) - - /** - * Sets [Builder.bodyProjectId] to an arbitrary JSON value. - * - * You should usually call [Builder.bodyProjectId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun bodyProjectId(bodyProjectId: JsonField) = apply { - this.bodyProjectId = bodyProjectId - } - - /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. - */ - fun status(status: Status) = status(JsonField.of(status)) - - /** - * Sets [Builder.status] to an arbitrary JSON value. - * - * You should usually call [Builder.status] with a well-typed [Status] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun status(status: JsonField) = apply { this.status = status } - - /** The commit status message. */ - fun statusMessage(statusMessage: String?) = - statusMessage(JsonField.ofNullable(statusMessage)) - - /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ - fun statusMessage(statusMessage: Optional) = - statusMessage(statusMessage.getOrNull()) - - /** - * Sets [Builder.statusMessage] to an arbitrary JSON value. - * - * You should usually call [Builder.statusMessage] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun statusMessage(statusMessage: JsonField) = apply { - this.statusMessage = statusMessage - } - - /** The storage URI where the commit bundle is stored. */ - fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) - - /** - * Sets [Builder.storageUri] to an arbitrary JSON value. - * - * You should usually call [Builder.storageUri] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } - - /** The total number of tests for the commit. */ - fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - - /** - * Sets [Builder.totalGoalCount] to an arbitrary JSON value. - * - * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun totalGoalCount(totalGoalCount: JsonField) = apply { - this.totalGoalCount = totalGoalCount - } - - /** The training dataset id. */ - fun trainingDatasetId(trainingDatasetId: String?) = - trainingDatasetId(JsonField.ofNullable(trainingDatasetId)) - - /** - * Alias for calling [Builder.trainingDatasetId] with `trainingDatasetId.orElse(null)`. - */ - fun trainingDatasetId(trainingDatasetId: Optional) = - trainingDatasetId(trainingDatasetId.getOrNull()) - - /** - * Sets [Builder.trainingDatasetId] to an arbitrary JSON value. - * - * You should usually call [Builder.trainingDatasetId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun trainingDatasetId(trainingDatasetId: JsonField) = apply { - this.trainingDatasetId = trainingDatasetId - } - - /** The validation dataset id. */ - fun validationDatasetId(validationDatasetId: String?) = - validationDatasetId(JsonField.ofNullable(validationDatasetId)) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } - /** - * Alias for calling [Builder.validationDatasetId] with - * `validationDatasetId.orElse(null)`. - */ - fun validationDatasetId(validationDatasetId: Optional) = - validationDatasetId(validationDatasetId.getOrNull()) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } - /** - * Sets [Builder.validationDatasetId] to an arbitrary JSON value. - * - * You should usually call [Builder.validationDatasetId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun validationDatasetId(validationDatasetId: JsonField) = apply { - this.validationDatasetId = validationDatasetId - } + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } - /** Whether the commit is archived. */ - fun archived(archived: Boolean?) = archived(JsonField.ofNullable(archived)) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } - /** - * Alias for [Builder.archived]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun archived(archived: Boolean) = archived(archived as Boolean?) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - /** Alias for calling [Builder.archived] with `archived.orElse(null)`. */ - fun archived(archived: Optional) = archived(archived.getOrNull()) + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } - /** - * Sets [Builder.archived] to an arbitrary JSON value. - * - * You should usually call [Builder.archived] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun archived(archived: JsonField) = apply { this.archived = archived } + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } - /** The deployment status associated with the commit's model. */ - fun deploymentStatus(deploymentStatus: String) = - deploymentStatus(JsonField.of(deploymentStatus)) + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } - /** - * Sets [Builder.deploymentStatus] to an arbitrary JSON value. - * - * You should usually call [Builder.deploymentStatus] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun deploymentStatus(deploymentStatus: JsonField) = apply { - this.deploymentStatus = deploymentStatus - } + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } - fun links(links: Links) = links(JsonField.of(links)) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } - /** - * Sets [Builder.links] to an arbitrary JSON value. - * - * You should usually call [Builder.links] with a well-typed [Links] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun links(links: JsonField) = apply { this.links = links } + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) } - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .commit() - * .dateArchived() - * .dateCreated() - * .failingGoalCount() - * .mlModelId() - * .passingGoalCount() - * .bodyProjectId() - * .status() - * .statusMessage() - * .storageUri() - * .totalGoalCount() - * .trainingDatasetId() - * .validationDatasetId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body( - checkRequired("id", id), - checkRequired("commit", commit), - checkRequired("dateArchived", dateArchived), - checkRequired("dateCreated", dateCreated), - checkRequired("failingGoalCount", failingGoalCount), - checkRequired("mlModelId", mlModelId), - checkRequired("passingGoalCount", passingGoalCount), - checkRequired("bodyProjectId", bodyProjectId), - checkRequired("status", status), - checkRequired("statusMessage", statusMessage), - checkRequired("storageUri", storageUri), - checkRequired("totalGoalCount", totalGoalCount), - checkRequired("trainingDatasetId", trainingDatasetId), - checkRequired("validationDatasetId", validationDatasetId), - archived, - deploymentStatus, - links, - additionalProperties.toImmutable(), - ) + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns an immutable instance of [CommitCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .pathProjectId() + * .id() + * .commit() + * .dateArchived() + * .dateCreated() + * .failingGoalCount() + * .mlModelId() + * .passingGoalCount() + * .bodyProjectId() + * .status() + * .statusMessage() + * .storageUri() + * .totalGoalCount() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CommitCreateParams = + CommitCreateParams( + checkRequired("pathProjectId", pathProjectId), + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } - return /* spotless:off */ other is Body && id == other.id && commit == other.commit && dateArchived == other.dateArchived && dateCreated == other.dateCreated && failingGoalCount == other.failingGoalCount && mlModelId == other.mlModelId && passingGoalCount == other.passingGoalCount && bodyProjectId == other.bodyProjectId && status == other.status && statusMessage == other.statusMessage && storageUri == other.storageUri && totalGoalCount == other.totalGoalCount && trainingDatasetId == other.trainingDatasetId && validationDatasetId == other.validationDatasetId && archived == other.archived && deploymentStatus == other.deploymentStatus && links == other.links && additionalProperties == other.additionalProperties /* spotless:on */ + @JvmSynthetic internal fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> pathProjectId + else -> "" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, commit, dateArchived, dateCreated, failingGoalCount, mlModelId, passingGoalCount, bodyProjectId, status, statusMessage, storageUri, totalGoalCount, trainingDatasetId, validationDatasetId, archived, deploymentStatus, links, additionalProperties) } - /* spotless:on */ + override fun _headers(): Headers = additionalHeaders - override fun hashCode(): Int = hashCode + override fun _queryParams(): QueryParams = additionalQueryParams - override fun toString() = - "Body{id=$id, commit=$commit, dateArchived=$dateArchived, dateCreated=$dateCreated, failingGoalCount=$failingGoalCount, mlModelId=$mlModelId, passingGoalCount=$passingGoalCount, bodyProjectId=$bodyProjectId, status=$status, statusMessage=$statusMessage, storageUri=$storageUri, totalGoalCount=$totalGoalCount, trainingDatasetId=$trainingDatasetId, validationDatasetId=$validationDatasetId, archived=$archived, deploymentStatus=$deploymentStatus, links=$links, additionalProperties=$additionalProperties}" - } + class Body + private constructor( + private val id: JsonField, + private val commit: JsonField, + private val dateArchived: JsonField, + private val dateCreated: JsonField, + private val failingGoalCount: JsonField, + private val mlModelId: JsonField, + private val passingGoalCount: JsonField, + private val bodyProjectId: JsonField, + private val status: JsonField, + private val statusMessage: JsonField, + private val storageUri: JsonField, + private val totalGoalCount: JsonField, + private val trainingDatasetId: JsonField, + private val validationDatasetId: JsonField, + private val archived: JsonField, + private val deploymentStatus: JsonField, + private val links: JsonField, + private val additionalProperties: MutableMap, + ) { - fun toBuilder() = Builder().from(this) + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("commit") @ExcludeMissing commit: JsonField = JsonMissing.of(), + @JsonProperty("dateArchived") + @ExcludeMissing + dateArchived: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("failingGoalCount") + @ExcludeMissing + failingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("mlModelId") + @ExcludeMissing + mlModelId: JsonField = JsonMissing.of(), + @JsonProperty("passingGoalCount") + @ExcludeMissing + passingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + bodyProjectId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + storageUri: JsonField = JsonMissing.of(), + @JsonProperty("totalGoalCount") + @ExcludeMissing + totalGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("trainingDatasetId") + @ExcludeMissing + trainingDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("validationDatasetId") + @ExcludeMissing + validationDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("archived") + @ExcludeMissing + archived: JsonField = JsonMissing.of(), + @JsonProperty("deploymentStatus") + @ExcludeMissing + deploymentStatus: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing links: JsonField = JsonMissing.of(), + ) : this( + id, + commit, + dateArchived, + dateCreated, + failingGoalCount, + mlModelId, + passingGoalCount, + bodyProjectId, + status, + statusMessage, + storageUri, + totalGoalCount, + trainingDatasetId, + validationDatasetId, + archived, + deploymentStatus, + links, + mutableMapOf(), + ) + + /** + * The project version (commit) id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The details of a commit (project version). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun commit(): Commit = commit.getRequired("commit") + + /** + * The commit archive date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateArchived(): Optional = + Optional.ofNullable(dateArchived.getNullable("dateArchived")) + + /** + * The project version (commit) creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The number of tests that are failing for the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") - companion object { + /** + * The model id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) /** - * Returns a mutable builder for constructing an instance of [CommitCreateParams]. + * The number of tests that are passing for the commit. * - * The following fields are required: - * ```java - * .pathProjectId() - * .id() - * .commit() - * .dateArchived() - * .dateCreated() - * .failingGoalCount() - * .mlModelId() - * .passingGoalCount() - * .bodyProjectId() - * .status() - * .statusMessage() - * .storageUri() - * .totalGoalCount() - * .trainingDatasetId() - * .validationDatasetId() - * ``` + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - @JvmStatic fun builder() = Builder() - } + fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") - /** A builder for [CommitCreateParams]. */ - @NoAutoDetect - class Builder internal constructor() { + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun bodyProjectId(): String = bodyProjectId.getRequired("projectId") - private var pathProjectId: String? = null - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + /** + * The commit status. Initially, the commit is `queued`, then, it switches to `running`. + * Finally, it can be `paused`, `failed`, or `completed`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun status(): Status = status.getRequired("status") - @JvmSynthetic - internal fun from(commitCreateParams: CommitCreateParams) = apply { - pathProjectId = commitCreateParams.pathProjectId - body = commitCreateParams.body.toBuilder() - additionalHeaders = commitCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = commitCreateParams.additionalQueryParams.toBuilder() - } + /** + * The commit status message. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) - fun pathProjectId(pathProjectId: String) = apply { this.pathProjectId = pathProjectId } + /** + * The storage URI where the commit bundle is stored. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun storageUri(): String = storageUri.getRequired("storageUri") - /** The project version (commit) id. */ - fun id(id: String) = apply { body.id(id) } + /** + * The total number of tests for the commit. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") /** - * Sets [Builder.id] to an arbitrary JSON value. + * The training dataset id. * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ - fun id(id: JsonField) = apply { body.id(id) } + fun trainingDatasetId(): Optional = + Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) - /** The details of a commit (project version). */ - fun commit(commit: Commit) = apply { body.commit(commit) } + /** + * The validation dataset id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun validationDatasetId(): Optional = + Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) /** - * Sets [Builder.commit] to an arbitrary JSON value. + * Whether the commit is archived. * - * You should usually call [Builder.commit] with a well-typed [Commit] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ - fun commit(commit: JsonField) = apply { body.commit(commit) } + fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) - /** The commit archive date. */ - fun dateArchived(dateArchived: OffsetDateTime?) = apply { body.dateArchived(dateArchived) } + /** + * The deployment status associated with the commit's model. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun deploymentStatus(): Optional = + Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) - /** Alias for calling [Builder.dateArchived] with `dateArchived.orElse(null)`. */ - fun dateArchived(dateArchived: Optional) = - dateArchived(dateArchived.getOrNull()) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun links(): Optional = Optional.ofNullable(links.getNullable("links")) /** - * Sets [Builder.dateArchived] to an arbitrary JSON value. + * Returns the raw JSON value of [id]. * - * You should usually call [Builder.dateArchived] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. */ - fun dateArchived(dateArchived: JsonField) = apply { - body.dateArchived(dateArchived) - } + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The project version (commit) creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = apply { body.dateCreated(dateCreated) } + /** + * Returns the raw JSON value of [commit]. + * + * Unlike [commit], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("commit") @ExcludeMissing fun _commit(): JsonField = commit /** - * Sets [Builder.dateCreated] to an arbitrary JSON value. + * Returns the raw JSON value of [dateArchived]. * - * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Unlike [dateArchived], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun dateCreated(dateCreated: JsonField) = apply { - body.dateCreated(dateCreated) - } + @JsonProperty("dateArchived") + @ExcludeMissing + fun _dateArchived(): JsonField = dateArchived - /** The number of tests that are failing for the commit. */ - fun failingGoalCount(failingGoalCount: Long) = apply { - body.failingGoalCount(failingGoalCount) - } + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated /** - * Sets [Builder.failingGoalCount] to an arbitrary JSON value. + * Returns the raw JSON value of [failingGoalCount]. * - * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Unlike [failingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun failingGoalCount(failingGoalCount: JsonField) = apply { - body.failingGoalCount(failingGoalCount) - } + @JsonProperty("failingGoalCount") + @ExcludeMissing + fun _failingGoalCount(): JsonField = failingGoalCount - /** The model id. */ - fun mlModelId(mlModelId: String?) = apply { body.mlModelId(mlModelId) } + /** + * Returns the raw JSON value of [mlModelId]. + * + * Unlike [mlModelId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId(): JsonField = mlModelId - /** Alias for calling [Builder.mlModelId] with `mlModelId.orElse(null)`. */ - fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) + /** + * Returns the raw JSON value of [passingGoalCount]. + * + * Unlike [passingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("passingGoalCount") + @ExcludeMissing + fun _passingGoalCount(): JsonField = passingGoalCount /** - * Sets [Builder.mlModelId] to an arbitrary JSON value. + * Returns the raw JSON value of [bodyProjectId]. * - * You should usually call [Builder.mlModelId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * Unlike [bodyProjectId], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun mlModelId(mlModelId: JsonField) = apply { body.mlModelId(mlModelId) } + @JsonProperty("projectId") + @ExcludeMissing + fun _bodyProjectId(): JsonField = bodyProjectId - /** The number of tests that are passing for the commit. */ - fun passingGoalCount(passingGoalCount: Long) = apply { - body.passingGoalCount(passingGoalCount) - } + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status /** - * Sets [Builder.passingGoalCount] to an arbitrary JSON value. + * Returns the raw JSON value of [statusMessage]. * - * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun passingGoalCount(passingGoalCount: JsonField) = apply { - body.passingGoalCount(passingGoalCount) - } + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage - /** The project id. */ - fun bodyProjectId(bodyProjectId: String) = apply { body.bodyProjectId(bodyProjectId) } + /** + * Returns the raw JSON value of [storageUri]. + * + * Unlike [storageUri], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("storageUri") + @ExcludeMissing + fun _storageUri(): JsonField = storageUri /** - * Sets [Builder.bodyProjectId] to an arbitrary JSON value. + * Returns the raw JSON value of [totalGoalCount]. * - * You should usually call [Builder.bodyProjectId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * Unlike [totalGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun bodyProjectId(bodyProjectId: JsonField) = apply { - body.bodyProjectId(bodyProjectId) - } + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun _totalGoalCount(): JsonField = totalGoalCount /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. + * Returns the raw JSON value of [trainingDatasetId]. + * + * Unlike [trainingDatasetId], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun status(status: Status) = apply { body.status(status) } + @JsonProperty("trainingDatasetId") + @ExcludeMissing + fun _trainingDatasetId(): JsonField = trainingDatasetId /** - * Sets [Builder.status] to an arbitrary JSON value. + * Returns the raw JSON value of [validationDatasetId]. * - * You should usually call [Builder.status] with a well-typed [Status] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * Unlike [validationDatasetId], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun status(status: JsonField) = apply { body.status(status) } - - /** The commit status message. */ - fun statusMessage(statusMessage: String?) = apply { body.statusMessage(statusMessage) } - - /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ - fun statusMessage(statusMessage: Optional) = - statusMessage(statusMessage.getOrNull()) + @JsonProperty("validationDatasetId") + @ExcludeMissing + fun _validationDatasetId(): JsonField = validationDatasetId /** - * Sets [Builder.statusMessage] to an arbitrary JSON value. + * Returns the raw JSON value of [archived]. * - * You should usually call [Builder.statusMessage] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * Unlike [archived], this method doesn't throw if the JSON field has an unexpected type. */ - fun statusMessage(statusMessage: JsonField) = apply { - body.statusMessage(statusMessage) - } - - /** The storage URI where the commit bundle is stored. */ - fun storageUri(storageUri: String) = apply { body.storageUri(storageUri) } + @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived /** - * Sets [Builder.storageUri] to an arbitrary JSON value. + * Returns the raw JSON value of [deploymentStatus]. * - * You should usually call [Builder.storageUri] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * Unlike [deploymentStatus], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun storageUri(storageUri: JsonField) = apply { body.storageUri(storageUri) } - - /** The total number of tests for the commit. */ - fun totalGoalCount(totalGoalCount: Long) = apply { body.totalGoalCount(totalGoalCount) } + @JsonProperty("deploymentStatus") + @ExcludeMissing + fun _deploymentStatus(): JsonField = deploymentStatus /** - * Sets [Builder.totalGoalCount] to an arbitrary JSON value. + * Returns the raw JSON value of [links]. * - * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. */ - fun totalGoalCount(totalGoalCount: JsonField) = apply { - body.totalGoalCount(totalGoalCount) - } + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links - /** The training dataset id. */ - fun trainingDatasetId(trainingDatasetId: String?) = apply { - body.trainingDatasetId(trainingDatasetId) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - /** Alias for calling [Builder.trainingDatasetId] with `trainingDatasetId.orElse(null)`. */ - fun trainingDatasetId(trainingDatasetId: Optional) = - trainingDatasetId(trainingDatasetId.getOrNull()) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * Sets [Builder.trainingDatasetId] to an arbitrary JSON value. - * - * You should usually call [Builder.trainingDatasetId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun trainingDatasetId(trainingDatasetId: JsonField) = apply { - body.trainingDatasetId(trainingDatasetId) - } + fun toBuilder() = Builder().from(this) - /** The validation dataset id. */ - fun validationDatasetId(validationDatasetId: String?) = apply { - body.validationDatasetId(validationDatasetId) + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .id() + * .commit() + * .dateArchived() + * .dateCreated() + * .failingGoalCount() + * .mlModelId() + * .passingGoalCount() + * .bodyProjectId() + * .status() + * .statusMessage() + * .storageUri() + * .totalGoalCount() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + */ + @JvmStatic fun builder() = Builder() } - /** - * Alias for calling [Builder.validationDatasetId] with `validationDatasetId.orElse(null)`. - */ - fun validationDatasetId(validationDatasetId: Optional) = - validationDatasetId(validationDatasetId.getOrNull()) + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var commit: JsonField? = null + private var dateArchived: JsonField? = null + private var dateCreated: JsonField? = null + private var failingGoalCount: JsonField? = null + private var mlModelId: JsonField? = null + private var passingGoalCount: JsonField? = null + private var bodyProjectId: JsonField? = null + private var status: JsonField? = null + private var statusMessage: JsonField? = null + private var storageUri: JsonField? = null + private var totalGoalCount: JsonField? = null + private var trainingDatasetId: JsonField? = null + private var validationDatasetId: JsonField? = null + private var archived: JsonField = JsonMissing.of() + private var deploymentStatus: JsonField = JsonMissing.of() + private var links: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + id = body.id + commit = body.commit + dateArchived = body.dateArchived + dateCreated = body.dateCreated + failingGoalCount = body.failingGoalCount + mlModelId = body.mlModelId + passingGoalCount = body.passingGoalCount + bodyProjectId = body.bodyProjectId + status = body.status + statusMessage = body.statusMessage + storageUri = body.storageUri + totalGoalCount = body.totalGoalCount + trainingDatasetId = body.trainingDatasetId + validationDatasetId = body.validationDatasetId + archived = body.archived + deploymentStatus = body.deploymentStatus + links = body.links + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The project version (commit) id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The details of a commit (project version). */ + fun commit(commit: Commit) = commit(JsonField.of(commit)) + + /** + * Sets [Builder.commit] to an arbitrary JSON value. + * + * You should usually call [Builder.commit] with a well-typed [Commit] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun commit(commit: JsonField) = apply { this.commit = commit } + + /** The commit archive date. */ + fun dateArchived(dateArchived: OffsetDateTime?) = + dateArchived(JsonField.ofNullable(dateArchived)) + + /** Alias for calling [Builder.dateArchived] with `dateArchived.orElse(null)`. */ + fun dateArchived(dateArchived: Optional) = + dateArchived(dateArchived.getOrNull()) + + /** + * Sets [Builder.dateArchived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateArchived] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateArchived(dateArchived: JsonField) = apply { + this.dateArchived = dateArchived + } + + /** The project version (commit) creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The number of tests that are failing for the commit. */ + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) + + /** + * Sets [Builder.failingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun failingGoalCount(failingGoalCount: JsonField) = apply { + this.failingGoalCount = failingGoalCount + } + + /** The model id. */ + fun mlModelId(mlModelId: String?) = mlModelId(JsonField.ofNullable(mlModelId)) + + /** Alias for calling [Builder.mlModelId] with `mlModelId.orElse(null)`. */ + fun mlModelId(mlModelId: Optional) = mlModelId(mlModelId.getOrNull()) + + /** + * Sets [Builder.mlModelId] to an arbitrary JSON value. + * + * You should usually call [Builder.mlModelId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } + + /** The number of tests that are passing for the commit. */ + fun passingGoalCount(passingGoalCount: Long) = + passingGoalCount(JsonField.of(passingGoalCount)) - /** - * Sets [Builder.validationDatasetId] to an arbitrary JSON value. - * - * You should usually call [Builder.validationDatasetId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun validationDatasetId(validationDatasetId: JsonField) = apply { - body.validationDatasetId(validationDatasetId) - } + /** + * Sets [Builder.passingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun passingGoalCount(passingGoalCount: JsonField) = apply { + this.passingGoalCount = passingGoalCount + } - /** Whether the commit is archived. */ - fun archived(archived: Boolean?) = apply { body.archived(archived) } + /** The project id. */ + fun bodyProjectId(bodyProjectId: String) = bodyProjectId(JsonField.of(bodyProjectId)) - /** - * Alias for [Builder.archived]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun archived(archived: Boolean) = archived(archived as Boolean?) + /** + * Sets [Builder.bodyProjectId] to an arbitrary JSON value. + * + * You should usually call [Builder.bodyProjectId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun bodyProjectId(bodyProjectId: JsonField) = apply { + this.bodyProjectId = bodyProjectId + } - /** Alias for calling [Builder.archived] with `archived.orElse(null)`. */ - fun archived(archived: Optional) = archived(archived.getOrNull()) + /** + * The commit status. Initially, the commit is `queued`, then, it switches to `running`. + * Finally, it can be `paused`, `failed`, or `completed`. + */ + fun status(status: Status) = status(JsonField.of(status)) - /** - * Sets [Builder.archived] to an arbitrary JSON value. - * - * You should usually call [Builder.archived] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun archived(archived: JsonField) = apply { body.archived(archived) } + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun status(status: JsonField) = apply { this.status = status } - /** The deployment status associated with the commit's model. */ - fun deploymentStatus(deploymentStatus: String) = apply { - body.deploymentStatus(deploymentStatus) - } + /** The commit status message. */ + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) - /** - * Sets [Builder.deploymentStatus] to an arbitrary JSON value. - * - * You should usually call [Builder.deploymentStatus] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun deploymentStatus(deploymentStatus: JsonField) = apply { - body.deploymentStatus(deploymentStatus) - } + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.getOrNull()) - fun links(links: Links) = apply { body.links(links) } + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } - /** - * Sets [Builder.links] to an arbitrary JSON value. - * - * You should usually call [Builder.links] with a well-typed [Links] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun links(links: JsonField) = apply { body.links(links) } + /** The storage URI where the commit bundle is stored. */ + fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } + /** + * Sets [Builder.storageUri] to an arbitrary JSON value. + * + * You should usually call [Builder.storageUri] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } + /** The total number of tests for the commit. */ + fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) + /** + * Sets [Builder.totalGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount } - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + /** The training dataset id. */ + fun trainingDatasetId(trainingDatasetId: String?) = + trainingDatasetId(JsonField.ofNullable(trainingDatasetId)) - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } + /** + * Alias for calling [Builder.trainingDatasetId] with `trainingDatasetId.orElse(null)`. + */ + fun trainingDatasetId(trainingDatasetId: Optional) = + trainingDatasetId(trainingDatasetId.getOrNull()) - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + /** + * Sets [Builder.trainingDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.trainingDatasetId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun trainingDatasetId(trainingDatasetId: JsonField) = apply { + this.trainingDatasetId = trainingDatasetId + } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + /** The validation dataset id. */ + fun validationDatasetId(validationDatasetId: String?) = + validationDatasetId(JsonField.ofNullable(validationDatasetId)) - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } + /** + * Alias for calling [Builder.validationDatasetId] with + * `validationDatasetId.orElse(null)`. + */ + fun validationDatasetId(validationDatasetId: Optional) = + validationDatasetId(validationDatasetId.getOrNull()) - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } + /** + * Sets [Builder.validationDatasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.validationDatasetId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun validationDatasetId(validationDatasetId: JsonField) = apply { + this.validationDatasetId = validationDatasetId + } - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + /** Whether the commit is archived. */ + fun archived(archived: Boolean?) = archived(JsonField.ofNullable(archived)) - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + /** + * Alias for [Builder.archived]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun archived(archived: Boolean) = archived(archived as Boolean?) - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } + /** Alias for calling [Builder.archived] with `archived.orElse(null)`. */ + fun archived(archived: Optional) = archived(archived.getOrNull()) - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } + /** + * Sets [Builder.archived] to an arbitrary JSON value. + * + * You should usually call [Builder.archived] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun archived(archived: JsonField) = apply { this.archived = archived } - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + /** The deployment status associated with the commit's model. */ + fun deploymentStatus(deploymentStatus: String) = + deploymentStatus(JsonField.of(deploymentStatus)) - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + /** + * Sets [Builder.deploymentStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.deploymentStatus] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deploymentStatus(deploymentStatus: JsonField) = apply { + this.deploymentStatus = deploymentStatus + } - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + fun links(links: Links) = links(JsonField.of(links)) + + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun links(links: JsonField) = apply { this.links = links } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .commit() + * .dateArchived() + * .dateCreated() + * .failingGoalCount() + * .mlModelId() + * .passingGoalCount() + * .bodyProjectId() + * .status() + * .statusMessage() + * .storageUri() + * .totalGoalCount() + * .trainingDatasetId() + * .validationDatasetId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("id", id), + checkRequired("commit", commit), + checkRequired("dateArchived", dateArchived), + checkRequired("dateCreated", dateCreated), + checkRequired("failingGoalCount", failingGoalCount), + checkRequired("mlModelId", mlModelId), + checkRequired("passingGoalCount", passingGoalCount), + checkRequired("bodyProjectId", bodyProjectId), + checkRequired("status", status), + checkRequired("statusMessage", statusMessage), + checkRequired("storageUri", storageUri), + checkRequired("totalGoalCount", totalGoalCount), + checkRequired("trainingDatasetId", trainingDatasetId), + checkRequired("validationDatasetId", validationDatasetId), + archived, + deploymentStatus, + links, + additionalProperties.toMutableMap(), + ) } - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } + private var validated: Boolean = false - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) + fun validate(): Body = apply { + if (validated) { + return@apply } - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) + id() + commit().validate() + dateArchived() + dateCreated() + failingGoalCount() + mlModelId() + passingGoalCount() + bodyProjectId() + status() + statusMessage() + storageUri() + totalGoalCount() + trainingDatasetId() + validationDatasetId() + archived() + deploymentStatus() + links().ifPresent { it.validate() } + validated = true } - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) + return /* spotless:off */ other is Body && id == other.id && commit == other.commit && dateArchived == other.dateArchived && dateCreated == other.dateCreated && failingGoalCount == other.failingGoalCount && mlModelId == other.mlModelId && passingGoalCount == other.passingGoalCount && bodyProjectId == other.bodyProjectId && status == other.status && statusMessage == other.statusMessage && storageUri == other.storageUri && totalGoalCount == other.totalGoalCount && trainingDatasetId == other.trainingDatasetId && validationDatasetId == other.validationDatasetId && archived == other.archived && deploymentStatus == other.deploymentStatus && links == other.links && additionalProperties == other.additionalProperties /* spotless:on */ } - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, commit, dateArchived, dateCreated, failingGoalCount, mlModelId, passingGoalCount, bodyProjectId, status, statusMessage, storageUri, totalGoalCount, trainingDatasetId, validationDatasetId, archived, deploymentStatus, links, additionalProperties) } + /* spotless:on */ - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } + override fun hashCode(): Int = hashCode - /** - * Returns an immutable instance of [CommitCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .pathProjectId() - * .id() - * .commit() - * .dateArchived() - * .dateCreated() - * .failingGoalCount() - * .mlModelId() - * .passingGoalCount() - * .bodyProjectId() - * .status() - * .statusMessage() - * .storageUri() - * .totalGoalCount() - * .trainingDatasetId() - * .validationDatasetId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CommitCreateParams = - CommitCreateParams( - checkRequired("pathProjectId", pathProjectId), - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) + override fun toString() = + "Body{id=$id, commit=$commit, dateArchived=$dateArchived, dateCreated=$dateCreated, failingGoalCount=$failingGoalCount, mlModelId=$mlModelId, passingGoalCount=$passingGoalCount, bodyProjectId=$bodyProjectId, status=$status, statusMessage=$statusMessage, storageUri=$storageUri, totalGoalCount=$totalGoalCount, trainingDatasetId=$trainingDatasetId, validationDatasetId=$validationDatasetId, archived=$archived, deploymentStatus=$deploymentStatus, links=$links, additionalProperties=$additionalProperties}" } /** The details of a commit (project version). */ - @NoAutoDetect class Commit - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("authorId") - @ExcludeMissing - private val authorId: JsonField = JsonMissing.of(), - @JsonProperty("fileSize") - @ExcludeMissing - private val fileSize: JsonField = JsonMissing.of(), - @JsonProperty("message") - @ExcludeMissing - private val message: JsonField = JsonMissing.of(), - @JsonProperty("mlModelId") - @ExcludeMissing - private val mlModelId: JsonField = JsonMissing.of(), - @JsonProperty("storageUri") - @ExcludeMissing - private val storageUri: JsonField = JsonMissing.of(), - @JsonProperty("trainingDatasetId") - @ExcludeMissing - private val trainingDatasetId: JsonField = JsonMissing.of(), - @JsonProperty("validationDatasetId") - @ExcludeMissing - private val validationDatasetId: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("gitCommitRef") - @ExcludeMissing - private val gitCommitRef: JsonField = JsonMissing.of(), - @JsonProperty("gitCommitSha") - @ExcludeMissing - private val gitCommitSha: JsonField = JsonMissing.of(), - @JsonProperty("gitCommitUrl") - @ExcludeMissing - private val gitCommitUrl: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val authorId: JsonField, + private val fileSize: JsonField, + private val message: JsonField, + private val mlModelId: JsonField, + private val storageUri: JsonField, + private val trainingDatasetId: JsonField, + private val validationDatasetId: JsonField, + private val dateCreated: JsonField, + private val gitCommitRef: JsonField, + private val gitCommitSha: JsonField, + private val gitCommitUrl: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("authorId") + @ExcludeMissing + authorId: JsonField = JsonMissing.of(), + @JsonProperty("fileSize") @ExcludeMissing fileSize: JsonField = JsonMissing.of(), + @JsonProperty("message") @ExcludeMissing message: JsonField = JsonMissing.of(), + @JsonProperty("mlModelId") + @ExcludeMissing + mlModelId: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + storageUri: JsonField = JsonMissing.of(), + @JsonProperty("trainingDatasetId") + @ExcludeMissing + trainingDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("validationDatasetId") + @ExcludeMissing + validationDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitRef") + @ExcludeMissing + gitCommitRef: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitSha") + @ExcludeMissing + gitCommitSha: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitUrl") + @ExcludeMissing + gitCommitUrl: JsonField = JsonMissing.of(), + ) : this( + id, + authorId, + fileSize, + message, + mlModelId, + storageUri, + trainingDatasetId, + validationDatasetId, + dateCreated, + gitCommitRef, + gitCommitSha, + gitCommitUrl, + mutableMapOf(), + ) + /** * The commit id. * @@ -1825,31 +1882,15 @@ private constructor( @ExcludeMissing fun _gitCommitUrl(): JsonField = gitCommitUrl + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Commit = apply { - if (validated) { - return@apply - } - - id() - authorId() - fileSize() - message() - mlModelId() - storageUri() - trainingDatasetId() - validationDatasetId() - dateCreated() - gitCommitRef() - gitCommitSha() - gitCommitUrl() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2143,10 +2184,32 @@ private constructor( gitCommitRef, gitCommitSha, gitCommitUrl, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Commit = apply { + if (validated) { + return@apply + } + + id() + authorId() + fileSize() + message() + mlModelId() + storageUri() + trainingDatasetId() + validationDatasetId() + dateCreated() + gitCommitRef() + gitCommitSha() + gitCommitUrl() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2293,15 +2356,17 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class Links - @JsonCreator private constructor( - @JsonProperty("app") @ExcludeMissing private val app: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val app: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing app: JsonField = JsonMissing.of() + ) : this(app, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -2315,20 +2380,15 @@ private constructor( */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Links = apply { - if (validated) { - return@apply - } - - app() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2400,7 +2460,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): Links = - Links(checkRequired("app", app), additionalProperties.toImmutable()) + Links(checkRequired("app", app), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt index 2a9eee83..3f5649f5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt @@ -11,70 +11,96 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.checkRequired -import com.openlayer.api.core.immutableEmptyMap -import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -@NoAutoDetect class CommitCreateResponse -@JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("commit") - @ExcludeMissing - private val commit: JsonField = JsonMissing.of(), - @JsonProperty("dateArchived") - @ExcludeMissing - private val dateArchived: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("failingGoalCount") - @ExcludeMissing - private val failingGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("mlModelId") - @ExcludeMissing - private val mlModelId: JsonField = JsonMissing.of(), - @JsonProperty("passingGoalCount") - @ExcludeMissing - private val passingGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("projectId") - @ExcludeMissing - private val projectId: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("statusMessage") - @ExcludeMissing - private val statusMessage: JsonField = JsonMissing.of(), - @JsonProperty("storageUri") - @ExcludeMissing - private val storageUri: JsonField = JsonMissing.of(), - @JsonProperty("totalGoalCount") - @ExcludeMissing - private val totalGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("trainingDatasetId") - @ExcludeMissing - private val trainingDatasetId: JsonField = JsonMissing.of(), - @JsonProperty("validationDatasetId") - @ExcludeMissing - private val validationDatasetId: JsonField = JsonMissing.of(), - @JsonProperty("archived") - @ExcludeMissing - private val archived: JsonField = JsonMissing.of(), - @JsonProperty("deploymentStatus") - @ExcludeMissing - private val deploymentStatus: JsonField = JsonMissing.of(), - @JsonProperty("links") @ExcludeMissing private val links: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val commit: JsonField, + private val dateArchived: JsonField, + private val dateCreated: JsonField, + private val failingGoalCount: JsonField, + private val mlModelId: JsonField, + private val passingGoalCount: JsonField, + private val projectId: JsonField, + private val status: JsonField, + private val statusMessage: JsonField, + private val storageUri: JsonField, + private val totalGoalCount: JsonField, + private val trainingDatasetId: JsonField, + private val validationDatasetId: JsonField, + private val archived: JsonField, + private val deploymentStatus: JsonField, + private val links: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("commit") @ExcludeMissing commit: JsonField = JsonMissing.of(), + @JsonProperty("dateArchived") + @ExcludeMissing + dateArchived: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("failingGoalCount") + @ExcludeMissing + failingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("mlModelId") @ExcludeMissing mlModelId: JsonField = JsonMissing.of(), + @JsonProperty("passingGoalCount") + @ExcludeMissing + passingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("projectId") @ExcludeMissing projectId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + storageUri: JsonField = JsonMissing.of(), + @JsonProperty("totalGoalCount") + @ExcludeMissing + totalGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("trainingDatasetId") + @ExcludeMissing + trainingDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("validationDatasetId") + @ExcludeMissing + validationDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("archived") @ExcludeMissing archived: JsonField = JsonMissing.of(), + @JsonProperty("deploymentStatus") + @ExcludeMissing + deploymentStatus: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing links: JsonField = JsonMissing.of(), + ) : this( + id, + commit, + dateArchived, + dateCreated, + failingGoalCount, + mlModelId, + passingGoalCount, + projectId, + status, + statusMessage, + storageUri, + totalGoalCount, + trainingDatasetId, + validationDatasetId, + archived, + deploymentStatus, + links, + mutableMapOf(), + ) + /** * The project version (commit) id. * @@ -357,36 +383,15 @@ private constructor( */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): CommitCreateResponse = apply { - if (validated) { - return@apply - } - - id() - commit().validate() - dateArchived() - dateCreated() - failingGoalCount() - mlModelId() - passingGoalCount() - projectId() - status() - statusMessage() - storageUri() - totalGoalCount() - trainingDatasetId() - validationDatasetId() - archived() - deploymentStatus() - links().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -781,53 +786,103 @@ private constructor( archived, deploymentStatus, links, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): CommitCreateResponse = apply { + if (validated) { + return@apply + } + + id() + commit().validate() + dateArchived() + dateCreated() + failingGoalCount() + mlModelId() + passingGoalCount() + projectId() + status() + statusMessage() + storageUri() + totalGoalCount() + trainingDatasetId() + validationDatasetId() + archived() + deploymentStatus() + links().ifPresent { it.validate() } + validated = true + } + /** The details of a commit (project version). */ - @NoAutoDetect class Commit - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("authorId") - @ExcludeMissing - private val authorId: JsonField = JsonMissing.of(), - @JsonProperty("fileSize") - @ExcludeMissing - private val fileSize: JsonField = JsonMissing.of(), - @JsonProperty("message") - @ExcludeMissing - private val message: JsonField = JsonMissing.of(), - @JsonProperty("mlModelId") - @ExcludeMissing - private val mlModelId: JsonField = JsonMissing.of(), - @JsonProperty("storageUri") - @ExcludeMissing - private val storageUri: JsonField = JsonMissing.of(), - @JsonProperty("trainingDatasetId") - @ExcludeMissing - private val trainingDatasetId: JsonField = JsonMissing.of(), - @JsonProperty("validationDatasetId") - @ExcludeMissing - private val validationDatasetId: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("gitCommitRef") - @ExcludeMissing - private val gitCommitRef: JsonField = JsonMissing.of(), - @JsonProperty("gitCommitSha") - @ExcludeMissing - private val gitCommitSha: JsonField = JsonMissing.of(), - @JsonProperty("gitCommitUrl") - @ExcludeMissing - private val gitCommitUrl: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val authorId: JsonField, + private val fileSize: JsonField, + private val message: JsonField, + private val mlModelId: JsonField, + private val storageUri: JsonField, + private val trainingDatasetId: JsonField, + private val validationDatasetId: JsonField, + private val dateCreated: JsonField, + private val gitCommitRef: JsonField, + private val gitCommitSha: JsonField, + private val gitCommitUrl: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("authorId") + @ExcludeMissing + authorId: JsonField = JsonMissing.of(), + @JsonProperty("fileSize") @ExcludeMissing fileSize: JsonField = JsonMissing.of(), + @JsonProperty("message") @ExcludeMissing message: JsonField = JsonMissing.of(), + @JsonProperty("mlModelId") + @ExcludeMissing + mlModelId: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + storageUri: JsonField = JsonMissing.of(), + @JsonProperty("trainingDatasetId") + @ExcludeMissing + trainingDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("validationDatasetId") + @ExcludeMissing + validationDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitRef") + @ExcludeMissing + gitCommitRef: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitSha") + @ExcludeMissing + gitCommitSha: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitUrl") + @ExcludeMissing + gitCommitUrl: JsonField = JsonMissing.of(), + ) : this( + id, + authorId, + fileSize, + message, + mlModelId, + storageUri, + trainingDatasetId, + validationDatasetId, + dateCreated, + gitCommitRef, + gitCommitSha, + gitCommitUrl, + mutableMapOf(), + ) + /** * The commit id. * @@ -1033,31 +1088,15 @@ private constructor( @ExcludeMissing fun _gitCommitUrl(): JsonField = gitCommitUrl + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Commit = apply { - if (validated) { - return@apply - } - - id() - authorId() - fileSize() - message() - mlModelId() - storageUri() - trainingDatasetId() - validationDatasetId() - dateCreated() - gitCommitRef() - gitCommitSha() - gitCommitUrl() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1351,10 +1390,32 @@ private constructor( gitCommitRef, gitCommitSha, gitCommitUrl, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Commit = apply { + if (validated) { + return@apply + } + + id() + authorId() + fileSize() + message() + mlModelId() + storageUri() + trainingDatasetId() + validationDatasetId() + dateCreated() + gitCommitRef() + gitCommitSha() + gitCommitUrl() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1501,15 +1562,17 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class Links - @JsonCreator private constructor( - @JsonProperty("app") @ExcludeMissing private val app: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val app: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing app: JsonField = JsonMissing.of() + ) : this(app, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -1523,20 +1586,15 @@ private constructor( */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Links = apply { - if (validated) { - return@apply - } - - app() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1608,7 +1666,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): Links = - Links(checkRequired("app", app), additionalProperties.toImmutable()) + Links(checkRequired("app", app), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt index ac703133..7c0fd921 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListParams.kt @@ -2,7 +2,6 @@ package com.openlayer.api.models.projects.commits -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers @@ -33,23 +32,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _pathParam(index: Int): String = - when (index) { - 0 -> projectId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - page?.let { put("page", it.toString()) } - perPage?.let { put("perPage", it.toString()) } - putAll(additionalQueryParams) - } - .build() - fun toBuilder() = Builder().from(this) companion object { @@ -66,7 +48,6 @@ private constructor( } /** A builder for [CommitListParams]. */ - @NoAutoDetect class Builder internal constructor() { private var projectId: String? = null @@ -232,6 +213,23 @@ private constructor( ) } + fun _pathParam(index: Int): String = + when (index) { + 0 -> projectId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + putAll(additionalQueryParams) + } + .build() + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt index 5f49d717..92c586ab 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt @@ -11,27 +11,27 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired -import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -@NoAutoDetect class CommitListResponse -@JsonCreator private constructor( - @JsonProperty("items") - @ExcludeMissing - private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val items: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -45,20 +45,15 @@ private constructor( */ @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): CommitListResponse = apply { - if (validated) { - return@apply - } - - items().forEach { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -144,67 +139,109 @@ private constructor( fun build(): CommitListResponse = CommitListResponse( checkRequired("items", items).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): CommitListResponse = apply { + if (validated) { + return@apply + } + + items().forEach { it.validate() } + validated = true + } + class Item - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("commit") - @ExcludeMissing - private val commit: JsonField = JsonMissing.of(), - @JsonProperty("dateArchived") - @ExcludeMissing - private val dateArchived: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("failingGoalCount") - @ExcludeMissing - private val failingGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("mlModelId") - @ExcludeMissing - private val mlModelId: JsonField = JsonMissing.of(), - @JsonProperty("passingGoalCount") - @ExcludeMissing - private val passingGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("projectId") - @ExcludeMissing - private val projectId: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("statusMessage") - @ExcludeMissing - private val statusMessage: JsonField = JsonMissing.of(), - @JsonProperty("storageUri") - @ExcludeMissing - private val storageUri: JsonField = JsonMissing.of(), - @JsonProperty("totalGoalCount") - @ExcludeMissing - private val totalGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("trainingDatasetId") - @ExcludeMissing - private val trainingDatasetId: JsonField = JsonMissing.of(), - @JsonProperty("validationDatasetId") - @ExcludeMissing - private val validationDatasetId: JsonField = JsonMissing.of(), - @JsonProperty("archived") - @ExcludeMissing - private val archived: JsonField = JsonMissing.of(), - @JsonProperty("deploymentStatus") - @ExcludeMissing - private val deploymentStatus: JsonField = JsonMissing.of(), - @JsonProperty("links") - @ExcludeMissing - private val links: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val commit: JsonField, + private val dateArchived: JsonField, + private val dateCreated: JsonField, + private val failingGoalCount: JsonField, + private val mlModelId: JsonField, + private val passingGoalCount: JsonField, + private val projectId: JsonField, + private val status: JsonField, + private val statusMessage: JsonField, + private val storageUri: JsonField, + private val totalGoalCount: JsonField, + private val trainingDatasetId: JsonField, + private val validationDatasetId: JsonField, + private val archived: JsonField, + private val deploymentStatus: JsonField, + private val links: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("commit") @ExcludeMissing commit: JsonField = JsonMissing.of(), + @JsonProperty("dateArchived") + @ExcludeMissing + dateArchived: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("failingGoalCount") + @ExcludeMissing + failingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("mlModelId") + @ExcludeMissing + mlModelId: JsonField = JsonMissing.of(), + @JsonProperty("passingGoalCount") + @ExcludeMissing + passingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + storageUri: JsonField = JsonMissing.of(), + @JsonProperty("totalGoalCount") + @ExcludeMissing + totalGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("trainingDatasetId") + @ExcludeMissing + trainingDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("validationDatasetId") + @ExcludeMissing + validationDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("archived") + @ExcludeMissing + archived: JsonField = JsonMissing.of(), + @JsonProperty("deploymentStatus") + @ExcludeMissing + deploymentStatus: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing links: JsonField = JsonMissing.of(), + ) : this( + id, + commit, + dateArchived, + dateCreated, + failingGoalCount, + mlModelId, + passingGoalCount, + projectId, + status, + statusMessage, + storageUri, + totalGoalCount, + trainingDatasetId, + validationDatasetId, + archived, + deploymentStatus, + links, + mutableMapOf(), + ) + /** * The project version (commit) id. * @@ -492,36 +529,15 @@ private constructor( */ @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Item = apply { - if (validated) { - return@apply - } - - id() - commit().validate() - dateArchived() - dateCreated() - failingGoalCount() - mlModelId() - passingGoalCount() - projectId() - status() - statusMessage() - storageUri() - totalGoalCount() - trainingDatasetId() - validationDatasetId() - archived() - deploymentStatus() - links().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -923,55 +939,107 @@ private constructor( archived, deploymentStatus, links, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + commit().validate() + dateArchived() + dateCreated() + failingGoalCount() + mlModelId() + passingGoalCount() + projectId() + status() + statusMessage() + storageUri() + totalGoalCount() + trainingDatasetId() + validationDatasetId() + archived() + deploymentStatus() + links().ifPresent { it.validate() } + validated = true + } + /** The details of a commit (project version). */ - @NoAutoDetect class Commit - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("authorId") - @ExcludeMissing - private val authorId: JsonField = JsonMissing.of(), - @JsonProperty("fileSize") - @ExcludeMissing - private val fileSize: JsonField = JsonMissing.of(), - @JsonProperty("message") - @ExcludeMissing - private val message: JsonField = JsonMissing.of(), - @JsonProperty("mlModelId") - @ExcludeMissing - private val mlModelId: JsonField = JsonMissing.of(), - @JsonProperty("storageUri") - @ExcludeMissing - private val storageUri: JsonField = JsonMissing.of(), - @JsonProperty("trainingDatasetId") - @ExcludeMissing - private val trainingDatasetId: JsonField = JsonMissing.of(), - @JsonProperty("validationDatasetId") - @ExcludeMissing - private val validationDatasetId: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("gitCommitRef") - @ExcludeMissing - private val gitCommitRef: JsonField = JsonMissing.of(), - @JsonProperty("gitCommitSha") - @ExcludeMissing - private val gitCommitSha: JsonField = JsonMissing.of(), - @JsonProperty("gitCommitUrl") - @ExcludeMissing - private val gitCommitUrl: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val authorId: JsonField, + private val fileSize: JsonField, + private val message: JsonField, + private val mlModelId: JsonField, + private val storageUri: JsonField, + private val trainingDatasetId: JsonField, + private val validationDatasetId: JsonField, + private val dateCreated: JsonField, + private val gitCommitRef: JsonField, + private val gitCommitSha: JsonField, + private val gitCommitUrl: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("authorId") + @ExcludeMissing + authorId: JsonField = JsonMissing.of(), + @JsonProperty("fileSize") + @ExcludeMissing + fileSize: JsonField = JsonMissing.of(), + @JsonProperty("message") + @ExcludeMissing + message: JsonField = JsonMissing.of(), + @JsonProperty("mlModelId") + @ExcludeMissing + mlModelId: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + storageUri: JsonField = JsonMissing.of(), + @JsonProperty("trainingDatasetId") + @ExcludeMissing + trainingDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("validationDatasetId") + @ExcludeMissing + validationDatasetId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitRef") + @ExcludeMissing + gitCommitRef: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitSha") + @ExcludeMissing + gitCommitSha: JsonField = JsonMissing.of(), + @JsonProperty("gitCommitUrl") + @ExcludeMissing + gitCommitUrl: JsonField = JsonMissing.of(), + ) : this( + id, + authorId, + fileSize, + message, + mlModelId, + storageUri, + trainingDatasetId, + validationDatasetId, + dateCreated, + gitCommitRef, + gitCommitSha, + gitCommitUrl, + mutableMapOf(), + ) + /** * The commit id. * @@ -1189,31 +1257,15 @@ private constructor( @ExcludeMissing fun _gitCommitUrl(): JsonField = gitCommitUrl + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Commit = apply { - if (validated) { - return@apply - } - - id() - authorId() - fileSize() - message() - mlModelId() - storageUri() - trainingDatasetId() - validationDatasetId() - dateCreated() - gitCommitRef() - gitCommitSha() - gitCommitUrl() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1514,10 +1566,32 @@ private constructor( gitCommitRef, gitCommitSha, gitCommitUrl, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Commit = apply { + if (validated) { + return@apply + } + + id() + authorId() + fileSize() + message() + mlModelId() + storageUri() + trainingDatasetId() + validationDatasetId() + dateCreated() + gitCommitRef() + gitCommitSha() + gitCommitUrl() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1666,17 +1740,17 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class Links - @JsonCreator private constructor( - @JsonProperty("app") - @ExcludeMissing - private val app: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val app: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing app: JsonField = JsonMissing.of() + ) : this(app, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -1691,20 +1765,15 @@ private constructor( */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Links = apply { - if (validated) { - return@apply - } - - app() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1779,7 +1848,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): Links = - Links(checkRequired("app", app), additionalProperties.toImmutable()) + Links(checkRequired("app", app), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt index aa4aeaeb..da3c7f1e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt @@ -11,17 +11,16 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams -import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.LocalDate import java.time.OffsetDateTime +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -312,860 +311,445 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): Body = body + fun toBuilder() = Builder().from(this) - fun _pathParam(index: Int): String = - when (index) { - 0 -> pathProjectId - else -> "" - } + companion object { - override fun _headers(): Headers = additionalHeaders + /** + * Returns a mutable builder for constructing an instance of + * [InferencePipelineCreateParams]. + * + * The following fields are required: + * ```java + * .pathProjectId() + * .id() + * .dateCreated() + * .dateLastEvaluated() + * .dateLastSampleReceived() + * .dateOfNextEvaluation() + * .dateUpdated() + * .description() + * .failingGoalCount() + * .links() + * .name() + * .passingGoalCount() + * .bodyProjectId() + * .status() + * .statusMessage() + * .totalGoalCount() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - override fun _queryParams(): QueryParams = additionalQueryParams + /** A builder for [InferencePipelineCreateParams]. */ + class Builder internal constructor() { - @NoAutoDetect - class Body - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateLastEvaluated") - @ExcludeMissing - private val dateLastEvaluated: JsonField = JsonMissing.of(), - @JsonProperty("dateLastSampleReceived") - @ExcludeMissing - private val dateLastSampleReceived: JsonField = JsonMissing.of(), - @JsonProperty("dateOfNextEvaluation") - @ExcludeMissing - private val dateOfNextEvaluation: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("failingGoalCount") - @ExcludeMissing - private val failingGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("links") - @ExcludeMissing - private val links: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("passingGoalCount") - @ExcludeMissing - private val passingGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("projectId") - @ExcludeMissing - private val bodyProjectId: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("statusMessage") - @ExcludeMissing - private val statusMessage: JsonField = JsonMissing.of(), - @JsonProperty("totalGoalCount") - @ExcludeMissing - private val totalGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("project") - @ExcludeMissing - private val project: JsonField = JsonMissing.of(), - @JsonProperty("workspace") - @ExcludeMissing - private val workspace: JsonField = JsonMissing.of(), - @JsonProperty("workspaceId") - @ExcludeMissing - private val workspaceId: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var pathProjectId: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(inferencePipelineCreateParams: InferencePipelineCreateParams) = apply { + pathProjectId = inferencePipelineCreateParams.pathProjectId + body = inferencePipelineCreateParams.body.toBuilder() + additionalHeaders = inferencePipelineCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = inferencePipelineCreateParams.additionalQueryParams.toBuilder() + } + + fun pathProjectId(pathProjectId: String) = apply { this.pathProjectId = pathProjectId } + + /** The inference pipeline id. */ + fun id(id: String) = apply { body.id(id) } /** - * The inference pipeline id. + * Sets [Builder.id] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun id(): String = id.getRequired("id") + fun id(id: JsonField) = apply { body.id(id) } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = apply { body.dateCreated(dateCreated) } /** - * The creation date. + * Sets [Builder.dateCreated] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + fun dateCreated(dateCreated: JsonField) = apply { + body.dateCreated(dateCreated) + } + + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = apply { + body.dateLastEvaluated(dateLastEvaluated) + } + + /** Alias for calling [Builder.dateLastEvaluated] with `dateLastEvaluated.orElse(null)`. */ + fun dateLastEvaluated(dateLastEvaluated: Optional) = + dateLastEvaluated(dateLastEvaluated.getOrNull()) /** - * The last test evaluation date. + * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). + * You should usually call [Builder.dateLastEvaluated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun dateLastEvaluated(): Optional = - Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + body.dateLastEvaluated(dateLastEvaluated) + } + + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime?) = apply { + body.dateLastSampleReceived(dateLastSampleReceived) + } /** - * The last data sample received date. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). + * Alias for calling [Builder.dateLastSampleReceived] with + * `dateLastSampleReceived.orElse(null)`. */ - fun dateLastSampleReceived(): Optional = - Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + fun dateLastSampleReceived(dateLastSampleReceived: Optional) = + dateLastSampleReceived(dateLastSampleReceived.getOrNull()) /** - * The next test evaluation date. + * Sets [Builder.dateLastSampleReceived] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). + * You should usually call [Builder.dateLastSampleReceived] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - fun dateOfNextEvaluation(): Optional = - Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { + body.dateLastSampleReceived(dateLastSampleReceived) + } + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = apply { + body.dateOfNextEvaluation(dateOfNextEvaluation) + } /** - * The last updated date. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Alias for calling [Builder.dateOfNextEvaluation] with + * `dateOfNextEvaluation.orElse(null)`. */ - fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = + dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) /** - * The inference pipeline description. + * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). + * You should usually call [Builder.dateOfNextEvaluation] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + body.dateOfNextEvaluation(dateOfNextEvaluation) + } + + /** The last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = apply { body.dateUpdated(dateUpdated) } /** - * The number of tests failing. + * Sets [Builder.dateUpdated] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") + fun dateUpdated(dateUpdated: JsonField) = apply { + body.dateUpdated(dateUpdated) + } - /** - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun links(): Links = links.getRequired("links") + /** The inference pipeline description. */ + fun description(description: String?) = apply { body.description(description) } + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) /** - * The inference pipeline name. + * Sets [Builder.description] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun name(): String = name.getRequired("name") + fun description(description: JsonField) = apply { body.description(description) } + + /** The number of tests failing. */ + fun failingGoalCount(failingGoalCount: Long) = apply { + body.failingGoalCount(failingGoalCount) + } /** - * The number of tests passing. + * Sets [Builder.failingGoalCount] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") + fun failingGoalCount(failingGoalCount: JsonField) = apply { + body.failingGoalCount(failingGoalCount) + } + + fun links(links: Links) = apply { body.links(links) } /** - * The project id. + * Sets [Builder.links] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun bodyProjectId(): String = bodyProjectId.getRequired("projectId") + fun links(links: JsonField) = apply { body.links(links) } + + /** The inference pipeline name. */ + fun name(name: String) = apply { body.name(name) } /** - * The status of test evaluation for the inference pipeline. + * Sets [Builder.name] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun status(): Status = status.getRequired("status") + fun name(name: JsonField) = apply { body.name(name) } - /** - * The status message of test evaluation for the inference pipeline. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) + /** The number of tests passing. */ + fun passingGoalCount(passingGoalCount: Long) = apply { + body.passingGoalCount(passingGoalCount) + } /** - * The total number of tests. + * Sets [Builder.passingGoalCount] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") - - /** - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). + * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun project(): Optional = Optional.ofNullable(project.getNullable("project")) + fun passingGoalCount(passingGoalCount: JsonField) = apply { + body.passingGoalCount(passingGoalCount) + } - /** - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun workspace(): Optional = - Optional.ofNullable(workspace.getNullable("workspace")) + /** The project id. */ + fun bodyProjectId(bodyProjectId: String) = apply { body.bodyProjectId(bodyProjectId) } /** - * The workspace id. + * Sets [Builder.bodyProjectId] to an arbitrary JSON value. * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). + * You should usually call [Builder.bodyProjectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun bodyProjectId(bodyProjectId: JsonField) = apply { + body.bodyProjectId(bodyProjectId) + } - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** The status of test evaluation for the inference pipeline. */ + fun status(status: Status) = apply { body.status(status) } /** - * Returns the raw JSON value of [dateCreated]. + * Sets [Builder.status] to an arbitrary JSON value. * - * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated(): JsonField = dateCreated + fun status(status: JsonField) = apply { body.status(status) } - /** - * Returns the raw JSON value of [dateLastEvaluated]. - * - * Unlike [dateLastEvaluated], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("dateLastEvaluated") - @ExcludeMissing - fun _dateLastEvaluated(): JsonField = dateLastEvaluated + /** The status message of test evaluation for the inference pipeline. */ + fun statusMessage(statusMessage: String?) = apply { body.statusMessage(statusMessage) } - /** - * Returns the raw JSON value of [dateLastSampleReceived]. - * - * Unlike [dateLastSampleReceived], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("dateLastSampleReceived") - @ExcludeMissing - fun _dateLastSampleReceived(): JsonField = dateLastSampleReceived + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.getOrNull()) /** - * Returns the raw JSON value of [dateOfNextEvaluation]. + * Sets [Builder.statusMessage] to an arbitrary JSON value. * - * Unlike [dateOfNextEvaluation], this method doesn't throw if the JSON field has an - * unexpected type. + * You should usually call [Builder.statusMessage] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - @JsonProperty("dateOfNextEvaluation") - @ExcludeMissing - fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation + fun statusMessage(statusMessage: JsonField) = apply { + body.statusMessage(statusMessage) + } - /** - * Returns the raw JSON value of [dateUpdated]. - * - * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated(): JsonField = dateUpdated + /** The total number of tests. */ + fun totalGoalCount(totalGoalCount: Long) = apply { body.totalGoalCount(totalGoalCount) } /** - * Returns the raw JSON value of [description]. + * Sets [Builder.totalGoalCount] to an arbitrary JSON value. * - * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - @JsonProperty("description") - @ExcludeMissing - fun _description(): JsonField = description + fun totalGoalCount(totalGoalCount: JsonField) = apply { + body.totalGoalCount(totalGoalCount) + } - /** - * Returns the raw JSON value of [failingGoalCount]. - * - * Unlike [failingGoalCount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("failingGoalCount") - @ExcludeMissing - fun _failingGoalCount(): JsonField = failingGoalCount + fun project(project: Project?) = apply { body.project(project) } - /** - * Returns the raw JSON value of [links]. - * - * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links + /** Alias for calling [Builder.project] with `project.orElse(null)`. */ + fun project(project: Optional) = project(project.getOrNull()) /** - * Returns the raw JSON value of [name]. + * Sets [Builder.project] to an arbitrary JSON value. * - * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.project] with a well-typed [Project] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + fun project(project: JsonField) = apply { body.project(project) } - /** - * Returns the raw JSON value of [passingGoalCount]. - * - * Unlike [passingGoalCount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("passingGoalCount") - @ExcludeMissing - fun _passingGoalCount(): JsonField = passingGoalCount + fun workspace(workspace: Workspace?) = apply { body.workspace(workspace) } - /** - * Returns the raw JSON value of [bodyProjectId]. - * - * Unlike [bodyProjectId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("projectId") - @ExcludeMissing - fun _bodyProjectId(): JsonField = bodyProjectId + /** Alias for calling [Builder.workspace] with `workspace.orElse(null)`. */ + fun workspace(workspace: Optional) = workspace(workspace.getOrNull()) /** - * Returns the raw JSON value of [status]. + * Sets [Builder.workspace] to an arbitrary JSON value. * - * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.workspace] with a well-typed [Workspace] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + fun workspace(workspace: JsonField) = apply { body.workspace(workspace) } - /** - * Returns the raw JSON value of [statusMessage]. - * - * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("statusMessage") - @ExcludeMissing - fun _statusMessage(): JsonField = statusMessage + /** The workspace id. */ + fun workspaceId(workspaceId: String) = apply { body.workspaceId(workspaceId) } /** - * Returns the raw JSON value of [totalGoalCount]. + * Sets [Builder.workspaceId] to an arbitrary JSON value. * - * Unlike [totalGoalCount], this method doesn't throw if the JSON field has an unexpected - * type. + * You should usually call [Builder.workspaceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - @JsonProperty("totalGoalCount") - @ExcludeMissing - fun _totalGoalCount(): JsonField = totalGoalCount + fun workspaceId(workspaceId: JsonField) = apply { body.workspaceId(workspaceId) } - /** - * Returns the raw JSON value of [project]. - * - * Unlike [project], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("project") @ExcludeMissing fun _project(): JsonField = project + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } - /** - * Returns the raw JSON value of [workspace]. - * - * Unlike [workspace], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("workspace") - @ExcludeMissing - fun _workspace(): JsonField = workspace + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } - /** - * Returns the raw JSON value of [workspaceId]. - * - * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("workspaceId") - @ExcludeMissing - fun _workspaceId(): JsonField = workspaceId + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - private var validated: Boolean = false + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } - fun validate(): Body = apply { - if (validated) { - return@apply - } + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - id() - dateCreated() - dateLastEvaluated() - dateLastSampleReceived() - dateOfNextEvaluation() - dateUpdated() - description() - failingGoalCount() - links().validate() - name() - passingGoalCount() - bodyProjectId() - status() - statusMessage() - totalGoalCount() - project().ifPresent { it.validate() } - workspace().ifPresent { it.validate() } - workspaceId() - validated = true + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun toBuilder() = Builder().from(this) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } - companion object { + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } - /** - * Returns a mutable builder for constructing an instance of [Body]. - * - * The following fields are required: - * ```java - * .id() - * .dateCreated() - * .dateLastEvaluated() - * .dateLastSampleReceived() - * .dateOfNextEvaluation() - * .dateUpdated() - * .description() - * .failingGoalCount() - * .links() - * .name() - * .passingGoalCount() - * .bodyProjectId() - * .status() - * .statusMessage() - * .totalGoalCount() - * ``` - */ - @JvmStatic fun builder() = Builder() + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) } - /** A builder for [Body]. */ - class Builder internal constructor() { + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } - private var id: JsonField? = null - private var dateCreated: JsonField? = null - private var dateLastEvaluated: JsonField? = null - private var dateLastSampleReceived: JsonField? = null - private var dateOfNextEvaluation: JsonField? = null - private var dateUpdated: JsonField? = null - private var description: JsonField? = null - private var failingGoalCount: JsonField? = null - private var links: JsonField? = null - private var name: JsonField? = null - private var passingGoalCount: JsonField? = null - private var bodyProjectId: JsonField? = null - private var status: JsonField? = null - private var statusMessage: JsonField? = null - private var totalGoalCount: JsonField? = null - private var project: JsonField = JsonMissing.of() - private var workspace: JsonField = JsonMissing.of() - private var workspaceId: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } - @JvmSynthetic - internal fun from(body: Body) = apply { - id = body.id - dateCreated = body.dateCreated - dateLastEvaluated = body.dateLastEvaluated - dateLastSampleReceived = body.dateLastSampleReceived - dateOfNextEvaluation = body.dateOfNextEvaluation - dateUpdated = body.dateUpdated - description = body.description - failingGoalCount = body.failingGoalCount - links = body.links - name = body.name - passingGoalCount = body.passingGoalCount - bodyProjectId = body.bodyProjectId - status = body.status - statusMessage = body.statusMessage - totalGoalCount = body.totalGoalCount - project = body.project - workspace = body.workspace - workspaceId = body.workspaceId - additionalProperties = body.additionalProperties.toMutableMap() - } + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } - /** The inference pipeline id. */ - fun id(id: String) = id(JsonField.of(id)) + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun id(id: JsonField) = apply { this.id = id } + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } - /** The creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - /** - * Sets [Builder.dateCreated] to an arbitrary JSON value. - * - * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun dateCreated(dateCreated: JsonField) = apply { - this.dateCreated = dateCreated - } + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } - /** The last test evaluation date. */ - fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = - dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } - /** - * Alias for calling [Builder.dateLastEvaluated] with `dateLastEvaluated.orElse(null)`. - */ - fun dateLastEvaluated(dateLastEvaluated: Optional) = - dateLastEvaluated(dateLastEvaluated.getOrNull()) + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } - /** - * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. - * - * You should usually call [Builder.dateLastEvaluated] with a well-typed - * [OffsetDateTime] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { - this.dateLastEvaluated = dateLastEvaluated - } + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } - /** The last data sample received date. */ - fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime?) = - dateLastSampleReceived(JsonField.ofNullable(dateLastSampleReceived)) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } - /** - * Alias for calling [Builder.dateLastSampleReceived] with - * `dateLastSampleReceived.orElse(null)`. - */ - fun dateLastSampleReceived(dateLastSampleReceived: Optional) = - dateLastSampleReceived(dateLastSampleReceived.getOrNull()) + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } - /** - * Sets [Builder.dateLastSampleReceived] to an arbitrary JSON value. - * - * You should usually call [Builder.dateLastSampleReceived] with a well-typed - * [OffsetDateTime] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { - this.dateLastSampleReceived = dateLastSampleReceived + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) } - /** The next test evaluation date. */ - fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = - dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) - - /** - * Alias for calling [Builder.dateOfNextEvaluation] with - * `dateOfNextEvaluation.orElse(null)`. - */ - fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = - dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } - /** - * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. - * - * You should usually call [Builder.dateOfNextEvaluation] with a well-typed - * [OffsetDateTime] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { - this.dateOfNextEvaluation = dateOfNextEvaluation - } + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } - /** The last updated date. */ - fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } - /** - * Sets [Builder.dateUpdated] to an arbitrary JSON value. - * - * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun dateUpdated(dateUpdated: JsonField) = apply { - this.dateUpdated = dateUpdated + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) } - /** The inference pipeline description. */ - fun description(description: String?) = description(JsonField.ofNullable(description)) - - /** Alias for calling [Builder.description] with `description.orElse(null)`. */ - fun description(description: Optional) = description(description.getOrNull()) - - /** - * Sets [Builder.description] to an arbitrary JSON value. - * - * You should usually call [Builder.description] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun description(description: JsonField) = apply { - this.description = description - } + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - /** The number of tests failing. */ - fun failingGoalCount(failingGoalCount: Long) = - failingGoalCount(JsonField.of(failingGoalCount)) - - /** - * Sets [Builder.failingGoalCount] to an arbitrary JSON value. - * - * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun failingGoalCount(failingGoalCount: JsonField) = apply { - this.failingGoalCount = failingGoalCount - } - - fun links(links: Links) = links(JsonField.of(links)) - - /** - * Sets [Builder.links] to an arbitrary JSON value. - * - * You should usually call [Builder.links] with a well-typed [Links] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun links(links: JsonField) = apply { this.links = links } - - /** The inference pipeline name. */ - fun name(name: String) = name(JsonField.of(name)) - - /** - * Sets [Builder.name] to an arbitrary JSON value. - * - * You should usually call [Builder.name] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun name(name: JsonField) = apply { this.name = name } - - /** The number of tests passing. */ - fun passingGoalCount(passingGoalCount: Long) = - passingGoalCount(JsonField.of(passingGoalCount)) - - /** - * Sets [Builder.passingGoalCount] to an arbitrary JSON value. - * - * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun passingGoalCount(passingGoalCount: JsonField) = apply { - this.passingGoalCount = passingGoalCount - } - - /** The project id. */ - fun bodyProjectId(bodyProjectId: String) = bodyProjectId(JsonField.of(bodyProjectId)) - - /** - * Sets [Builder.bodyProjectId] to an arbitrary JSON value. - * - * You should usually call [Builder.bodyProjectId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun bodyProjectId(bodyProjectId: JsonField) = apply { - this.bodyProjectId = bodyProjectId - } - - /** The status of test evaluation for the inference pipeline. */ - fun status(status: Status) = status(JsonField.of(status)) - - /** - * Sets [Builder.status] to an arbitrary JSON value. - * - * You should usually call [Builder.status] with a well-typed [Status] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun status(status: JsonField) = apply { this.status = status } - - /** The status message of test evaluation for the inference pipeline. */ - fun statusMessage(statusMessage: String?) = - statusMessage(JsonField.ofNullable(statusMessage)) - - /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ - fun statusMessage(statusMessage: Optional) = - statusMessage(statusMessage.getOrNull()) - - /** - * Sets [Builder.statusMessage] to an arbitrary JSON value. - * - * You should usually call [Builder.statusMessage] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun statusMessage(statusMessage: JsonField) = apply { - this.statusMessage = statusMessage - } - - /** The total number of tests. */ - fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - - /** - * Sets [Builder.totalGoalCount] to an arbitrary JSON value. - * - * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun totalGoalCount(totalGoalCount: JsonField) = apply { - this.totalGoalCount = totalGoalCount - } - - fun project(project: Project?) = project(JsonField.ofNullable(project)) - - /** Alias for calling [Builder.project] with `project.orElse(null)`. */ - fun project(project: Optional) = project(project.getOrNull()) - - /** - * Sets [Builder.project] to an arbitrary JSON value. - * - * You should usually call [Builder.project] with a well-typed [Project] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun project(project: JsonField) = apply { this.project = project } - - fun workspace(workspace: Workspace?) = workspace(JsonField.ofNullable(workspace)) - - /** Alias for calling [Builder.workspace] with `workspace.orElse(null)`. */ - fun workspace(workspace: Optional) = workspace(workspace.getOrNull()) - - /** - * Sets [Builder.workspace] to an arbitrary JSON value. - * - * You should usually call [Builder.workspace] with a well-typed [Workspace] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun workspace(workspace: JsonField) = apply { this.workspace = workspace } - - /** The workspace id. */ - fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) - - /** - * Sets [Builder.workspaceId] to an arbitrary JSON value. - * - * You should usually call [Builder.workspaceId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun workspaceId(workspaceId: JsonField) = apply { - this.workspaceId = workspaceId - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .dateCreated() - * .dateLastEvaluated() - * .dateLastSampleReceived() - * .dateOfNextEvaluation() - * .dateUpdated() - * .description() - * .failingGoalCount() - * .links() - * .name() - * .passingGoalCount() - * .bodyProjectId() - * .status() - * .statusMessage() - * .totalGoalCount() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body( - checkRequired("id", id), - checkRequired("dateCreated", dateCreated), - checkRequired("dateLastEvaluated", dateLastEvaluated), - checkRequired("dateLastSampleReceived", dateLastSampleReceived), - checkRequired("dateOfNextEvaluation", dateOfNextEvaluation), - checkRequired("dateUpdated", dateUpdated), - checkRequired("description", description), - checkRequired("failingGoalCount", failingGoalCount), - checkRequired("links", links), - checkRequired("name", name), - checkRequired("passingGoalCount", passingGoalCount), - checkRequired("bodyProjectId", bodyProjectId), - checkRequired("status", status), - checkRequired("statusMessage", statusMessage), - checkRequired("totalGoalCount", totalGoalCount), - project, - workspace, - workspaceId, - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Body && id == other.id && dateCreated == other.dateCreated && dateLastEvaluated == other.dateLastEvaluated && dateLastSampleReceived == other.dateLastSampleReceived && dateOfNextEvaluation == other.dateOfNextEvaluation && dateUpdated == other.dateUpdated && description == other.description && failingGoalCount == other.failingGoalCount && links == other.links && name == other.name && passingGoalCount == other.passingGoalCount && bodyProjectId == other.bodyProjectId && status == other.status && statusMessage == other.statusMessage && totalGoalCount == other.totalGoalCount && project == other.project && workspace == other.workspace && workspaceId == other.workspaceId && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, dateCreated, dateLastEvaluated, dateLastSampleReceived, dateOfNextEvaluation, dateUpdated, description, failingGoalCount, links, name, passingGoalCount, bodyProjectId, status, statusMessage, totalGoalCount, project, workspace, workspaceId, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{id=$id, dateCreated=$dateCreated, dateLastEvaluated=$dateLastEvaluated, dateLastSampleReceived=$dateLastSampleReceived, dateOfNextEvaluation=$dateOfNextEvaluation, dateUpdated=$dateUpdated, description=$description, failingGoalCount=$failingGoalCount, links=$links, name=$name, passingGoalCount=$passingGoalCount, bodyProjectId=$bodyProjectId, status=$status, statusMessage=$statusMessage, totalGoalCount=$totalGoalCount, project=$project, workspace=$workspace, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" - } - - fun toBuilder() = Builder().from(this) - - companion object { + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } /** - * Returns a mutable builder for constructing an instance of - * [InferencePipelineCreateParams]. + * Returns an immutable instance of [InferencePipelineCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java @@ -1186,460 +770,913 @@ private constructor( * .statusMessage() * .totalGoalCount() * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): InferencePipelineCreateParams = + InferencePipelineCreateParams( + checkRequired("pathProjectId", pathProjectId), + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + @JvmSynthetic internal fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> pathProjectId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateLastEvaluated: JsonField, + private val dateLastSampleReceived: JsonField, + private val dateOfNextEvaluation: JsonField, + private val dateUpdated: JsonField, + private val description: JsonField, + private val failingGoalCount: JsonField, + private val links: JsonField, + private val name: JsonField, + private val passingGoalCount: JsonField, + private val bodyProjectId: JsonField, + private val status: JsonField, + private val statusMessage: JsonField, + private val totalGoalCount: JsonField, + private val project: JsonField, + private val workspace: JsonField, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastSampleReceived") + @ExcludeMissing + dateLastSampleReceived: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("failingGoalCount") + @ExcludeMissing + failingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing links: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("passingGoalCount") + @ExcludeMissing + passingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + bodyProjectId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("totalGoalCount") + @ExcludeMissing + totalGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("project") @ExcludeMissing project: JsonField = JsonMissing.of(), + @JsonProperty("workspace") + @ExcludeMissing + workspace: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateLastEvaluated, + dateLastSampleReceived, + dateOfNextEvaluation, + dateUpdated, + description, + failingGoalCount, + links, + name, + passingGoalCount, + bodyProjectId, + status, + statusMessage, + totalGoalCount, + project, + workspace, + workspaceId, + mutableMapOf(), + ) + + /** + * The inference pipeline id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last test evaluation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateLastEvaluated(): Optional = + Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + + /** + * The last data sample received date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateLastSampleReceived(): Optional = + Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + + /** + * The next test evaluation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateOfNextEvaluation(): Optional = + Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + + /** + * The last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * The inference pipeline description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ - @JvmStatic fun builder() = Builder() - } + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) - /** A builder for [InferencePipelineCreateParams]. */ - @NoAutoDetect - class Builder internal constructor() { + /** + * The number of tests failing. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") - private var pathProjectId: String? = null - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun links(): Links = links.getRequired("links") - @JvmSynthetic - internal fun from(inferencePipelineCreateParams: InferencePipelineCreateParams) = apply { - pathProjectId = inferencePipelineCreateParams.pathProjectId - body = inferencePipelineCreateParams.body.toBuilder() - additionalHeaders = inferencePipelineCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = inferencePipelineCreateParams.additionalQueryParams.toBuilder() - } + /** + * The inference pipeline name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") - fun pathProjectId(pathProjectId: String) = apply { this.pathProjectId = pathProjectId } + /** + * The number of tests passing. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") - /** The inference pipeline id. */ - fun id(id: String) = apply { body.id(id) } + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun bodyProjectId(): String = bodyProjectId.getRequired("projectId") /** - * Sets [Builder.id] to an arbitrary JSON value. + * The status of test evaluation for the inference pipeline. * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun id(id: JsonField) = apply { body.id(id) } + fun status(): Status = status.getRequired("status") - /** The creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = apply { body.dateCreated(dateCreated) } + /** + * The status message of test evaluation for the inference pipeline. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) /** - * Sets [Builder.dateCreated] to an arbitrary JSON value. + * The total number of tests. * - * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun dateCreated(dateCreated: JsonField) = apply { - body.dateCreated(dateCreated) - } + fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") - /** The last test evaluation date. */ - fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = apply { - body.dateLastEvaluated(dateLastEvaluated) - } + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun project(): Optional = Optional.ofNullable(project.getNullable("project")) - /** Alias for calling [Builder.dateLastEvaluated] with `dateLastEvaluated.orElse(null)`. */ - fun dateLastEvaluated(dateLastEvaluated: Optional) = - dateLastEvaluated(dateLastEvaluated.getOrNull()) + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun workspace(): Optional = + Optional.ofNullable(workspace.getNullable("workspace")) /** - * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. + * The workspace id. * - * You should usually call [Builder.dateLastEvaluated] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ - fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { - body.dateLastEvaluated(dateLastEvaluated) - } - - /** The last data sample received date. */ - fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime?) = apply { - body.dateLastSampleReceived(dateLastSampleReceived) - } + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) /** - * Alias for calling [Builder.dateLastSampleReceived] with - * `dateLastSampleReceived.orElse(null)`. + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. */ - fun dateLastSampleReceived(dateLastSampleReceived: Optional) = - dateLastSampleReceived(dateLastSampleReceived.getOrNull()) + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** - * Sets [Builder.dateLastSampleReceived] to an arbitrary JSON value. + * Returns the raw JSON value of [dateCreated]. * - * You should usually call [Builder.dateLastSampleReceived] with a well-typed - * [OffsetDateTime] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. */ - fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { - body.dateLastSampleReceived(dateLastSampleReceived) - } - - /** The next test evaluation date. */ - fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = apply { - body.dateOfNextEvaluation(dateOfNextEvaluation) - } + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated /** - * Alias for calling [Builder.dateOfNextEvaluation] with - * `dateOfNextEvaluation.orElse(null)`. + * Returns the raw JSON value of [dateLastEvaluated]. + * + * Unlike [dateLastEvaluated], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = - dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun _dateLastEvaluated(): JsonField = dateLastEvaluated /** - * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. + * Returns the raw JSON value of [dateLastSampleReceived]. * - * You should usually call [Builder.dateOfNextEvaluation] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * Unlike [dateLastSampleReceived], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { - body.dateOfNextEvaluation(dateOfNextEvaluation) - } + @JsonProperty("dateLastSampleReceived") + @ExcludeMissing + fun _dateLastSampleReceived(): JsonField = dateLastSampleReceived - /** The last updated date. */ - fun dateUpdated(dateUpdated: OffsetDateTime) = apply { body.dateUpdated(dateUpdated) } + /** + * Returns the raw JSON value of [dateOfNextEvaluation]. + * + * Unlike [dateOfNextEvaluation], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation /** - * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * Returns the raw JSON value of [dateUpdated]. * - * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. */ - fun dateUpdated(dateUpdated: JsonField) = apply { - body.dateUpdated(dateUpdated) - } + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated - /** The inference pipeline description. */ - fun description(description: String?) = apply { body.description(description) } + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description - /** Alias for calling [Builder.description] with `description.orElse(null)`. */ - fun description(description: Optional) = description(description.getOrNull()) + /** + * Returns the raw JSON value of [failingGoalCount]. + * + * Unlike [failingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("failingGoalCount") + @ExcludeMissing + fun _failingGoalCount(): JsonField = failingGoalCount /** - * Sets [Builder.description] to an arbitrary JSON value. + * Returns the raw JSON value of [links]. * - * You should usually call [Builder.description] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. */ - fun description(description: JsonField) = apply { body.description(description) } + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links - /** The number of tests failing. */ - fun failingGoalCount(failingGoalCount: Long) = apply { - body.failingGoalCount(failingGoalCount) - } + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * Sets [Builder.failingGoalCount] to an arbitrary JSON value. + * Returns the raw JSON value of [passingGoalCount]. * - * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Unlike [passingGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun failingGoalCount(failingGoalCount: JsonField) = apply { - body.failingGoalCount(failingGoalCount) - } + @JsonProperty("passingGoalCount") + @ExcludeMissing + fun _passingGoalCount(): JsonField = passingGoalCount - fun links(links: Links) = apply { body.links(links) } + /** + * Returns the raw JSON value of [bodyProjectId]. + * + * Unlike [bodyProjectId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("projectId") + @ExcludeMissing + fun _bodyProjectId(): JsonField = bodyProjectId /** - * Sets [Builder.links] to an arbitrary JSON value. + * Returns the raw JSON value of [status]. * - * You should usually call [Builder.links] with a well-typed [Links] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. */ - fun links(links: JsonField) = apply { body.links(links) } - - /** The inference pipeline name. */ - fun name(name: String) = apply { body.name(name) } + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status /** - * Sets [Builder.name] to an arbitrary JSON value. + * Returns the raw JSON value of [statusMessage]. * - * You should usually call [Builder.name] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun name(name: JsonField) = apply { body.name(name) } - - /** The number of tests passing. */ - fun passingGoalCount(passingGoalCount: Long) = apply { - body.passingGoalCount(passingGoalCount) - } + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage /** - * Sets [Builder.passingGoalCount] to an arbitrary JSON value. + * Returns the raw JSON value of [totalGoalCount]. * - * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Unlike [totalGoalCount], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun passingGoalCount(passingGoalCount: JsonField) = apply { - body.passingGoalCount(passingGoalCount) - } - - /** The project id. */ - fun bodyProjectId(bodyProjectId: String) = apply { body.bodyProjectId(bodyProjectId) } + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun _totalGoalCount(): JsonField = totalGoalCount /** - * Sets [Builder.bodyProjectId] to an arbitrary JSON value. + * Returns the raw JSON value of [project]. * - * You should usually call [Builder.bodyProjectId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * Unlike [project], this method doesn't throw if the JSON field has an unexpected type. */ - fun bodyProjectId(bodyProjectId: JsonField) = apply { - body.bodyProjectId(bodyProjectId) - } - - /** The status of test evaluation for the inference pipeline. */ - fun status(status: Status) = apply { body.status(status) } + @JsonProperty("project") @ExcludeMissing fun _project(): JsonField = project /** - * Sets [Builder.status] to an arbitrary JSON value. + * Returns the raw JSON value of [workspace]. * - * You should usually call [Builder.status] with a well-typed [Status] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * Unlike [workspace], this method doesn't throw if the JSON field has an unexpected type. */ - fun status(status: JsonField) = apply { body.status(status) } - - /** The status message of test evaluation for the inference pipeline. */ - fun statusMessage(statusMessage: String?) = apply { body.statusMessage(statusMessage) } - - /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ - fun statusMessage(statusMessage: Optional) = - statusMessage(statusMessage.getOrNull()) + @JsonProperty("workspace") + @ExcludeMissing + fun _workspace(): JsonField = workspace /** - * Sets [Builder.statusMessage] to an arbitrary JSON value. + * Returns the raw JSON value of [workspaceId]. * - * You should usually call [Builder.statusMessage] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. */ - fun statusMessage(statusMessage: JsonField) = apply { - body.statusMessage(statusMessage) + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateLastEvaluated() + * .dateLastSampleReceived() + * .dateOfNextEvaluation() + * .dateUpdated() + * .description() + * .failingGoalCount() + * .links() + * .name() + * .passingGoalCount() + * .bodyProjectId() + * .status() + * .statusMessage() + * .totalGoalCount() + * ``` + */ + @JvmStatic fun builder() = Builder() } - /** The total number of tests. */ - fun totalGoalCount(totalGoalCount: Long) = apply { body.totalGoalCount(totalGoalCount) } + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateLastEvaluated: JsonField? = null + private var dateLastSampleReceived: JsonField? = null + private var dateOfNextEvaluation: JsonField? = null + private var dateUpdated: JsonField? = null + private var description: JsonField? = null + private var failingGoalCount: JsonField? = null + private var links: JsonField? = null + private var name: JsonField? = null + private var passingGoalCount: JsonField? = null + private var bodyProjectId: JsonField? = null + private var status: JsonField? = null + private var statusMessage: JsonField? = null + private var totalGoalCount: JsonField? = null + private var project: JsonField = JsonMissing.of() + private var workspace: JsonField = JsonMissing.of() + private var workspaceId: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + id = body.id + dateCreated = body.dateCreated + dateLastEvaluated = body.dateLastEvaluated + dateLastSampleReceived = body.dateLastSampleReceived + dateOfNextEvaluation = body.dateOfNextEvaluation + dateUpdated = body.dateUpdated + description = body.description + failingGoalCount = body.failingGoalCount + links = body.links + name = body.name + passingGoalCount = body.passingGoalCount + bodyProjectId = body.bodyProjectId + status = body.status + statusMessage = body.statusMessage + totalGoalCount = body.totalGoalCount + project = body.project + workspace = body.workspace + workspaceId = body.workspaceId + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The inference pipeline id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = + dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) + + /** + * Alias for calling [Builder.dateLastEvaluated] with `dateLastEvaluated.orElse(null)`. + */ + fun dateLastEvaluated(dateLastEvaluated: Optional) = + dateLastEvaluated(dateLastEvaluated.getOrNull()) + + /** + * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastEvaluated] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime?) = + dateLastSampleReceived(JsonField.ofNullable(dateLastSampleReceived)) + + /** + * Alias for calling [Builder.dateLastSampleReceived] with + * `dateLastSampleReceived.orElse(null)`. + */ + fun dateLastSampleReceived(dateLastSampleReceived: Optional) = + dateLastSampleReceived(dateLastSampleReceived.getOrNull()) + + /** + * Sets [Builder.dateLastSampleReceived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastSampleReceived] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { + this.dateLastSampleReceived = dateLastSampleReceived + } + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = + dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) + + /** + * Alias for calling [Builder.dateOfNextEvaluation] with + * `dateOfNextEvaluation.orElse(null)`. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = + dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) + + /** + * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfNextEvaluation] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** The last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } - /** - * Sets [Builder.totalGoalCount] to an arbitrary JSON value. - * - * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun totalGoalCount(totalGoalCount: JsonField) = apply { - body.totalGoalCount(totalGoalCount) - } + /** The inference pipeline description. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) - fun project(project: Project?) = apply { body.project(project) } + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) - /** Alias for calling [Builder.project] with `project.orElse(null)`. */ - fun project(project: Optional) = project(project.getOrNull()) + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } - /** - * Sets [Builder.project] to an arbitrary JSON value. - * - * You should usually call [Builder.project] with a well-typed [Project] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun project(project: JsonField) = apply { body.project(project) } + /** The number of tests failing. */ + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) - fun workspace(workspace: Workspace?) = apply { body.workspace(workspace) } + /** + * Sets [Builder.failingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.failingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun failingGoalCount(failingGoalCount: JsonField) = apply { + this.failingGoalCount = failingGoalCount + } - /** Alias for calling [Builder.workspace] with `workspace.orElse(null)`. */ - fun workspace(workspace: Optional) = workspace(workspace.getOrNull()) + fun links(links: Links) = links(JsonField.of(links)) - /** - * Sets [Builder.workspace] to an arbitrary JSON value. - * - * You should usually call [Builder.workspace] with a well-typed [Workspace] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun workspace(workspace: JsonField) = apply { body.workspace(workspace) } + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun links(links: JsonField) = apply { this.links = links } - /** The workspace id. */ - fun workspaceId(workspaceId: String) = apply { body.workspaceId(workspaceId) } + /** The inference pipeline name. */ + fun name(name: String) = name(JsonField.of(name)) - /** - * Sets [Builder.workspaceId] to an arbitrary JSON value. - * - * You should usually call [Builder.workspaceId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun workspaceId(workspaceId: JsonField) = apply { body.workspaceId(workspaceId) } + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } + /** The number of tests passing. */ + fun passingGoalCount(passingGoalCount: Long) = + passingGoalCount(JsonField.of(passingGoalCount)) - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } + /** + * Sets [Builder.passingGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.passingGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun passingGoalCount(passingGoalCount: JsonField) = apply { + this.passingGoalCount = passingGoalCount + } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) + /** The project id. */ + fun bodyProjectId(bodyProjectId: String) = bodyProjectId(JsonField.of(bodyProjectId)) + + /** + * Sets [Builder.bodyProjectId] to an arbitrary JSON value. + * + * You should usually call [Builder.bodyProjectId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun bodyProjectId(bodyProjectId: JsonField) = apply { + this.bodyProjectId = bodyProjectId } - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + /** The status of test evaluation for the inference pipeline. */ + fun status(status: Status) = status(JsonField.of(status)) - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun status(status: JsonField) = apply { this.status = status } - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + /** The status message of test evaluation for the inference pipeline. */ + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.getOrNull()) - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } + /** The total number of tests. */ + fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + /** + * Sets [Builder.totalGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.totalGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount + } - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + fun project(project: Project?) = project(JsonField.ofNullable(project)) - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } + /** Alias for calling [Builder.project] with `project.orElse(null)`. */ + fun project(project: Optional) = project(project.getOrNull()) - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } + /** + * Sets [Builder.project] to an arbitrary JSON value. + * + * You should usually call [Builder.project] with a well-typed [Project] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun project(project: JsonField) = apply { this.project = project } - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + fun workspace(workspace: Workspace?) = workspace(JsonField.ofNullable(workspace)) - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + /** Alias for calling [Builder.workspace] with `workspace.orElse(null)`. */ + fun workspace(workspace: Optional) = workspace(workspace.getOrNull()) - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + /** + * Sets [Builder.workspace] to an arbitrary JSON value. + * + * You should usually call [Builder.workspace] with a well-typed [Workspace] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun workspace(workspace: JsonField) = apply { this.workspace = workspace } - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } + /** The workspace id. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateLastEvaluated() + * .dateLastSampleReceived() + * .dateOfNextEvaluation() + * .dateUpdated() + * .description() + * .failingGoalCount() + * .links() + * .name() + * .passingGoalCount() + * .bodyProjectId() + * .status() + * .statusMessage() + * .totalGoalCount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateLastEvaluated", dateLastEvaluated), + checkRequired("dateLastSampleReceived", dateLastSampleReceived), + checkRequired("dateOfNextEvaluation", dateOfNextEvaluation), + checkRequired("dateUpdated", dateUpdated), + checkRequired("description", description), + checkRequired("failingGoalCount", failingGoalCount), + checkRequired("links", links), + checkRequired("name", name), + checkRequired("passingGoalCount", passingGoalCount), + checkRequired("bodyProjectId", bodyProjectId), + checkRequired("status", status), + checkRequired("statusMessage", statusMessage), + checkRequired("totalGoalCount", totalGoalCount), + project, + workspace, + workspaceId, + additionalProperties.toMutableMap(), + ) } - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } + private var validated: Boolean = false - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) + fun validate(): Body = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateLastEvaluated() + dateLastSampleReceived() + dateOfNextEvaluation() + dateUpdated() + description() + failingGoalCount() + links().validate() + name() + passingGoalCount() + bodyProjectId() + status() + statusMessage() + totalGoalCount() + project().ifPresent { it.validate() } + workspace().ifPresent { it.validate() } + workspaceId() + validated = true } - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) + return /* spotless:off */ other is Body && id == other.id && dateCreated == other.dateCreated && dateLastEvaluated == other.dateLastEvaluated && dateLastSampleReceived == other.dateLastSampleReceived && dateOfNextEvaluation == other.dateOfNextEvaluation && dateUpdated == other.dateUpdated && description == other.description && failingGoalCount == other.failingGoalCount && links == other.links && name == other.name && passingGoalCount == other.passingGoalCount && bodyProjectId == other.bodyProjectId && status == other.status && statusMessage == other.statusMessage && totalGoalCount == other.totalGoalCount && project == other.project && workspace == other.workspace && workspaceId == other.workspaceId && additionalProperties == other.additionalProperties /* spotless:on */ } - /** - * Returns an immutable instance of [InferencePipelineCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .pathProjectId() - * .id() - * .dateCreated() - * .dateLastEvaluated() - * .dateLastSampleReceived() - * .dateOfNextEvaluation() - * .dateUpdated() - * .description() - * .failingGoalCount() - * .links() - * .name() - * .passingGoalCount() - * .bodyProjectId() - * .status() - * .statusMessage() - * .totalGoalCount() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): InferencePipelineCreateParams = - InferencePipelineCreateParams( - checkRequired("pathProjectId", pathProjectId), - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, dateCreated, dateLastEvaluated, dateLastSampleReceived, dateOfNextEvaluation, dateUpdated, description, failingGoalCount, links, name, passingGoalCount, bodyProjectId, status, statusMessage, totalGoalCount, project, workspace, workspaceId, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{id=$id, dateCreated=$dateCreated, dateLastEvaluated=$dateLastEvaluated, dateLastSampleReceived=$dateLastSampleReceived, dateOfNextEvaluation=$dateOfNextEvaluation, dateUpdated=$dateUpdated, description=$description, failingGoalCount=$failingGoalCount, links=$links, name=$name, passingGoalCount=$passingGoalCount, bodyProjectId=$bodyProjectId, status=$status, statusMessage=$statusMessage, totalGoalCount=$totalGoalCount, project=$project, workspace=$workspace, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Links - @JsonCreator private constructor( - @JsonProperty("app") @ExcludeMissing private val app: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val app: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing app: JsonField = JsonMissing.of() + ) : this(app, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -1653,20 +1690,15 @@ private constructor( */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Links = apply { - if (validated) { - return@apply - } - - app() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1738,7 +1770,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): Links = - Links(checkRequired("app", app), additionalProperties.toImmutable()) + Links(checkRequired("app", app), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true } override fun equals(other: Any?): Boolean { @@ -1883,60 +1926,87 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class Project - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("creatorId") - @ExcludeMissing - private val creatorId: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("developmentGoalCount") - @ExcludeMissing - private val developmentGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("goalCount") - @ExcludeMissing - private val goalCount: JsonField = JsonMissing.of(), - @JsonProperty("inferencePipelineCount") - @ExcludeMissing - private val inferencePipelineCount: JsonField = JsonMissing.of(), - @JsonProperty("links") - @ExcludeMissing - private val links: JsonField = JsonMissing.of(), - @JsonProperty("monitoringGoalCount") - @ExcludeMissing - private val monitoringGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("source") - @ExcludeMissing - private val source: JsonField = JsonMissing.of(), - @JsonProperty("taskType") - @ExcludeMissing - private val taskType: JsonField = JsonMissing.of(), - @JsonProperty("versionCount") - @ExcludeMissing - private val versionCount: JsonField = JsonMissing.of(), - @JsonProperty("workspaceId") - @ExcludeMissing - private val workspaceId: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("gitRepo") - @ExcludeMissing - private val gitRepo: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val developmentGoalCount: JsonField, + private val goalCount: JsonField, + private val inferencePipelineCount: JsonField, + private val links: JsonField, + private val monitoringGoalCount: JsonField, + private val name: JsonField, + private val source: JsonField, + private val taskType: JsonField, + private val versionCount: JsonField, + private val workspaceId: JsonField, + private val description: JsonField, + private val gitRepo: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("developmentGoalCount") + @ExcludeMissing + developmentGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("goalCount") + @ExcludeMissing + goalCount: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + inferencePipelineCount: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing links: JsonField = JsonMissing.of(), + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + monitoringGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("source") @ExcludeMissing source: JsonField = JsonMissing.of(), + @JsonProperty("taskType") + @ExcludeMissing + taskType: JsonField = JsonMissing.of(), + @JsonProperty("versionCount") + @ExcludeMissing + versionCount: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("gitRepo") @ExcludeMissing gitRepo: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + developmentGoalCount, + goalCount, + inferencePipelineCount, + links, + monitoringGoalCount, + name, + source, + taskType, + versionCount, + workspaceId, + description, + gitRepo, + mutableMapOf(), + ) + /** * The project id. * @@ -2198,35 +2268,15 @@ private constructor( */ @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Project = apply { - if (validated) { - return@apply - } - - id() - creatorId() - dateCreated() - dateUpdated() - developmentGoalCount() - goalCount() - inferencePipelineCount() - links().validate() - monitoringGoalCount() - name() - source() - taskType() - versionCount() - workspaceId() - description() - gitRepo().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2585,22 +2635,48 @@ private constructor( checkRequired("workspaceId", workspaceId), description, gitRepo, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Project = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + developmentGoalCount() + goalCount() + inferencePipelineCount() + links().validate() + monitoringGoalCount() + name() + source() + taskType() + versionCount() + workspaceId() + description() + gitRepo().ifPresent { it.validate() } + validated = true + } + /** Links to the project. */ - @NoAutoDetect class Links - @JsonCreator private constructor( - @JsonProperty("app") - @ExcludeMissing - private val app: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val app: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing app: JsonField = JsonMissing.of() + ) : this(app, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -2615,20 +2691,15 @@ private constructor( */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Links = apply { - if (validated) { - return@apply - } - - app() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2703,7 +2774,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): Links = - Links(checkRequired("app", app), additionalProperties.toImmutable()) + Links(checkRequired("app", app), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true } override fun equals(other: Any?): Boolean { @@ -2948,50 +3030,67 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class GitRepo - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("dateConnected") - @ExcludeMissing - private val dateConnected: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("gitAccountId") - @ExcludeMissing - private val gitAccountId: JsonField = JsonMissing.of(), - @JsonProperty("gitId") - @ExcludeMissing - private val gitId: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("private") - @ExcludeMissing - private val private_: JsonField = JsonMissing.of(), - @JsonProperty("projectId") - @ExcludeMissing - private val projectId: JsonField = JsonMissing.of(), - @JsonProperty("slug") - @ExcludeMissing - private val slug: JsonField = JsonMissing.of(), - @JsonProperty("url") - @ExcludeMissing - private val url: JsonField = JsonMissing.of(), - @JsonProperty("branch") - @ExcludeMissing - private val branch: JsonField = JsonMissing.of(), - @JsonProperty("rootDir") - @ExcludeMissing - private val rootDir: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val dateConnected: JsonField, + private val dateUpdated: JsonField, + private val gitAccountId: JsonField, + private val gitId: JsonField, + private val name: JsonField, + private val private_: JsonField, + private val projectId: JsonField, + private val slug: JsonField, + private val url: JsonField, + private val branch: JsonField, + private val rootDir: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateConnected") + @ExcludeMissing + dateConnected: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("gitAccountId") + @ExcludeMissing + gitAccountId: JsonField = JsonMissing.of(), + @JsonProperty("gitId") @ExcludeMissing gitId: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("private") + @ExcludeMissing + private_: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("url") @ExcludeMissing url: JsonField = JsonMissing.of(), + @JsonProperty("branch") + @ExcludeMissing + branch: JsonField = JsonMissing.of(), + @JsonProperty("rootDir") + @ExcludeMissing + rootDir: JsonField = JsonMissing.of(), + ) : this( + id, + dateConnected, + dateUpdated, + gitAccountId, + gitId, + name, + private_, + projectId, + slug, + url, + branch, + rootDir, + mutableMapOf(), + ) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -3171,31 +3270,15 @@ private constructor( */ @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): GitRepo = apply { - if (validated) { - return@apply - } - - id() - dateConnected() - dateUpdated() - gitAccountId() - gitId() - name() - private_() - projectId() - slug() - url() - branch() - rootDir() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3452,10 +3535,32 @@ private constructor( checkRequired("url", url), branch, rootDir, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): GitRepo = apply { + if (validated) { + return@apply + } + + id() + dateConnected() + dateUpdated() + gitAccountId() + gitId() + name() + private_() + projectId() + slug() + url() + branch() + rootDir() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3492,60 +3597,89 @@ private constructor( "Project{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, developmentGoalCount=$developmentGoalCount, goalCount=$goalCount, inferencePipelineCount=$inferencePipelineCount, links=$links, monitoringGoalCount=$monitoringGoalCount, name=$name, source=$source, taskType=$taskType, versionCount=$versionCount, workspaceId=$workspaceId, description=$description, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Workspace - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("creatorId") - @ExcludeMissing - private val creatorId: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("inviteCount") - @ExcludeMissing - private val inviteCount: JsonField = JsonMissing.of(), - @JsonProperty("memberCount") - @ExcludeMissing - private val memberCount: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("periodEndDate") - @ExcludeMissing - private val periodEndDate: JsonField = JsonMissing.of(), - @JsonProperty("periodStartDate") - @ExcludeMissing - private val periodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("projectCount") - @ExcludeMissing - private val projectCount: JsonField = JsonMissing.of(), - @JsonProperty("slug") - @ExcludeMissing - private val slug: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("inviteCode") - @ExcludeMissing - private val inviteCode: JsonField = JsonMissing.of(), - @JsonProperty("monthlyUsage") - @ExcludeMissing - private val monthlyUsage: JsonField> = JsonMissing.of(), - @JsonProperty("samlOnlyAccess") - @ExcludeMissing - private val samlOnlyAccess: JsonField = JsonMissing.of(), - @JsonProperty("wildcardDomains") - @ExcludeMissing - private val wildcardDomains: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val inviteCount: JsonField, + private val memberCount: JsonField, + private val name: JsonField, + private val periodEndDate: JsonField, + private val periodStartDate: JsonField, + private val projectCount: JsonField, + private val slug: JsonField, + private val status: JsonField, + private val inviteCode: JsonField, + private val monthlyUsage: JsonField>, + private val samlOnlyAccess: JsonField, + private val wildcardDomains: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("inviteCount") + @ExcludeMissing + inviteCount: JsonField = JsonMissing.of(), + @JsonProperty("memberCount") + @ExcludeMissing + memberCount: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("periodEndDate") + @ExcludeMissing + periodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("periodStartDate") + @ExcludeMissing + periodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("projectCount") + @ExcludeMissing + projectCount: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("inviteCode") + @ExcludeMissing + inviteCode: JsonField = JsonMissing.of(), + @JsonProperty("monthlyUsage") + @ExcludeMissing + monthlyUsage: JsonField> = JsonMissing.of(), + @JsonProperty("samlOnlyAccess") + @ExcludeMissing + samlOnlyAccess: JsonField = JsonMissing.of(), + @JsonProperty("wildcardDomains") + @ExcludeMissing + wildcardDomains: JsonField> = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + inviteCount, + memberCount, + name, + periodEndDate, + periodStartDate, + projectCount, + slug, + status, + inviteCode, + monthlyUsage, + samlOnlyAccess, + wildcardDomains, + mutableMapOf(), + ) + /** * The workspace id. * @@ -3814,35 +3948,15 @@ private constructor( @ExcludeMissing fun _wildcardDomains(): JsonField> = wildcardDomains + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Workspace = apply { - if (validated) { - return@apply - } - - id() - creatorId() - dateCreated() - dateUpdated() - inviteCount() - memberCount() - name() - periodEndDate() - periodStartDate() - projectCount() - slug() - status() - inviteCode() - monthlyUsage().ifPresent { it.forEach { it.validate() } } - samlOnlyAccess() - wildcardDomains() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -4217,10 +4331,36 @@ private constructor( (monthlyUsage ?: JsonMissing.of()).map { it.toImmutable() }, samlOnlyAccess, (wildcardDomains ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Workspace = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + inviteCount() + memberCount() + name() + periodEndDate() + periodStartDate() + projectCount() + slug() + status() + inviteCode() + monthlyUsage().ifPresent { it.forEach { it.validate() } } + samlOnlyAccess() + wildcardDomains() + validated = true + } + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -4359,23 +4499,27 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class MonthlyUsage - @JsonCreator private constructor( - @JsonProperty("executionTimeMs") - @ExcludeMissing - private val executionTimeMs: JsonField = JsonMissing.of(), - @JsonProperty("monthYear") - @ExcludeMissing - private val monthYear: JsonField = JsonMissing.of(), - @JsonProperty("predictionCount") - @ExcludeMissing - private val predictionCount: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val executionTimeMs: JsonField, + private val monthYear: JsonField, + private val predictionCount: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("executionTimeMs") + @ExcludeMissing + executionTimeMs: JsonField = JsonMissing.of(), + @JsonProperty("monthYear") + @ExcludeMissing + monthYear: JsonField = JsonMissing.of(), + @JsonProperty("predictionCount") + @ExcludeMissing + predictionCount: JsonField = JsonMissing.of(), + ) : this(executionTimeMs, monthYear, predictionCount, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -4427,22 +4571,15 @@ private constructor( @ExcludeMissing fun _predictionCount(): JsonField = predictionCount + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): MonthlyUsage = apply { - if (validated) { - return@apply - } - - executionTimeMs() - monthYear() - predictionCount() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -4555,10 +4692,23 @@ private constructor( executionTimeMs, monthYear, predictionCount, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): MonthlyUsage = apply { + if (validated) { + return@apply + } + + executionTimeMs() + monthYear() + predictionCount() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt index acca9b95..332de897 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt @@ -11,73 +11,106 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired -import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.LocalDate import java.time.OffsetDateTime +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -@NoAutoDetect class InferencePipelineCreateResponse -@JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateLastEvaluated") - @ExcludeMissing - private val dateLastEvaluated: JsonField = JsonMissing.of(), - @JsonProperty("dateLastSampleReceived") - @ExcludeMissing - private val dateLastSampleReceived: JsonField = JsonMissing.of(), - @JsonProperty("dateOfNextEvaluation") - @ExcludeMissing - private val dateOfNextEvaluation: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("failingGoalCount") - @ExcludeMissing - private val failingGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("links") @ExcludeMissing private val links: JsonField = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), - @JsonProperty("passingGoalCount") - @ExcludeMissing - private val passingGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("projectId") - @ExcludeMissing - private val projectId: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("statusMessage") - @ExcludeMissing - private val statusMessage: JsonField = JsonMissing.of(), - @JsonProperty("totalGoalCount") - @ExcludeMissing - private val totalGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("project") - @ExcludeMissing - private val project: JsonField = JsonMissing.of(), - @JsonProperty("workspace") - @ExcludeMissing - private val workspace: JsonField = JsonMissing.of(), - @JsonProperty("workspaceId") - @ExcludeMissing - private val workspaceId: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val dateCreated: JsonField, + private val dateLastEvaluated: JsonField, + private val dateLastSampleReceived: JsonField, + private val dateOfNextEvaluation: JsonField, + private val dateUpdated: JsonField, + private val description: JsonField, + private val failingGoalCount: JsonField, + private val links: JsonField, + private val name: JsonField, + private val passingGoalCount: JsonField, + private val projectId: JsonField, + private val status: JsonField, + private val statusMessage: JsonField, + private val totalGoalCount: JsonField, + private val project: JsonField, + private val workspace: JsonField, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastSampleReceived") + @ExcludeMissing + dateLastSampleReceived: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("failingGoalCount") + @ExcludeMissing + failingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing links: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("passingGoalCount") + @ExcludeMissing + passingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("projectId") @ExcludeMissing projectId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("totalGoalCount") + @ExcludeMissing + totalGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("project") @ExcludeMissing project: JsonField = JsonMissing.of(), + @JsonProperty("workspace") + @ExcludeMissing + workspace: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateLastEvaluated, + dateLastSampleReceived, + dateOfNextEvaluation, + dateUpdated, + description, + failingGoalCount, + links, + name, + passingGoalCount, + projectId, + status, + statusMessage, + totalGoalCount, + project, + workspace, + workspaceId, + mutableMapOf(), + ) + /** * The inference pipeline id. * @@ -371,37 +404,15 @@ private constructor( */ @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): InferencePipelineCreateResponse = apply { - if (validated) { - return@apply - } - - id() - dateCreated() - dateLastEvaluated() - dateLastSampleReceived() - dateOfNextEvaluation() - dateUpdated() - description() - failingGoalCount() - links().validate() - name() - passingGoalCount() - projectId() - status() - statusMessage() - totalGoalCount() - project().ifPresent { it.validate() } - workspace().ifPresent { it.validate() } - workspaceId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -809,19 +820,49 @@ private constructor( project, workspace, workspaceId, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): InferencePipelineCreateResponse = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateLastEvaluated() + dateLastSampleReceived() + dateOfNextEvaluation() + dateUpdated() + description() + failingGoalCount() + links().validate() + name() + passingGoalCount() + projectId() + status() + statusMessage() + totalGoalCount() + project().ifPresent { it.validate() } + workspace().ifPresent { it.validate() } + workspaceId() + validated = true + } + class Links - @JsonCreator private constructor( - @JsonProperty("app") @ExcludeMissing private val app: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val app: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing app: JsonField = JsonMissing.of() + ) : this(app, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -835,20 +876,15 @@ private constructor( */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Links = apply { - if (validated) { - return@apply - } - - app() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -920,7 +956,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): Links = - Links(checkRequired("app", app), additionalProperties.toImmutable()) + Links(checkRequired("app", app), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true } override fun equals(other: Any?): Boolean { @@ -1065,60 +1112,87 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class Project - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("creatorId") - @ExcludeMissing - private val creatorId: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("developmentGoalCount") - @ExcludeMissing - private val developmentGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("goalCount") - @ExcludeMissing - private val goalCount: JsonField = JsonMissing.of(), - @JsonProperty("inferencePipelineCount") - @ExcludeMissing - private val inferencePipelineCount: JsonField = JsonMissing.of(), - @JsonProperty("links") - @ExcludeMissing - private val links: JsonField = JsonMissing.of(), - @JsonProperty("monitoringGoalCount") - @ExcludeMissing - private val monitoringGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("source") - @ExcludeMissing - private val source: JsonField = JsonMissing.of(), - @JsonProperty("taskType") - @ExcludeMissing - private val taskType: JsonField = JsonMissing.of(), - @JsonProperty("versionCount") - @ExcludeMissing - private val versionCount: JsonField = JsonMissing.of(), - @JsonProperty("workspaceId") - @ExcludeMissing - private val workspaceId: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("gitRepo") - @ExcludeMissing - private val gitRepo: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val developmentGoalCount: JsonField, + private val goalCount: JsonField, + private val inferencePipelineCount: JsonField, + private val links: JsonField, + private val monitoringGoalCount: JsonField, + private val name: JsonField, + private val source: JsonField, + private val taskType: JsonField, + private val versionCount: JsonField, + private val workspaceId: JsonField, + private val description: JsonField, + private val gitRepo: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("developmentGoalCount") + @ExcludeMissing + developmentGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("goalCount") + @ExcludeMissing + goalCount: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + inferencePipelineCount: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing links: JsonField = JsonMissing.of(), + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + monitoringGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("source") @ExcludeMissing source: JsonField = JsonMissing.of(), + @JsonProperty("taskType") + @ExcludeMissing + taskType: JsonField = JsonMissing.of(), + @JsonProperty("versionCount") + @ExcludeMissing + versionCount: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("gitRepo") @ExcludeMissing gitRepo: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + developmentGoalCount, + goalCount, + inferencePipelineCount, + links, + monitoringGoalCount, + name, + source, + taskType, + versionCount, + workspaceId, + description, + gitRepo, + mutableMapOf(), + ) + /** * The project id. * @@ -1380,35 +1454,15 @@ private constructor( */ @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Project = apply { - if (validated) { - return@apply - } - - id() - creatorId() - dateCreated() - dateUpdated() - developmentGoalCount() - goalCount() - inferencePipelineCount() - links().validate() - monitoringGoalCount() - name() - source() - taskType() - versionCount() - workspaceId() - description() - gitRepo().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1767,22 +1821,48 @@ private constructor( checkRequired("workspaceId", workspaceId), description, gitRepo, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Project = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + developmentGoalCount() + goalCount() + inferencePipelineCount() + links().validate() + monitoringGoalCount() + name() + source() + taskType() + versionCount() + workspaceId() + description() + gitRepo().ifPresent { it.validate() } + validated = true + } + /** Links to the project. */ - @NoAutoDetect class Links - @JsonCreator private constructor( - @JsonProperty("app") - @ExcludeMissing - private val app: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val app: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing app: JsonField = JsonMissing.of() + ) : this(app, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -1797,20 +1877,15 @@ private constructor( */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Links = apply { - if (validated) { - return@apply - } - - app() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1885,7 +1960,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): Links = - Links(checkRequired("app", app), additionalProperties.toImmutable()) + Links(checkRequired("app", app), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true } override fun equals(other: Any?): Boolean { @@ -2130,50 +2216,67 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class GitRepo - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("dateConnected") - @ExcludeMissing - private val dateConnected: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("gitAccountId") - @ExcludeMissing - private val gitAccountId: JsonField = JsonMissing.of(), - @JsonProperty("gitId") - @ExcludeMissing - private val gitId: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("private") - @ExcludeMissing - private val private_: JsonField = JsonMissing.of(), - @JsonProperty("projectId") - @ExcludeMissing - private val projectId: JsonField = JsonMissing.of(), - @JsonProperty("slug") - @ExcludeMissing - private val slug: JsonField = JsonMissing.of(), - @JsonProperty("url") - @ExcludeMissing - private val url: JsonField = JsonMissing.of(), - @JsonProperty("branch") - @ExcludeMissing - private val branch: JsonField = JsonMissing.of(), - @JsonProperty("rootDir") - @ExcludeMissing - private val rootDir: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val dateConnected: JsonField, + private val dateUpdated: JsonField, + private val gitAccountId: JsonField, + private val gitId: JsonField, + private val name: JsonField, + private val private_: JsonField, + private val projectId: JsonField, + private val slug: JsonField, + private val url: JsonField, + private val branch: JsonField, + private val rootDir: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateConnected") + @ExcludeMissing + dateConnected: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("gitAccountId") + @ExcludeMissing + gitAccountId: JsonField = JsonMissing.of(), + @JsonProperty("gitId") @ExcludeMissing gitId: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("private") + @ExcludeMissing + private_: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("url") @ExcludeMissing url: JsonField = JsonMissing.of(), + @JsonProperty("branch") + @ExcludeMissing + branch: JsonField = JsonMissing.of(), + @JsonProperty("rootDir") + @ExcludeMissing + rootDir: JsonField = JsonMissing.of(), + ) : this( + id, + dateConnected, + dateUpdated, + gitAccountId, + gitId, + name, + private_, + projectId, + slug, + url, + branch, + rootDir, + mutableMapOf(), + ) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -2353,31 +2456,15 @@ private constructor( */ @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): GitRepo = apply { - if (validated) { - return@apply - } - - id() - dateConnected() - dateUpdated() - gitAccountId() - gitId() - name() - private_() - projectId() - slug() - url() - branch() - rootDir() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2634,10 +2721,32 @@ private constructor( checkRequired("url", url), branch, rootDir, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): GitRepo = apply { + if (validated) { + return@apply + } + + id() + dateConnected() + dateUpdated() + gitAccountId() + gitId() + name() + private_() + projectId() + slug() + url() + branch() + rootDir() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2674,60 +2783,89 @@ private constructor( "Project{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, developmentGoalCount=$developmentGoalCount, goalCount=$goalCount, inferencePipelineCount=$inferencePipelineCount, links=$links, monitoringGoalCount=$monitoringGoalCount, name=$name, source=$source, taskType=$taskType, versionCount=$versionCount, workspaceId=$workspaceId, description=$description, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Workspace - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("creatorId") - @ExcludeMissing - private val creatorId: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("inviteCount") - @ExcludeMissing - private val inviteCount: JsonField = JsonMissing.of(), - @JsonProperty("memberCount") - @ExcludeMissing - private val memberCount: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("periodEndDate") - @ExcludeMissing - private val periodEndDate: JsonField = JsonMissing.of(), - @JsonProperty("periodStartDate") - @ExcludeMissing - private val periodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("projectCount") - @ExcludeMissing - private val projectCount: JsonField = JsonMissing.of(), - @JsonProperty("slug") - @ExcludeMissing - private val slug: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("inviteCode") - @ExcludeMissing - private val inviteCode: JsonField = JsonMissing.of(), - @JsonProperty("monthlyUsage") - @ExcludeMissing - private val monthlyUsage: JsonField> = JsonMissing.of(), - @JsonProperty("samlOnlyAccess") - @ExcludeMissing - private val samlOnlyAccess: JsonField = JsonMissing.of(), - @JsonProperty("wildcardDomains") - @ExcludeMissing - private val wildcardDomains: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val inviteCount: JsonField, + private val memberCount: JsonField, + private val name: JsonField, + private val periodEndDate: JsonField, + private val periodStartDate: JsonField, + private val projectCount: JsonField, + private val slug: JsonField, + private val status: JsonField, + private val inviteCode: JsonField, + private val monthlyUsage: JsonField>, + private val samlOnlyAccess: JsonField, + private val wildcardDomains: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("inviteCount") + @ExcludeMissing + inviteCount: JsonField = JsonMissing.of(), + @JsonProperty("memberCount") + @ExcludeMissing + memberCount: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("periodEndDate") + @ExcludeMissing + periodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("periodStartDate") + @ExcludeMissing + periodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("projectCount") + @ExcludeMissing + projectCount: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("inviteCode") + @ExcludeMissing + inviteCode: JsonField = JsonMissing.of(), + @JsonProperty("monthlyUsage") + @ExcludeMissing + monthlyUsage: JsonField> = JsonMissing.of(), + @JsonProperty("samlOnlyAccess") + @ExcludeMissing + samlOnlyAccess: JsonField = JsonMissing.of(), + @JsonProperty("wildcardDomains") + @ExcludeMissing + wildcardDomains: JsonField> = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + inviteCount, + memberCount, + name, + periodEndDate, + periodStartDate, + projectCount, + slug, + status, + inviteCode, + monthlyUsage, + samlOnlyAccess, + wildcardDomains, + mutableMapOf(), + ) + /** * The workspace id. * @@ -2996,35 +3134,15 @@ private constructor( @ExcludeMissing fun _wildcardDomains(): JsonField> = wildcardDomains + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Workspace = apply { - if (validated) { - return@apply - } - - id() - creatorId() - dateCreated() - dateUpdated() - inviteCount() - memberCount() - name() - periodEndDate() - periodStartDate() - projectCount() - slug() - status() - inviteCode() - monthlyUsage().ifPresent { it.forEach { it.validate() } } - samlOnlyAccess() - wildcardDomains() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3399,10 +3517,36 @@ private constructor( (monthlyUsage ?: JsonMissing.of()).map { it.toImmutable() }, samlOnlyAccess, (wildcardDomains ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Workspace = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + inviteCount() + memberCount() + name() + periodEndDate() + periodStartDate() + projectCount() + slug() + status() + inviteCode() + monthlyUsage().ifPresent { it.forEach { it.validate() } } + samlOnlyAccess() + wildcardDomains() + validated = true + } + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -3541,23 +3685,27 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class MonthlyUsage - @JsonCreator private constructor( - @JsonProperty("executionTimeMs") - @ExcludeMissing - private val executionTimeMs: JsonField = JsonMissing.of(), - @JsonProperty("monthYear") - @ExcludeMissing - private val monthYear: JsonField = JsonMissing.of(), - @JsonProperty("predictionCount") - @ExcludeMissing - private val predictionCount: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val executionTimeMs: JsonField, + private val monthYear: JsonField, + private val predictionCount: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("executionTimeMs") + @ExcludeMissing + executionTimeMs: JsonField = JsonMissing.of(), + @JsonProperty("monthYear") + @ExcludeMissing + monthYear: JsonField = JsonMissing.of(), + @JsonProperty("predictionCount") + @ExcludeMissing + predictionCount: JsonField = JsonMissing.of(), + ) : this(executionTimeMs, monthYear, predictionCount, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -3609,22 +3757,15 @@ private constructor( @ExcludeMissing fun _predictionCount(): JsonField = predictionCount + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): MonthlyUsage = apply { - if (validated) { - return@apply - } - - executionTimeMs() - monthYear() - predictionCount() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3737,10 +3878,23 @@ private constructor( executionTimeMs, monthYear, predictionCount, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): MonthlyUsage = apply { + if (validated) { + return@apply + } + + executionTimeMs() + monthYear() + predictionCount() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt index 8516051d..298de86b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListParams.kt @@ -2,7 +2,6 @@ package com.openlayer.api.models.projects.inferencepipelines -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers @@ -37,24 +36,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _pathParam(index: Int): String = - when (index) { - 0 -> projectId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - name?.let { put("name", it) } - page?.let { put("page", it.toString()) } - perPage?.let { put("perPage", it.toString()) } - putAll(additionalQueryParams) - } - .build() - fun toBuilder() = Builder().from(this) companion object { @@ -71,7 +52,6 @@ private constructor( } /** A builder for [InferencePipelineListParams]. */ - @NoAutoDetect class Builder internal constructor() { private var projectId: String? = null @@ -246,6 +226,24 @@ private constructor( ) } + fun _pathParam(index: Int): String = + when (index) { + 0 -> projectId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + name?.let { put("name", it) } + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + putAll(additionalQueryParams) + } + .build() + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt index 459a7b75..829158de 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt @@ -11,28 +11,28 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired -import com.openlayer.api.core.immutableEmptyMap import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.LocalDate import java.time.OffsetDateTime +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -@NoAutoDetect class InferencePipelineListResponse -@JsonCreator private constructor( - @JsonProperty("items") - @ExcludeMissing - private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val items: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -46,20 +46,15 @@ private constructor( */ @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): InferencePipelineListResponse = apply { - if (validated) { - return@apply - } - - items().forEach { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -146,70 +141,112 @@ private constructor( fun build(): InferencePipelineListResponse = InferencePipelineListResponse( checkRequired("items", items).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): InferencePipelineListResponse = apply { + if (validated) { + return@apply + } + + items().forEach { it.validate() } + validated = true + } + class Item - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateLastEvaluated") - @ExcludeMissing - private val dateLastEvaluated: JsonField = JsonMissing.of(), - @JsonProperty("dateLastSampleReceived") - @ExcludeMissing - private val dateLastSampleReceived: JsonField = JsonMissing.of(), - @JsonProperty("dateOfNextEvaluation") - @ExcludeMissing - private val dateOfNextEvaluation: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("failingGoalCount") - @ExcludeMissing - private val failingGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("links") - @ExcludeMissing - private val links: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("passingGoalCount") - @ExcludeMissing - private val passingGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("projectId") - @ExcludeMissing - private val projectId: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("statusMessage") - @ExcludeMissing - private val statusMessage: JsonField = JsonMissing.of(), - @JsonProperty("totalGoalCount") - @ExcludeMissing - private val totalGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("project") - @ExcludeMissing - private val project: JsonField = JsonMissing.of(), - @JsonProperty("workspace") - @ExcludeMissing - private val workspace: JsonField = JsonMissing.of(), - @JsonProperty("workspaceId") - @ExcludeMissing - private val workspaceId: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val dateCreated: JsonField, + private val dateLastEvaluated: JsonField, + private val dateLastSampleReceived: JsonField, + private val dateOfNextEvaluation: JsonField, + private val dateUpdated: JsonField, + private val description: JsonField, + private val failingGoalCount: JsonField, + private val links: JsonField, + private val name: JsonField, + private val passingGoalCount: JsonField, + private val projectId: JsonField, + private val status: JsonField, + private val statusMessage: JsonField, + private val totalGoalCount: JsonField, + private val project: JsonField, + private val workspace: JsonField, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateLastSampleReceived") + @ExcludeMissing + dateLastSampleReceived: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("failingGoalCount") + @ExcludeMissing + failingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing links: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("passingGoalCount") + @ExcludeMissing + passingGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + @JsonProperty("totalGoalCount") + @ExcludeMissing + totalGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("project") @ExcludeMissing project: JsonField = JsonMissing.of(), + @JsonProperty("workspace") + @ExcludeMissing + workspace: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateLastEvaluated, + dateLastSampleReceived, + dateOfNextEvaluation, + dateUpdated, + description, + failingGoalCount, + links, + name, + passingGoalCount, + projectId, + status, + statusMessage, + totalGoalCount, + project, + workspace, + workspaceId, + mutableMapOf(), + ) + /** * The inference pipeline id. * @@ -512,37 +549,15 @@ private constructor( @ExcludeMissing fun _workspaceId(): JsonField = workspaceId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Item = apply { - if (validated) { - return@apply - } - - id() - dateCreated() - dateLastEvaluated() - dateLastSampleReceived() - dateOfNextEvaluation() - dateUpdated() - description() - failingGoalCount() - links().validate() - name() - passingGoalCount() - projectId() - status() - statusMessage() - totalGoalCount() - project().ifPresent { it.validate() } - workspace().ifPresent { it.validate() } - workspaceId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -958,21 +973,49 @@ private constructor( project, workspace, workspaceId, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateLastEvaluated() + dateLastSampleReceived() + dateOfNextEvaluation() + dateUpdated() + description() + failingGoalCount() + links().validate() + name() + passingGoalCount() + projectId() + status() + statusMessage() + totalGoalCount() + project().ifPresent { it.validate() } + workspace().ifPresent { it.validate() } + workspaceId() + validated = true + } + class Links - @JsonCreator private constructor( - @JsonProperty("app") - @ExcludeMissing - private val app: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val app: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing app: JsonField = JsonMissing.of() + ) : this(app, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -987,20 +1030,15 @@ private constructor( */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Links = apply { - if (validated) { - return@apply - } - - app() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1075,7 +1113,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): Links = - Links(checkRequired("app", app), additionalProperties.toImmutable()) + Links(checkRequired("app", app), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true } override fun equals(other: Any?): Boolean { @@ -1222,62 +1271,91 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class Project - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("creatorId") - @ExcludeMissing - private val creatorId: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("developmentGoalCount") - @ExcludeMissing - private val developmentGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("goalCount") - @ExcludeMissing - private val goalCount: JsonField = JsonMissing.of(), - @JsonProperty("inferencePipelineCount") - @ExcludeMissing - private val inferencePipelineCount: JsonField = JsonMissing.of(), - @JsonProperty("links") - @ExcludeMissing - private val links: JsonField = JsonMissing.of(), - @JsonProperty("monitoringGoalCount") - @ExcludeMissing - private val monitoringGoalCount: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("source") - @ExcludeMissing - private val source: JsonField = JsonMissing.of(), - @JsonProperty("taskType") - @ExcludeMissing - private val taskType: JsonField = JsonMissing.of(), - @JsonProperty("versionCount") - @ExcludeMissing - private val versionCount: JsonField = JsonMissing.of(), - @JsonProperty("workspaceId") - @ExcludeMissing - private val workspaceId: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("gitRepo") - @ExcludeMissing - private val gitRepo: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val developmentGoalCount: JsonField, + private val goalCount: JsonField, + private val inferencePipelineCount: JsonField, + private val links: JsonField, + private val monitoringGoalCount: JsonField, + private val name: JsonField, + private val source: JsonField, + private val taskType: JsonField, + private val versionCount: JsonField, + private val workspaceId: JsonField, + private val description: JsonField, + private val gitRepo: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("developmentGoalCount") + @ExcludeMissing + developmentGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("goalCount") + @ExcludeMissing + goalCount: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + inferencePipelineCount: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing links: JsonField = JsonMissing.of(), + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + monitoringGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("source") + @ExcludeMissing + source: JsonField = JsonMissing.of(), + @JsonProperty("taskType") + @ExcludeMissing + taskType: JsonField = JsonMissing.of(), + @JsonProperty("versionCount") + @ExcludeMissing + versionCount: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("gitRepo") + @ExcludeMissing + gitRepo: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + developmentGoalCount, + goalCount, + inferencePipelineCount, + links, + monitoringGoalCount, + name, + source, + taskType, + versionCount, + workspaceId, + description, + gitRepo, + mutableMapOf(), + ) + /** * The project id. * @@ -1563,35 +1641,15 @@ private constructor( */ @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Project = apply { - if (validated) { - return@apply - } - - id() - creatorId() - dateCreated() - dateUpdated() - developmentGoalCount() - goalCount() - inferencePipelineCount() - links().validate() - monitoringGoalCount() - name() - source() - taskType() - versionCount() - workspaceId() - description() - gitRepo().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1959,22 +2017,48 @@ private constructor( checkRequired("workspaceId", workspaceId), description, gitRepo, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Project = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + developmentGoalCount() + goalCount() + inferencePipelineCount() + links().validate() + monitoringGoalCount() + name() + source() + taskType() + versionCount() + workspaceId() + description() + gitRepo().ifPresent { it.validate() } + validated = true + } + /** Links to the project. */ - @NoAutoDetect class Links - @JsonCreator private constructor( - @JsonProperty("app") - @ExcludeMissing - private val app: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val app: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing app: JsonField = JsonMissing.of() + ) : this(app, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or * is unexpectedly missing or null (e.g. if the server responded with an @@ -1989,20 +2073,15 @@ private constructor( */ @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Links = apply { - if (validated) { - return@apply - } - - app() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2077,7 +2156,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): Links = - Links(checkRequired("app", app), additionalProperties.toImmutable()) + Links(checkRequired("app", app), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true } override fun equals(other: Any?): Boolean { @@ -2326,50 +2416,73 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class GitRepo - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("dateConnected") - @ExcludeMissing - private val dateConnected: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("gitAccountId") - @ExcludeMissing - private val gitAccountId: JsonField = JsonMissing.of(), - @JsonProperty("gitId") - @ExcludeMissing - private val gitId: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("private") - @ExcludeMissing - private val private_: JsonField = JsonMissing.of(), - @JsonProperty("projectId") - @ExcludeMissing - private val projectId: JsonField = JsonMissing.of(), - @JsonProperty("slug") - @ExcludeMissing - private val slug: JsonField = JsonMissing.of(), - @JsonProperty("url") - @ExcludeMissing - private val url: JsonField = JsonMissing.of(), - @JsonProperty("branch") - @ExcludeMissing - private val branch: JsonField = JsonMissing.of(), - @JsonProperty("rootDir") - @ExcludeMissing - private val rootDir: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val dateConnected: JsonField, + private val dateUpdated: JsonField, + private val gitAccountId: JsonField, + private val gitId: JsonField, + private val name: JsonField, + private val private_: JsonField, + private val projectId: JsonField, + private val slug: JsonField, + private val url: JsonField, + private val branch: JsonField, + private val rootDir: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateConnected") + @ExcludeMissing + dateConnected: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("gitAccountId") + @ExcludeMissing + gitAccountId: JsonField = JsonMissing.of(), + @JsonProperty("gitId") + @ExcludeMissing + gitId: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + @JsonProperty("private") + @ExcludeMissing + private_: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("slug") + @ExcludeMissing + slug: JsonField = JsonMissing.of(), + @JsonProperty("url") @ExcludeMissing url: JsonField = JsonMissing.of(), + @JsonProperty("branch") + @ExcludeMissing + branch: JsonField = JsonMissing.of(), + @JsonProperty("rootDir") + @ExcludeMissing + rootDir: JsonField = JsonMissing.of(), + ) : this( + id, + dateConnected, + dateUpdated, + gitAccountId, + gitId, + name, + private_, + projectId, + slug, + url, + branch, + rootDir, + mutableMapOf(), + ) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or * is unexpectedly missing or null (e.g. if the server responded with an @@ -2557,31 +2670,15 @@ private constructor( */ @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): GitRepo = apply { - if (validated) { - return@apply - } - - id() - dateConnected() - dateUpdated() - gitAccountId() - gitId() - name() - private_() - projectId() - slug() - url() - branch() - rootDir() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2841,10 +2938,32 @@ private constructor( checkRequired("url", url), branch, rootDir, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): GitRepo = apply { + if (validated) { + return@apply + } + + id() + dateConnected() + dateUpdated() + gitAccountId() + gitId() + name() + private_() + projectId() + slug() + url() + branch() + rootDir() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2881,62 +3000,91 @@ private constructor( "Project{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, developmentGoalCount=$developmentGoalCount, goalCount=$goalCount, inferencePipelineCount=$inferencePipelineCount, links=$links, monitoringGoalCount=$monitoringGoalCount, name=$name, source=$source, taskType=$taskType, versionCount=$versionCount, workspaceId=$workspaceId, description=$description, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Workspace - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("creatorId") - @ExcludeMissing - private val creatorId: JsonField = JsonMissing.of(), - @JsonProperty("dateCreated") - @ExcludeMissing - private val dateCreated: JsonField = JsonMissing.of(), - @JsonProperty("dateUpdated") - @ExcludeMissing - private val dateUpdated: JsonField = JsonMissing.of(), - @JsonProperty("inviteCount") - @ExcludeMissing - private val inviteCount: JsonField = JsonMissing.of(), - @JsonProperty("memberCount") - @ExcludeMissing - private val memberCount: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("periodEndDate") - @ExcludeMissing - private val periodEndDate: JsonField = JsonMissing.of(), - @JsonProperty("periodStartDate") - @ExcludeMissing - private val periodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("projectCount") - @ExcludeMissing - private val projectCount: JsonField = JsonMissing.of(), - @JsonProperty("slug") - @ExcludeMissing - private val slug: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("inviteCode") - @ExcludeMissing - private val inviteCode: JsonField = JsonMissing.of(), - @JsonProperty("monthlyUsage") - @ExcludeMissing - private val monthlyUsage: JsonField> = JsonMissing.of(), - @JsonProperty("samlOnlyAccess") - @ExcludeMissing - private val samlOnlyAccess: JsonField = JsonMissing.of(), - @JsonProperty("wildcardDomains") - @ExcludeMissing - private val wildcardDomains: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val inviteCount: JsonField, + private val memberCount: JsonField, + private val name: JsonField, + private val periodEndDate: JsonField, + private val periodStartDate: JsonField, + private val projectCount: JsonField, + private val slug: JsonField, + private val status: JsonField, + private val inviteCode: JsonField, + private val monthlyUsage: JsonField>, + private val samlOnlyAccess: JsonField, + private val wildcardDomains: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("inviteCount") + @ExcludeMissing + inviteCount: JsonField = JsonMissing.of(), + @JsonProperty("memberCount") + @ExcludeMissing + memberCount: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("periodEndDate") + @ExcludeMissing + periodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("periodStartDate") + @ExcludeMissing + periodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("projectCount") + @ExcludeMissing + projectCount: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + status: JsonField = JsonMissing.of(), + @JsonProperty("inviteCode") + @ExcludeMissing + inviteCode: JsonField = JsonMissing.of(), + @JsonProperty("monthlyUsage") + @ExcludeMissing + monthlyUsage: JsonField> = JsonMissing.of(), + @JsonProperty("samlOnlyAccess") + @ExcludeMissing + samlOnlyAccess: JsonField = JsonMissing.of(), + @JsonProperty("wildcardDomains") + @ExcludeMissing + wildcardDomains: JsonField> = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + inviteCount, + memberCount, + name, + periodEndDate, + periodStartDate, + projectCount, + slug, + status, + inviteCode, + monthlyUsage, + samlOnlyAccess, + wildcardDomains, + mutableMapOf(), + ) + /** * The workspace id. * @@ -3223,35 +3371,15 @@ private constructor( @ExcludeMissing fun _wildcardDomains(): JsonField> = wildcardDomains + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Workspace = apply { - if (validated) { - return@apply - } - - id() - creatorId() - dateCreated() - dateUpdated() - inviteCount() - memberCount() - name() - periodEndDate() - periodStartDate() - projectCount() - slug() - status() - inviteCode() - monthlyUsage().ifPresent { it.forEach { it.validate() } } - samlOnlyAccess() - wildcardDomains() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3639,10 +3767,36 @@ private constructor( (monthlyUsage ?: JsonMissing.of()).map { it.toImmutable() }, samlOnlyAccess, (wildcardDomains ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Workspace = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + inviteCount() + memberCount() + name() + periodEndDate() + periodStartDate() + projectCount() + slug() + status() + inviteCode() + monthlyUsage().ifPresent { it.forEach { it.validate() } } + samlOnlyAccess() + wildcardDomains() + validated = true + } + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -3783,23 +3937,27 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class MonthlyUsage - @JsonCreator private constructor( - @JsonProperty("executionTimeMs") - @ExcludeMissing - private val executionTimeMs: JsonField = JsonMissing.of(), - @JsonProperty("monthYear") - @ExcludeMissing - private val monthYear: JsonField = JsonMissing.of(), - @JsonProperty("predictionCount") - @ExcludeMissing - private val predictionCount: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val executionTimeMs: JsonField, + private val monthYear: JsonField, + private val predictionCount: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("executionTimeMs") + @ExcludeMissing + executionTimeMs: JsonField = JsonMissing.of(), + @JsonProperty("monthYear") + @ExcludeMissing + monthYear: JsonField = JsonMissing.of(), + @JsonProperty("predictionCount") + @ExcludeMissing + predictionCount: JsonField = JsonMissing.of(), + ) : this(executionTimeMs, monthYear, predictionCount, mutableMapOf()) + /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -3851,22 +4009,15 @@ private constructor( @ExcludeMissing fun _predictionCount(): JsonField = predictionCount + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): MonthlyUsage = apply { - if (validated) { - return@apply - } - - executionTimeMs() - monthYear() - predictionCount() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3980,10 +4131,23 @@ private constructor( executionTimeMs, monthYear, predictionCount, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): MonthlyUsage = apply { + if (validated) { + return@apply + } + + executionTimeMs() + monthYear() + predictionCount() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt index 95f39b35..9f5a3d75 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt @@ -2,13 +2,15 @@ package com.openlayer.api.models.storage.presignedurl +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams -import com.openlayer.api.core.toImmutable +import java.util.Collections import java.util.Objects import java.util.Optional @@ -18,7 +20,7 @@ private constructor( private val objectName: String, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, + private val additionalBodyProperties: MutableMap, ) : Params { /** The name of the object. */ @@ -28,21 +30,15 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun _body(): Optional> = - Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - - override fun _headers(): Headers = additionalHeaders + @JsonAnySetter + private fun putAdditionalBodyProperty(key: String, value: JsonValue) { + additionalBodyProperties.put(key, value) + } - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - put("objectName", objectName) - putAll(additionalQueryParams) - } - .build() + @JsonAnyGetter + @ExcludeMissing + fun _additionalBodyProperties(): Map = + Collections.unmodifiableMap(additionalBodyProperties) fun toBuilder() = Builder().from(this) @@ -60,7 +56,6 @@ private constructor( } /** A builder for [PresignedUrlCreateParams]. */ - @NoAutoDetect class Builder internal constructor() { private var objectName: String? = null @@ -217,10 +212,24 @@ private constructor( checkRequired("objectName", objectName), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), + additionalBodyProperties.toMutableMap(), ) } + @JvmSynthetic + internal fun _body(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + put("objectName", objectName) + putAll(additionalQueryParams) + } + .build() + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt index 94e76f11..5cdbc35e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt @@ -10,25 +10,28 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.checkRequired -import com.openlayer.api.core.immutableEmptyMap -import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections import java.util.Objects -@NoAutoDetect class PresignedUrlCreateResponse -@JsonCreator private constructor( - @JsonProperty("storageUri") - @ExcludeMissing - private val storageUri: JsonField = JsonMissing.of(), - @JsonProperty("url") @ExcludeMissing private val url: JsonField = JsonMissing.of(), - @JsonProperty("fields") @ExcludeMissing private val fields: JsonValue = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val storageUri: JsonField, + private val url: JsonField, + private val fields: JsonValue, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("storageUri") + @ExcludeMissing + storageUri: JsonField = JsonMissing.of(), + @JsonProperty("url") @ExcludeMissing url: JsonField = JsonMissing.of(), + @JsonProperty("fields") @ExcludeMissing fields: JsonValue = JsonMissing.of(), + ) : this(storageUri, url, fields, mutableMapOf()) + /** * The storage URI to send back to the backend after the upload was completed. * @@ -62,21 +65,15 @@ private constructor( */ @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PresignedUrlCreateResponse = apply { - if (validated) { - return@apply - } - - storageUri() - url() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -173,10 +170,22 @@ private constructor( checkRequired("storageUri", storageUri), checkRequired("url", url), fields, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): PresignedUrlCreateResponse = apply { + if (validated) { + return@apply + } + + storageUri() + url() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt index 1e6f107d..5c067675 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt @@ -11,7 +11,6 @@ import org.junit.jupiter.api.Test internal class SerializerTest { @JsonDeserialize(builder = ClassWithBooleanFieldPrefixedWithIs.Builder::class) - @NoAutoDetect class ClassWithBooleanFieldPrefixedWithIs private constructor( private val isActive: JsonField, @@ -60,7 +59,6 @@ internal class SerializerTest { fun builder() = Builder() } - @NoAutoDetect class Builder internal constructor() { private var isActive: JsonField = JsonMissing.of() From 301b38da90a6d273a3673f0b08636b252e571d86 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Mar 2025 03:59:18 +0000 Subject: [PATCH 34/74] codegen metadata --- .stats.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.stats.yml b/.stats.yml index c2549479..5fc516db 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1,3 @@ configured_endpoints: 15 +openapi_spec_hash: 9a0b363025305f6b086bcdfe43274830 +config_hash: 21fb9730d1cdc9e3fd38724c4774b894 From 17fc1d796ea7b17d34c0b14374fff3420a14397e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Mar 2025 04:20:56 +0000 Subject: [PATCH 35/74] chore(internal): delete unused methods and annotations (#100) fix(client): map deserialization bug --- .../InferencePipelineDeleteParams.kt | 21 +++++-------------- .../data/DataStreamParams.kt | 19 +++++++---------- .../presignedurl/PresignedUrlCreateParams.kt | 21 +++++-------------- 3 files changed, 18 insertions(+), 43 deletions(-) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt index c796b320..74adcaf7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt @@ -2,15 +2,12 @@ package com.openlayer.api.models.inferencepipelines -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams -import java.util.Collections +import com.openlayer.api.core.toImmutable import java.util.Objects import java.util.Optional @@ -20,25 +17,17 @@ private constructor( private val inferencePipelineId: String, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: MutableMap, + private val additionalBodyProperties: Map, ) : Params { fun inferencePipelineId(): String = inferencePipelineId + fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JsonAnySetter - private fun putAdditionalBodyProperty(key: String, value: JsonValue) { - additionalBodyProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalBodyProperties(): Map = - Collections.unmodifiableMap(additionalBodyProperties) - fun toBuilder() = Builder().from(this) companion object { @@ -213,7 +202,7 @@ private constructor( checkRequired("inferencePipelineId", inferencePipelineId), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toMutableMap(), + additionalBodyProperties.toImmutable(), ) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt index 5176b620..1eac98fa 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt @@ -3097,19 +3097,16 @@ private constructor( } } - class Row private constructor(private val additionalProperties: MutableMap) { - - @JsonCreator private constructor() : this(mutableMapOf()) - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + class Row + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun _additionalProperties(): Map = additionalProperties fun toBuilder() = Builder().from(this) @@ -3153,7 +3150,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Row = Row(additionalProperties.toMutableMap()) + fun build(): Row = Row(additionalProperties.toImmutable()) } private var validated: Boolean = false diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt index 9f5a3d75..10434f89 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt @@ -2,15 +2,12 @@ package com.openlayer.api.models.storage.presignedurl -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.Params import com.openlayer.api.core.checkRequired import com.openlayer.api.core.http.Headers import com.openlayer.api.core.http.QueryParams -import java.util.Collections +import com.openlayer.api.core.toImmutable import java.util.Objects import java.util.Optional @@ -20,26 +17,18 @@ private constructor( private val objectName: String, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: MutableMap, + private val additionalBodyProperties: Map, ) : Params { /** The name of the object. */ fun objectName(): String = objectName + fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JsonAnySetter - private fun putAdditionalBodyProperty(key: String, value: JsonValue) { - additionalBodyProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalBodyProperties(): Map = - Collections.unmodifiableMap(additionalBodyProperties) - fun toBuilder() = Builder().from(this) companion object { @@ -212,7 +201,7 @@ private constructor( checkRequired("objectName", objectName), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toMutableMap(), + additionalBodyProperties.toImmutable(), ) } From 5ce9c0686bbf66a4f0e3e2acad3356664671d287 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 29 Mar 2025 02:38:26 +0000 Subject: [PATCH 36/74] fix(client): don't call `validate()` during deserialization if we don't have to (#101) --- .../kotlin/com/openlayer/api/core/BaseDeserializer.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt index b95fa1a3..84e09911 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt @@ -11,6 +11,7 @@ import com.fasterxml.jackson.databind.JsonMappingException import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.deser.ContextualDeserializer import com.fasterxml.jackson.databind.deser.std.StdDeserializer +import com.openlayer.api.errors.OpenlayerInvalidDataException import kotlin.reflect.KClass abstract class BaseDeserializer(type: KClass) : @@ -29,6 +30,13 @@ abstract class BaseDeserializer(type: KClass) : protected abstract fun ObjectCodec.deserialize(node: JsonNode): T + protected fun ObjectCodec.deserialize(node: JsonNode, type: TypeReference): T = + try { + readValue(treeAsTokens(node), type) + } catch (e: Exception) { + throw OpenlayerInvalidDataException("Error deserializing", e) + } + protected fun ObjectCodec.tryDeserialize( node: JsonNode, type: TypeReference, From 15fddc34beea081f9afb69dc87302b65c1e82340 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 05:08:30 +0000 Subject: [PATCH 37/74] fix(client): limit json deserialization coercion (#102) --- openlayer-java-core/build.gradle.kts | 1 + .../com/openlayer/api/core/ObjectMappers.kt | 57 +++++++++++ .../openlayer/api/core/ObjectMappersTest.kt | 81 ++++++++++++++++ .../openlayer/api/core/http/SerializerTest.kt | 97 ------------------- 4 files changed, 139 insertions(+), 97 deletions(-) create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/core/ObjectMappersTest.kt delete mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt diff --git a/openlayer-java-core/build.gradle.kts b/openlayer-java-core/build.gradle.kts index 39a6eefe..3390e95d 100644 --- a/openlayer-java-core/build.gradle.kts +++ b/openlayer-java-core/build.gradle.kts @@ -34,6 +34,7 @@ dependencies { testImplementation("org.assertj:assertj-core:3.25.3") testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.3") testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.3") + testImplementation("org.junit-pioneer:junit-pioneer:1.9.1") testImplementation("org.mockito:mockito-core:5.14.2") testImplementation("org.mockito:mockito-junit-jupiter:5.14.2") testImplementation("org.mockito.kotlin:mockito-kotlin:4.1.0") diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt index 91ac20f1..1a642eb0 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt @@ -8,8 +8,11 @@ import com.fasterxml.jackson.databind.DeserializationFeature import com.fasterxml.jackson.databind.MapperFeature import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.cfg.CoercionAction +import com.fasterxml.jackson.databind.cfg.CoercionInputShape import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.databind.module.SimpleModule +import com.fasterxml.jackson.databind.type.LogicalType import com.fasterxml.jackson.datatype.jdk8.Jdk8Module import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import com.fasterxml.jackson.module.kotlin.kotlinModule @@ -21,6 +24,60 @@ fun jsonMapper(): JsonMapper = .addModule(Jdk8Module()) .addModule(JavaTimeModule()) .addModule(SimpleModule().addSerializer(InputStreamJsonSerializer)) + .withCoercionConfig(LogicalType.Boolean) { + it.setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.Integer) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.Float) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.Textual) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.Array) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.Collection) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.Map) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.POJO) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) + } .serializationInclusion(JsonInclude.Include.NON_ABSENT) .disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE) .disable(SerializationFeature.FLUSH_AFTER_WRITE_VALUE) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/ObjectMappersTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/ObjectMappersTest.kt new file mode 100644 index 00000000..6689f351 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/ObjectMappersTest.kt @@ -0,0 +1,81 @@ +package com.openlayer.api.core + +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.databind.exc.MismatchedInputException +import kotlin.reflect.KClass +import org.assertj.core.api.Assertions.assertThat +import org.assertj.core.api.Assertions.catchThrowable +import org.junit.jupiter.api.Test +import org.junitpioneer.jupiter.cartesian.CartesianTest + +internal class ObjectMappersTest { + + internal class ClassWithBooleanFieldPrefixedWithIs(private val isActive: JsonField) { + + @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive + } + + @Test + fun write_whenFieldPrefixedWithIs_keepsPrefix() { + val value = ClassWithBooleanFieldPrefixedWithIs(JsonField.of(true)) + + val json = jsonMapper().writeValueAsString(value) + + assertThat(json).isEqualTo("{\"is_active\":true}") + } + + internal class Class(@get:JsonProperty("field") @JsonProperty("field") val field: String) + + enum class ShapeTestCase(val value: Any, val kClass: KClass<*>) { + STRING("Hello World!", String::class), + BOOLEAN(true, Boolean::class), + FLOAT(3.14F, Float::class), + DOUBLE(3.14, Double::class), + INTEGER(42, Int::class), + LONG(42L, Long::class), + MAP(mapOf("property" to "value"), Map::class), + CLASS(Class("Hello World!"), Class::class), + LIST(listOf(1, 2, 3), List::class); + + companion object { + val VALID_CONVERSIONS = + listOf( + FLOAT to DOUBLE, + FLOAT to INTEGER, + FLOAT to LONG, + DOUBLE to FLOAT, + DOUBLE to INTEGER, + DOUBLE to LONG, + INTEGER to FLOAT, + INTEGER to DOUBLE, + INTEGER to LONG, + LONG to FLOAT, + LONG to DOUBLE, + LONG to INTEGER, + CLASS to MAP, + // These aren't actually valid, but coercion configs don't work for String until + // v2.14.0: https://github.com/FasterXML/jackson-databind/issues/3240 + // We currently test on v2.13.4. + BOOLEAN to STRING, + FLOAT to STRING, + DOUBLE to STRING, + INTEGER to STRING, + LONG to STRING, + ) + } + } + + @CartesianTest + fun read(@CartesianTest.Enum shape1: ShapeTestCase, @CartesianTest.Enum shape2: ShapeTestCase) { + val jsonMapper = jsonMapper() + val json = jsonMapper.writeValueAsString(shape1.value) + + val e = catchThrowable { jsonMapper.readValue(json, shape2.kClass.java) } + + if (shape1 == shape2 || shape1 to shape2 in ShapeTestCase.VALID_CONVERSIONS) { + assertThat(e).isNull() + } else { + assertThat(e).isInstanceOf(MismatchedInputException::class.java) + } + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt deleted file mode 100644 index 5c067675..00000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt +++ /dev/null @@ -1,97 +0,0 @@ -package com.openlayer.api.core.http - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.openlayer.api.core.* -import java.util.* -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SerializerTest { - @JsonDeserialize(builder = ClassWithBooleanFieldPrefixedWithIs.Builder::class) - class ClassWithBooleanFieldPrefixedWithIs - private constructor( - private val isActive: JsonField, - private val additionalProperties: Map, - ) { - private var validated: Boolean = false - - private var hashCode: Int = 0 - - fun isActive(): Boolean? = isActive.getNullable("is_active") - - @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate() = apply { - if (!validated) { - isActive() - validated = true - } - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ClassWithBooleanFieldPrefixedWithIs && - isActive == other.isActive && - additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(isActive, additionalProperties) - } - return hashCode - } - - override fun toString() = - "MyClass{isActive=$isActive, additionalProperties=$additionalProperties}" - - companion object { - fun builder() = Builder() - } - - class Builder internal constructor() { - - private var isActive: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) - - @JsonProperty("is_active") - @ExcludeMissing - fun isActive(isActive: JsonField) = apply { this.isActive = isActive } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): ClassWithBooleanFieldPrefixedWithIs = - ClassWithBooleanFieldPrefixedWithIs(isActive, additionalProperties.toImmutable()) - } - } - - @Test - fun serializeBooleanPrefixedWithIs() { - val value = ClassWithBooleanFieldPrefixedWithIs.builder().isActive(true).build() - assertThat(jsonMapper().writeValueAsString(value)).isEqualTo("{\"is_active\":true}") - } -} From c1cde726f563abe38a5188647c6f05df01d034e8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Apr 2025 06:34:22 +0000 Subject: [PATCH 38/74] fix: pluralize `list` response variables (#103) --- .../openlayer/api/services/async/ProjectServiceAsyncTest.kt | 6 +++--- .../services/async/commits/TestResultServiceAsyncTest.kt | 6 +++--- .../async/inferencepipelines/TestResultServiceAsyncTest.kt | 6 +++--- .../api/services/async/projects/CommitServiceAsyncTest.kt | 6 +++--- .../async/projects/InferencePipelineServiceAsyncTest.kt | 6 +++--- .../openlayer/api/services/blocking/ProjectServiceTest.kt | 4 ++-- .../api/services/blocking/commits/TestResultServiceTest.kt | 4 ++-- .../blocking/inferencepipelines/TestResultServiceTest.kt | 4 ++-- .../api/services/blocking/projects/CommitServiceTest.kt | 4 ++-- .../blocking/projects/InferencePipelineServiceTest.kt | 4 ++-- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncTest.kt index 428155bf..4685622f 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncTest.kt @@ -78,7 +78,7 @@ internal class ProjectServiceAsyncTest { .build() val projectServiceAsync = client.projects() - val projectFuture = + val projectsFuture = projectServiceAsync.list( ProjectListParams.builder() .name("name") @@ -88,7 +88,7 @@ internal class ProjectServiceAsyncTest { .build() ) - val project = projectFuture.get() - project.validate() + val projects = projectsFuture.get() + projects.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt index afbe6fc3..f78c4d42 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt @@ -20,7 +20,7 @@ internal class TestResultServiceAsyncTest { .build() val testResultServiceAsync = client.commits().testResults() - val testResultFuture = + val testResultsFuture = testResultServiceAsync.list( TestResultListParams.builder() .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -32,7 +32,7 @@ internal class TestResultServiceAsyncTest { .build() ) - val testResult = testResultFuture.get() - testResult.validate() + val testResults = testResultsFuture.get() + testResults.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncTest.kt index b939f9d0..9f5103cc 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncTest.kt @@ -20,7 +20,7 @@ internal class TestResultServiceAsyncTest { .build() val testResultServiceAsync = client.inferencePipelines().testResults() - val testResultFuture = + val testResultsFuture = testResultServiceAsync.list( TestResultListParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -31,7 +31,7 @@ internal class TestResultServiceAsyncTest { .build() ) - val testResult = testResultFuture.get() - testResult.validate() + val testResults = testResultsFuture.get() + testResults.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt index 9c5c3e00..59ae465f 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt @@ -80,7 +80,7 @@ internal class CommitServiceAsyncTest { .build() val commitServiceAsync = client.projects().commits() - val commitFuture = + val commitsFuture = commitServiceAsync.list( CommitListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -89,7 +89,7 @@ internal class CommitServiceAsyncTest { .build() ) - val commit = commitFuture.get() - commit.validate() + val commits = commitsFuture.get() + commits.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt index 4455075e..834205b2 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt @@ -131,7 +131,7 @@ internal class InferencePipelineServiceAsyncTest { .build() val inferencePipelineServiceAsync = client.projects().inferencePipelines() - val inferencePipelineFuture = + val inferencePipelinesFuture = inferencePipelineServiceAsync.list( InferencePipelineListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -141,7 +141,7 @@ internal class InferencePipelineServiceAsyncTest { .build() ) - val inferencePipeline = inferencePipelineFuture.get() - inferencePipeline.validate() + val inferencePipelines = inferencePipelinesFuture.get() + inferencePipelines.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt index 7cc888fb..ec241248 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt @@ -77,7 +77,7 @@ internal class ProjectServiceTest { .build() val projectService = client.projects() - val project = + val projects = projectService.list( ProjectListParams.builder() .name("name") @@ -87,6 +87,6 @@ internal class ProjectServiceTest { .build() ) - project.validate() + projects.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt index b17bc64c..2632cbaa 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt @@ -20,7 +20,7 @@ internal class TestResultServiceTest { .build() val testResultService = client.commits().testResults() - val testResult = + val testResults = testResultService.list( TestResultListParams.builder() .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -32,6 +32,6 @@ internal class TestResultServiceTest { .build() ) - testResult.validate() + testResults.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceTest.kt index b8662c51..3686da0b 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceTest.kt @@ -20,7 +20,7 @@ internal class TestResultServiceTest { .build() val testResultService = client.inferencePipelines().testResults() - val testResult = + val testResults = testResultService.list( TestResultListParams.builder() .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -31,6 +31,6 @@ internal class TestResultServiceTest { .build() ) - testResult.validate() + testResults.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt index 9c7ca4f0..39f3730f 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt @@ -79,7 +79,7 @@ internal class CommitServiceTest { .build() val commitService = client.projects().commits() - val commit = + val commits = commitService.list( CommitListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -88,6 +88,6 @@ internal class CommitServiceTest { .build() ) - commit.validate() + commits.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt index 8d83721f..20f412a4 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt @@ -130,7 +130,7 @@ internal class InferencePipelineServiceTest { .build() val inferencePipelineService = client.projects().inferencePipelines() - val inferencePipeline = + val inferencePipelines = inferencePipelineService.list( InferencePipelineListParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -140,6 +140,6 @@ internal class InferencePipelineServiceTest { .build() ) - inferencePipeline.validate() + inferencePipelines.validate() } } From 0c69b0d67f818d7511495b196978e1d9a6f6de7d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Apr 2025 07:11:20 +0000 Subject: [PATCH 39/74] feat(client): make union deserialization more robust (#104) feat(client): add enum validation method chore(client): remove unnecessary json state from some query param classes chore(internal): add json roundtripping tests chore(internal): add invalid json deserialization tests --- .../openlayer/api/core/BaseDeserializer.kt | 33 +- .../kotlin/com/openlayer/api/core/Utils.kt | 28 ++ .../models/commits/CommitRetrieveResponse.kt | 107 +++++- .../testresults/TestResultListParams.kt | 54 +++ .../testresults/TestResultListResponse.kt | 212 +++++++++++- .../InferencePipelineRetrieveParams.kt | 27 ++ .../InferencePipelineRetrieveResponse.kt | 297 ++++++++++++++++- .../InferencePipelineUpdateParams.kt | 20 ++ .../InferencePipelineUpdateResponse.kt | 297 ++++++++++++++++- .../data/DataStreamParams.kt | 247 ++++++++++++-- .../data/DataStreamResponse.kt | 45 ++- .../rows/RowUpdateParams.kt | 38 +++ .../rows/RowUpdateResponse.kt | 45 ++- .../testresults/TestResultListParams.kt | 54 +++ .../testresults/TestResultListResponse.kt | 212 +++++++++++- .../models/projects/ProjectCreateParams.kt | 136 +++++++- .../models/projects/ProjectCreateResponse.kt | 135 +++++++- .../api/models/projects/ProjectListParams.kt | 27 ++ .../models/projects/ProjectListResponse.kt | 153 ++++++++- .../projects/commits/CommitCreateParams.kt | 108 +++++- .../projects/commits/CommitCreateResponse.kt | 107 +++++- .../projects/commits/CommitListResponse.kt | 125 ++++++- .../InferencePipelineCreateParams.kt | 298 ++++++++++++++++- .../InferencePipelineCreateResponse.kt | 297 ++++++++++++++++- .../InferencePipelineListResponse.kt | 315 +++++++++++++++++- .../PresignedUrlCreateResponse.kt | 17 + .../commits/CommitRetrieveResponseTest.kt | 55 +++ .../testresults/TestResultListResponseTest.kt | 70 ++++ .../InferencePipelineRetrieveResponseTest.kt | 107 ++++++ .../InferencePipelineUpdateResponseTest.kt | 107 ++++++ .../data/DataStreamResponseTest.kt | 17 + .../rows/RowUpdateResponseTest.kt | 17 + .../testresults/TestResultListResponseTest.kt | 70 ++++ .../projects/ProjectCreateResponseTest.kt | 55 +++ .../projects/ProjectListResponseTest.kt | 59 ++++ .../commits/CommitCreateResponseTest.kt | 55 +++ .../commits/CommitListResponseTest.kt | 59 ++++ .../InferencePipelineCreateResponseTest.kt | 107 ++++++ .../InferencePipelineListResponseTest.kt | 118 +++++++ .../PresignedUrlCreateResponseTest.kt | 21 ++ 40 files changed, 4236 insertions(+), 115 deletions(-) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt index 84e09911..e624381e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt @@ -7,11 +7,9 @@ import com.fasterxml.jackson.databind.BeanProperty import com.fasterxml.jackson.databind.DeserializationContext import com.fasterxml.jackson.databind.JavaType import com.fasterxml.jackson.databind.JsonDeserializer -import com.fasterxml.jackson.databind.JsonMappingException import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.deser.ContextualDeserializer import com.fasterxml.jackson.databind.deser.std.StdDeserializer -import com.openlayer.api.errors.OpenlayerInvalidDataException import kotlin.reflect.KClass abstract class BaseDeserializer(type: KClass) : @@ -30,38 +28,17 @@ abstract class BaseDeserializer(type: KClass) : protected abstract fun ObjectCodec.deserialize(node: JsonNode): T - protected fun ObjectCodec.deserialize(node: JsonNode, type: TypeReference): T = + protected fun ObjectCodec.tryDeserialize(node: JsonNode, type: TypeReference): T? = try { readValue(treeAsTokens(node), type) } catch (e: Exception) { - throw OpenlayerInvalidDataException("Error deserializing", e) - } - - protected fun ObjectCodec.tryDeserialize( - node: JsonNode, - type: TypeReference, - validate: (T) -> Unit = {}, - ): T? { - return try { - readValue(treeAsTokens(node), type).apply(validate) - } catch (e: JsonMappingException) { - null - } catch (e: RuntimeException) { null } - } - protected fun ObjectCodec.tryDeserialize( - node: JsonNode, - type: JavaType, - validate: (T) -> Unit = {}, - ): T? { - return try { - readValue(treeAsTokens(node), type).apply(validate) - } catch (e: JsonMappingException) { - null - } catch (e: RuntimeException) { + protected fun ObjectCodec.tryDeserialize(node: JsonNode, type: JavaType): T? = + try { + readValue(treeAsTokens(node), type) + } catch (e: Exception) { null } - } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt index 396e33d3..4482ae3d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt @@ -25,6 +25,34 @@ internal fun , V> SortedMap.toImmutable(): SortedMap> Sequence.allMaxBy(selector: (T) -> R): List { + var maxValue: R? = null + val maxElements = mutableListOf() + + val iterator = iterator() + while (iterator.hasNext()) { + val element = iterator.next() + val value = selector(element) + if (maxValue == null || value > maxValue) { + maxValue = value + maxElements.clear() + maxElements.add(element) + } else if (value == maxValue) { + maxElements.add(element) + } + } + + return maxElements +} + /** * Returns whether [this] is equal to [other]. * diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt index 31176c2d..99fb06d6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt @@ -805,7 +805,7 @@ private constructor( mlModelId() passingGoalCount() projectId() - status() + status().validate() statusMessage() storageUri() totalGoalCount() @@ -817,6 +817,39 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (commit.asKnown().getOrNull()?.validity() ?: 0) + + (if (dateArchived.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (failingGoalCount.asKnown().isPresent) 1 else 0) + + (if (mlModelId.asKnown().isPresent) 1 else 0) + + (if (passingGoalCount.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + (if (storageUri.asKnown().isPresent) 1 else 0) + + (if (totalGoalCount.asKnown().isPresent) 1 else 0) + + (if (trainingDatasetId.asKnown().isPresent) 1 else 0) + + (if (validationDatasetId.asKnown().isPresent) 1 else 0) + + (if (archived.asKnown().isPresent) 1 else 0) + + (if (deploymentStatus.asKnown().isPresent) 1 else 0) + + (links.asKnown().getOrNull()?.validity() ?: 0) + /** The details of a commit (project version). */ class Commit private constructor( @@ -1416,6 +1449,35 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (authorId.asKnown().isPresent) 1 else 0) + + (if (fileSize.asKnown().isPresent) 1 else 0) + + (if (message.asKnown().isPresent) 1 else 0) + + (if (mlModelId.asKnown().isPresent) 1 else 0) + + (if (storageUri.asKnown().isPresent) 1 else 0) + + (if (trainingDatasetId.asKnown().isPresent) 1 else 0) + + (if (validationDatasetId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (gitCommitRef.asKnown().isPresent) 1 else 0) + + (if (gitCommitSha.asKnown().isPresent) 1 else 0) + + (if (gitCommitUrl.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1549,6 +1611,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1680,6 +1769,22 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (app.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt index 19d68260..e46cfa17 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt @@ -409,6 +409,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -531,6 +558,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt index c369a606..e7a82450 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt @@ -20,6 +20,7 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.allMaxBy import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired import com.openlayer.api.core.getOrThrow @@ -164,6 +165,23 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + class Item private constructor( private val id: JsonField, @@ -722,13 +740,41 @@ private constructor( dateUpdated() inferencePipelineId() projectVersionId() - status() + status().validate() statusMessage() goal().ifPresent { it.validate() } goalId() validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateDataEnds.asKnown().isPresent) 1 else 0) + + (if (dateDataStarts.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (inferencePipelineId.asKnown().isPresent) 1 else 0) + + (if (projectVersionId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + (goal.asKnown().getOrNull()?.validity() ?: 0) + + (if (goalId.asKnown().isPresent) 1 else 0) + /** The status of the test. */ class Status @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -837,6 +883,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1888,6 +1961,44 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (commentCount.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateArchived.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (number.asKnown().isPresent) 1 else 0) + + (if (originProjectVersionId.asKnown().isPresent) 1 else 0) + + (if (subtype.asKnown().isPresent) 1 else 0) + + (if (suggested.asKnown().isPresent) 1 else 0) + + (thresholds.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (type.asKnown().isPresent) 1 else 0) + + (if (archived.asKnown().isPresent) 1 else 0) + + (if (delayWindow.asKnown().isPresent) 1 else 0) + + (if (evaluationWindow.asKnown().isPresent) 1 else 0) + + (if (usesMlModel.asKnown().isPresent) 1 else 0) + + (if (usesProductionData.asKnown().isPresent) 1 else 0) + + (if (usesReferenceDataset.asKnown().isPresent) 1 else 0) + + (if (usesTrainingDataset.asKnown().isPresent) 1 else 0) + + (if (usesValidationDataset.asKnown().isPresent) 1 else 0) + class Threshold private constructor( private val insightName: JsonField, @@ -2195,6 +2306,28 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (insightName.asKnown().isPresent) 1 else 0) + + (insightParameters.asKnown().getOrNull()?.size ?: 0) + + (if (measurement.asKnown().isPresent) 1 else 0) + + (if (operator.asKnown().isPresent) 1 else 0) + + (value.asKnown().getOrNull()?.validity() ?: 0) + /** The value to be compared. */ @JsonDeserialize(using = Value.Deserializer::class) @JsonSerialize(using = Value.Serializer::class) @@ -2233,15 +2366,14 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) - fun accept(visitor: Visitor): T { - return when { + fun accept(visitor: Visitor): T = + when { number != null -> visitor.visitNumber(number) bool != null -> visitor.visitBool(bool) string != null -> visitor.visitString(string) strings != null -> visitor.visitStrings(strings) else -> visitor.unknown(_json) } - } private var validated: Boolean = false @@ -2264,6 +2396,36 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitNumber(number: Double) = 1 + + override fun visitBool(bool: Boolean) = 1 + + override fun visitString(string: String) = 1 + + override fun visitStrings(strings: List) = strings.size + + override fun unknown(json: JsonValue?) = 0 + } + ) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2329,20 +2491,36 @@ private constructor( override fun ObjectCodec.deserialize(node: JsonNode): Value { val json = JsonValue.fromJsonNode(node) - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(number = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(bool = it, _json = json) + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef())?.let { + Value(number = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Value(bool = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Value(string = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef>())?.let { + Value(strings = it, _json = json) + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely + // incompatible with all the possible variants (e.g. deserializing + // from object). + 0 -> Value(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then + // use the first completely valid match, or simply the first match + // if none are completely valid. + else -> + bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() } - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(string = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef>())?.let { - return Value(strings = it, _json = json) - } - - return Value(_json = json) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt index 3110a204..b437b9f2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveParams.kt @@ -308,6 +308,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Expand = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt index 05bbb2ae..80f97a34 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt @@ -843,7 +843,7 @@ private constructor( name() passingGoalCount() projectId() - status() + status().validate() statusMessage() totalGoalCount() project().ifPresent { it.validate() } @@ -852,6 +852,40 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateLastEvaluated.asKnown().isPresent) 1 else 0) + + (if (dateLastSampleReceived.asKnown().isPresent) 1 else 0) + + (if (dateOfNextEvaluation.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (if (failingGoalCount.asKnown().isPresent) 1 else 0) + + (links.asKnown().getOrNull()?.validity() ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (passingGoalCount.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + (if (totalGoalCount.asKnown().isPresent) 1 else 0) + + (project.asKnown().getOrNull()?.validity() ?: 0) + + (workspace.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + class Links private constructor( private val app: JsonField, @@ -970,6 +1004,22 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (app.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1099,6 +1149,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1842,8 +1919,8 @@ private constructor( links().validate() monitoringGoalCount() name() - source() - taskType() + source().ifPresent { it.validate() } + taskType().validate() versionCount() workspaceId() description() @@ -1851,6 +1928,39 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (developmentGoalCount.asKnown().isPresent) 1 else 0) + + (if (goalCount.asKnown().isPresent) 1 else 0) + + (if (inferencePipelineCount.asKnown().isPresent) 1 else 0) + + (links.asKnown().getOrNull()?.validity() ?: 0) + + (if (monitoringGoalCount.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (source.asKnown().getOrNull()?.validity() ?: 0) + + (taskType.asKnown().getOrNull()?.validity() ?: 0) + + (if (versionCount.asKnown().isPresent) 1 else 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (gitRepo.asKnown().getOrNull()?.validity() ?: 0) + /** Links to the project. */ class Links private constructor( @@ -1974,6 +2084,22 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (app.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2087,6 +2213,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Source = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2203,6 +2356,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): TaskType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2747,6 +2927,35 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateConnected.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (gitAccountId.asKnown().isPresent) 1 else 0) + + (if (gitId.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (private_.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (url.asKnown().isPresent) 1 else 0) + + (if (branch.asKnown().isPresent) 1 else 0) + + (if (rootDir.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3539,7 +3748,7 @@ private constructor( periodStartDate() projectCount() slug() - status() + status().validate() inviteCode() monthlyUsage().ifPresent { it.forEach { it.validate() } } samlOnlyAccess() @@ -3547,6 +3756,39 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (inviteCount.asKnown().isPresent) 1 else 0) + + (if (memberCount.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (periodEndDate.asKnown().isPresent) 1 else 0) + + (if (periodStartDate.asKnown().isPresent) 1 else 0) + + (if (projectCount.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (inviteCode.asKnown().isPresent) 1 else 0) + + (monthlyUsage.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (samlOnlyAccess.asKnown().isPresent) 1 else 0) + + (wildcardDomains.asKnown().getOrNull()?.size ?: 0) + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -3672,6 +3914,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3895,6 +4164,26 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (executionTimeMs.asKnown().isPresent) 1 else 0) + + (if (monthYear.asKnown().isPresent) 1 else 0) + + (if (predictionCount.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt index af5a8c0b..3a9bc18e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt @@ -522,6 +522,26 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (description.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (referenceDatasetUri.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt index 72473965..363ce7c4 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt @@ -843,7 +843,7 @@ private constructor( name() passingGoalCount() projectId() - status() + status().validate() statusMessage() totalGoalCount() project().ifPresent { it.validate() } @@ -852,6 +852,40 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateLastEvaluated.asKnown().isPresent) 1 else 0) + + (if (dateLastSampleReceived.asKnown().isPresent) 1 else 0) + + (if (dateOfNextEvaluation.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (if (failingGoalCount.asKnown().isPresent) 1 else 0) + + (links.asKnown().getOrNull()?.validity() ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (passingGoalCount.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + (if (totalGoalCount.asKnown().isPresent) 1 else 0) + + (project.asKnown().getOrNull()?.validity() ?: 0) + + (workspace.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + class Links private constructor( private val app: JsonField, @@ -970,6 +1004,22 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (app.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1099,6 +1149,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1842,8 +1919,8 @@ private constructor( links().validate() monitoringGoalCount() name() - source() - taskType() + source().ifPresent { it.validate() } + taskType().validate() versionCount() workspaceId() description() @@ -1851,6 +1928,39 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (developmentGoalCount.asKnown().isPresent) 1 else 0) + + (if (goalCount.asKnown().isPresent) 1 else 0) + + (if (inferencePipelineCount.asKnown().isPresent) 1 else 0) + + (links.asKnown().getOrNull()?.validity() ?: 0) + + (if (monitoringGoalCount.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (source.asKnown().getOrNull()?.validity() ?: 0) + + (taskType.asKnown().getOrNull()?.validity() ?: 0) + + (if (versionCount.asKnown().isPresent) 1 else 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (gitRepo.asKnown().getOrNull()?.validity() ?: 0) + /** Links to the project. */ class Links private constructor( @@ -1974,6 +2084,22 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (app.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2087,6 +2213,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Source = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2203,6 +2356,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): TaskType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2747,6 +2927,35 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateConnected.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (gitAccountId.asKnown().isPresent) 1 else 0) + + (if (gitId.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (private_.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (url.asKnown().isPresent) 1 else 0) + + (if (branch.asKnown().isPresent) 1 else 0) + + (if (rootDir.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3539,7 +3748,7 @@ private constructor( periodStartDate() projectCount() slug() - status() + status().validate() inviteCode() monthlyUsage().ifPresent { it.forEach { it.validate() } } samlOnlyAccess() @@ -3547,6 +3756,39 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (inviteCount.asKnown().isPresent) 1 else 0) + + (if (memberCount.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (periodEndDate.asKnown().isPresent) 1 else 0) + + (if (periodStartDate.asKnown().isPresent) 1 else 0) + + (if (projectCount.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (inviteCode.asKnown().isPresent) 1 else 0) + + (monthlyUsage.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (samlOnlyAccess.asKnown().isPresent) 1 else 0) + + (wildcardDomains.asKnown().getOrNull()?.size ?: 0) + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -3672,6 +3914,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3895,6 +4164,26 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (executionTimeMs.asKnown().isPresent) 1 else 0) + + (if (monthYear.asKnown().isPresent) 1 else 0) + + (if (predictionCount.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt index 1eac98fa..0c636717 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt @@ -20,6 +20,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.Params +import com.openlayer.api.core.allMaxBy import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired import com.openlayer.api.core.getOrThrow @@ -520,6 +521,25 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (config.asKnown().getOrNull()?.validity() ?: 0) + + (rows.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -582,8 +602,8 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) - fun accept(visitor: Visitor): T { - return when { + fun accept(visitor: Visitor): T = + when { llmData != null -> visitor.visitLlmData(llmData) tabularClassificationData != null -> visitor.visitTabularClassificationData(tabularClassificationData) @@ -593,7 +613,6 @@ private constructor( visitor.visitTextClassificationData(textClassificationData) else -> visitor.unknown(_json) } - } private var validated: Boolean = false @@ -630,6 +649,42 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitLlmData(llmData: LlmData) = llmData.validity() + + override fun visitTabularClassificationData( + tabularClassificationData: TabularClassificationData + ) = tabularClassificationData.validity() + + override fun visitTabularRegressionData( + tabularRegressionData: TabularRegressionData + ) = tabularRegressionData.validity() + + override fun visitTextClassificationData( + textClassificationData: TextClassificationData + ) = textClassificationData.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -703,24 +758,34 @@ private constructor( override fun ObjectCodec.deserialize(node: JsonNode): Config { val json = JsonValue.fromJsonNode(node) - tryDeserialize(node, jacksonTypeRef()) { it.validate() } - ?.let { - return Config(llmData = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef()) { it.validate() } - ?.let { - return Config(tabularClassificationData = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef()) { it.validate() } - ?.let { - return Config(tabularRegressionData = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef()) { it.validate() } - ?.let { - return Config(textClassificationData = it, _json = json) - } - - return Config(_json = json) + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef())?.let { + Config(llmData = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Config(tabularClassificationData = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Config(tabularRegressionData = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Config(textClassificationData = it, _json = json) + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely incompatible with + // all the possible variants (e.g. deserializing from boolean). + 0 -> Config(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then use the first + // completely valid match, or simply the first match if none are completely + // valid. + else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + } } } @@ -1371,6 +1436,34 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (outputColumnName.asKnown().isPresent) 1 else 0) + + (if (contextColumnName.asKnown().isPresent) 1 else 0) + + (if (costColumnName.asKnown().isPresent) 1 else 0) + + (if (groundTruthColumnName.asKnown().isPresent) 1 else 0) + + (if (inferenceIdColumnName.asKnown().isPresent) 1 else 0) + + (inputVariableNames.asKnown().getOrNull()?.size ?: 0) + + (if (latencyColumnName.asKnown().isPresent) 1 else 0) + + (if (numOfTokenColumnName.asKnown().isPresent) 1 else 0) + + (prompt.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (questionColumnName.asKnown().isPresent) 1 else 0) + + (if (timestampColumnName.asKnown().isPresent) 1 else 0) + class Prompt private constructor( private val content: JsonField, @@ -1517,6 +1610,25 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (content.asKnown().isPresent) 1 else 0) + + (if (role.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2116,6 +2228,32 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (classNames.asKnown().getOrNull()?.size ?: 0) + + (categoricalFeatureNames.asKnown().getOrNull()?.size ?: 0) + + (featureNames.asKnown().getOrNull()?.size ?: 0) + + (if (inferenceIdColumnName.asKnown().isPresent) 1 else 0) + + (if (labelColumnName.asKnown().isPresent) 1 else 0) + + (if (latencyColumnName.asKnown().isPresent) 1 else 0) + + (if (predictionsColumnName.asKnown().isPresent) 1 else 0) + + (if (predictionScoresColumnName.asKnown().isPresent) 1 else 0) + + (if (timestampColumnName.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2572,6 +2710,30 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (categoricalFeatureNames.asKnown().getOrNull()?.size ?: 0) + + (featureNames.asKnown().getOrNull()?.size ?: 0) + + (if (inferenceIdColumnName.asKnown().isPresent) 1 else 0) + + (if (latencyColumnName.asKnown().isPresent) 1 else 0) + + (if (predictionsColumnName.asKnown().isPresent) 1 else 0) + + (if (targetColumnName.asKnown().isPresent) 1 else 0) + + (if (timestampColumnName.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3078,6 +3240,31 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (classNames.asKnown().getOrNull()?.size ?: 0) + + (if (inferenceIdColumnName.asKnown().isPresent) 1 else 0) + + (if (labelColumnName.asKnown().isPresent) 1 else 0) + + (if (latencyColumnName.asKnown().isPresent) 1 else 0) + + (if (predictionsColumnName.asKnown().isPresent) 1 else 0) + + (if (predictionScoresColumnName.asKnown().isPresent) 1 else 0) + + (if (textColumnName.asKnown().isPresent) 1 else 0) + + (if (timestampColumnName.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3163,6 +3350,24 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt index b66a3fd8..0c4e4c11 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponse.kt @@ -15,6 +15,7 @@ import com.openlayer.api.core.checkRequired import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Collections import java.util.Objects +import kotlin.jvm.optionals.getOrNull class DataStreamResponse private constructor( @@ -132,10 +133,25 @@ private constructor( return@apply } - success() + success().validate() validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (success.asKnown().getOrNull()?.validity() ?: 0) + class Success @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -214,6 +230,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a Boolean") } + private var validated: Boolean = false + + fun validate(): Success = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt index 800f644c..720e088b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt @@ -401,6 +401,22 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (config.asKnown().getOrNull()?.validity() ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -755,6 +771,28 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (groundTruthColumnName.asKnown().isPresent) 1 else 0) + + (if (humanFeedbackColumnName.asKnown().isPresent) 1 else 0) + + (if (inferenceIdColumnName.asKnown().isPresent) 1 else 0) + + (if (latencyColumnName.asKnown().isPresent) 1 else 0) + + (if (timestampColumnName.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt index c1867d00..74ed1e2b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponse.kt @@ -15,6 +15,7 @@ import com.openlayer.api.core.checkRequired import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Collections import java.util.Objects +import kotlin.jvm.optionals.getOrNull class RowUpdateResponse private constructor( @@ -132,10 +133,25 @@ private constructor( return@apply } - success() + success().validate() validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (success.asKnown().getOrNull()?.validity() ?: 0) + class Success @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -214,6 +230,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a Boolean") } + private var validated: Boolean = false + + fun validate(): Success = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt index 4724a06f..b94b1557 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParams.kt @@ -385,6 +385,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -507,6 +534,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt index e5b5efb6..48db95ef 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt @@ -20,6 +20,7 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.allMaxBy import com.openlayer.api.core.checkKnown import com.openlayer.api.core.checkRequired import com.openlayer.api.core.getOrThrow @@ -164,6 +165,23 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + class Item private constructor( private val id: JsonField, @@ -722,13 +740,41 @@ private constructor( dateUpdated() inferencePipelineId() projectVersionId() - status() + status().validate() statusMessage() goal().ifPresent { it.validate() } goalId() validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateDataEnds.asKnown().isPresent) 1 else 0) + + (if (dateDataStarts.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (inferencePipelineId.asKnown().isPresent) 1 else 0) + + (if (projectVersionId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + (goal.asKnown().getOrNull()?.validity() ?: 0) + + (if (goalId.asKnown().isPresent) 1 else 0) + /** The status of the test. */ class Status @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -837,6 +883,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1888,6 +1961,44 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (commentCount.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateArchived.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (number.asKnown().isPresent) 1 else 0) + + (if (originProjectVersionId.asKnown().isPresent) 1 else 0) + + (if (subtype.asKnown().isPresent) 1 else 0) + + (if (suggested.asKnown().isPresent) 1 else 0) + + (thresholds.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (type.asKnown().isPresent) 1 else 0) + + (if (archived.asKnown().isPresent) 1 else 0) + + (if (delayWindow.asKnown().isPresent) 1 else 0) + + (if (evaluationWindow.asKnown().isPresent) 1 else 0) + + (if (usesMlModel.asKnown().isPresent) 1 else 0) + + (if (usesProductionData.asKnown().isPresent) 1 else 0) + + (if (usesReferenceDataset.asKnown().isPresent) 1 else 0) + + (if (usesTrainingDataset.asKnown().isPresent) 1 else 0) + + (if (usesValidationDataset.asKnown().isPresent) 1 else 0) + class Threshold private constructor( private val insightName: JsonField, @@ -2195,6 +2306,28 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (insightName.asKnown().isPresent) 1 else 0) + + (insightParameters.asKnown().getOrNull()?.size ?: 0) + + (if (measurement.asKnown().isPresent) 1 else 0) + + (if (operator.asKnown().isPresent) 1 else 0) + + (value.asKnown().getOrNull()?.validity() ?: 0) + /** The value to be compared. */ @JsonDeserialize(using = Value.Deserializer::class) @JsonSerialize(using = Value.Serializer::class) @@ -2233,15 +2366,14 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) - fun accept(visitor: Visitor): T { - return when { + fun accept(visitor: Visitor): T = + when { number != null -> visitor.visitNumber(number) bool != null -> visitor.visitBool(bool) string != null -> visitor.visitString(string) strings != null -> visitor.visitStrings(strings) else -> visitor.unknown(_json) } - } private var validated: Boolean = false @@ -2264,6 +2396,36 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitNumber(number: Double) = 1 + + override fun visitBool(bool: Boolean) = 1 + + override fun visitString(string: String) = 1 + + override fun visitStrings(strings: List) = strings.size + + override fun unknown(json: JsonValue?) = 0 + } + ) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2329,20 +2491,36 @@ private constructor( override fun ObjectCodec.deserialize(node: JsonNode): Value { val json = JsonValue.fromJsonNode(node) - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(number = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(bool = it, _json = json) + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef())?.let { + Value(number = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Value(bool = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Value(string = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef>())?.let { + Value(strings = it, _json = json) + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely + // incompatible with all the possible variants (e.g. deserializing + // from object). + 0 -> Value(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then + // use the first completely valid match, or simply the first match + // if none are completely valid. + else -> + bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() } - tryDeserialize(node, jacksonTypeRef())?.let { - return Value(string = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef>())?.let { - return Value(strings = it, _json = json) - } - - return Value(_json = json) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt index dd9e55ce..adf8f852 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt @@ -1421,8 +1421,8 @@ private constructor( links().validate() monitoringGoalCount() name() - source() - taskType() + source().ifPresent { it.validate() } + taskType().validate() versionCount() workspaceId() description() @@ -1430,6 +1430,39 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (developmentGoalCount.asKnown().isPresent) 1 else 0) + + (if (goalCount.asKnown().isPresent) 1 else 0) + + (if (inferencePipelineCount.asKnown().isPresent) 1 else 0) + + (links.asKnown().getOrNull()?.validity() ?: 0) + + (if (monitoringGoalCount.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (source.asKnown().getOrNull()?.validity() ?: 0) + + (taskType.asKnown().getOrNull()?.validity() ?: 0) + + (if (versionCount.asKnown().isPresent) 1 else 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (gitRepo.asKnown().getOrNull()?.validity() ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1567,6 +1600,22 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (app.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1678,6 +1727,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Source = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1791,6 +1867,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): TaskType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2312,6 +2415,35 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateConnected.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (gitAccountId.asKnown().isPresent) 1 else 0) + + (if (gitId.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (private_.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (url.asKnown().isPresent) 1 else 0) + + (if (branch.asKnown().isPresent) 1 else 0) + + (if (rootDir.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt index 31288f71..51d01c80 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt @@ -726,8 +726,8 @@ private constructor( links().validate() monitoringGoalCount() name() - source() - taskType() + source().ifPresent { it.validate() } + taskType().validate() versionCount() workspaceId() description() @@ -735,6 +735,38 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (developmentGoalCount.asKnown().isPresent) 1 else 0) + + (if (goalCount.asKnown().isPresent) 1 else 0) + + (if (inferencePipelineCount.asKnown().isPresent) 1 else 0) + + (links.asKnown().getOrNull()?.validity() ?: 0) + + (if (monitoringGoalCount.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (source.asKnown().getOrNull()?.validity() ?: 0) + + (taskType.asKnown().getOrNull()?.validity() ?: 0) + + (if (versionCount.asKnown().isPresent) 1 else 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (gitRepo.asKnown().getOrNull()?.validity() ?: 0) + /** Links to the project. */ class Links private constructor( @@ -854,6 +886,22 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (app.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -965,6 +1013,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Source = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1078,6 +1153,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): TaskType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1599,6 +1701,35 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateConnected.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (gitAccountId.asKnown().isPresent) 1 else 0) + + (if (gitId.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (private_.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (url.asKnown().isPresent) 1 else 0) + + (if (branch.asKnown().isPresent) 1 else 0) + + (if (rootDir.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt index 2bd38514..737094b5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListParams.kt @@ -335,6 +335,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): TaskType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt index d38c17fb..f811e71a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt @@ -154,6 +154,23 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + class Item private constructor( private val id: JsonField, @@ -884,8 +901,8 @@ private constructor( links().validate() monitoringGoalCount() name() - source() - taskType() + source().ifPresent { it.validate() } + taskType().validate() versionCount() workspaceId() description() @@ -893,6 +910,39 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (developmentGoalCount.asKnown().isPresent) 1 else 0) + + (if (goalCount.asKnown().isPresent) 1 else 0) + + (if (inferencePipelineCount.asKnown().isPresent) 1 else 0) + + (links.asKnown().getOrNull()?.validity() ?: 0) + + (if (monitoringGoalCount.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (source.asKnown().getOrNull()?.validity() ?: 0) + + (taskType.asKnown().getOrNull()?.validity() ?: 0) + + (if (versionCount.asKnown().isPresent) 1 else 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (gitRepo.asKnown().getOrNull()?.validity() ?: 0) + /** Links to the project. */ class Links private constructor( @@ -1016,6 +1066,22 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (app.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1129,6 +1195,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Source = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1245,6 +1338,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): TaskType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1789,6 +1909,35 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateConnected.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (gitAccountId.asKnown().isPresent) 1 else 0) + + (if (gitId.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (private_.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (url.asKnown().isPresent) 1 else 0) + + (if (branch.asKnown().isPresent) 1 else 0) + + (if (rootDir.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt index 41f05b20..9ca0dea6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt @@ -1581,7 +1581,7 @@ private constructor( mlModelId() passingGoalCount() bodyProjectId() - status() + status().validate() statusMessage() storageUri() totalGoalCount() @@ -1593,6 +1593,40 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (commit.asKnown().getOrNull()?.validity() ?: 0) + + (if (dateArchived.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (failingGoalCount.asKnown().isPresent) 1 else 0) + + (if (mlModelId.asKnown().isPresent) 1 else 0) + + (if (passingGoalCount.asKnown().isPresent) 1 else 0) + + (if (bodyProjectId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + (if (storageUri.asKnown().isPresent) 1 else 0) + + (if (totalGoalCount.asKnown().isPresent) 1 else 0) + + (if (trainingDatasetId.asKnown().isPresent) 1 else 0) + + (if (validationDatasetId.asKnown().isPresent) 1 else 0) + + (if (archived.asKnown().isPresent) 1 else 0) + + (if (deploymentStatus.asKnown().isPresent) 1 else 0) + + (links.asKnown().getOrNull()?.validity() ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2210,6 +2244,35 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (authorId.asKnown().isPresent) 1 else 0) + + (if (fileSize.asKnown().isPresent) 1 else 0) + + (if (message.asKnown().isPresent) 1 else 0) + + (if (mlModelId.asKnown().isPresent) 1 else 0) + + (if (storageUri.asKnown().isPresent) 1 else 0) + + (if (trainingDatasetId.asKnown().isPresent) 1 else 0) + + (if (validationDatasetId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (gitCommitRef.asKnown().isPresent) 1 else 0) + + (if (gitCommitSha.asKnown().isPresent) 1 else 0) + + (if (gitCommitUrl.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2343,6 +2406,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2474,6 +2564,22 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (app.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt index 3f5649f5..f28b09ce 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt @@ -805,7 +805,7 @@ private constructor( mlModelId() passingGoalCount() projectId() - status() + status().validate() statusMessage() storageUri() totalGoalCount() @@ -817,6 +817,39 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (commit.asKnown().getOrNull()?.validity() ?: 0) + + (if (dateArchived.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (failingGoalCount.asKnown().isPresent) 1 else 0) + + (if (mlModelId.asKnown().isPresent) 1 else 0) + + (if (passingGoalCount.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + (if (storageUri.asKnown().isPresent) 1 else 0) + + (if (totalGoalCount.asKnown().isPresent) 1 else 0) + + (if (trainingDatasetId.asKnown().isPresent) 1 else 0) + + (if (validationDatasetId.asKnown().isPresent) 1 else 0) + + (if (archived.asKnown().isPresent) 1 else 0) + + (if (deploymentStatus.asKnown().isPresent) 1 else 0) + + (links.asKnown().getOrNull()?.validity() ?: 0) + /** The details of a commit (project version). */ class Commit private constructor( @@ -1416,6 +1449,35 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (authorId.asKnown().isPresent) 1 else 0) + + (if (fileSize.asKnown().isPresent) 1 else 0) + + (if (message.asKnown().isPresent) 1 else 0) + + (if (mlModelId.asKnown().isPresent) 1 else 0) + + (if (storageUri.asKnown().isPresent) 1 else 0) + + (if (trainingDatasetId.asKnown().isPresent) 1 else 0) + + (if (validationDatasetId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (gitCommitRef.asKnown().isPresent) 1 else 0) + + (if (gitCommitSha.asKnown().isPresent) 1 else 0) + + (if (gitCommitUrl.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1549,6 +1611,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1680,6 +1769,22 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (app.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt index 92c586ab..ff18b25d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt @@ -154,6 +154,23 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + class Item private constructor( private val id: JsonField, @@ -958,7 +975,7 @@ private constructor( mlModelId() passingGoalCount() projectId() - status() + status().validate() statusMessage() storageUri() totalGoalCount() @@ -970,6 +987,40 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (commit.asKnown().getOrNull()?.validity() ?: 0) + + (if (dateArchived.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (failingGoalCount.asKnown().isPresent) 1 else 0) + + (if (mlModelId.asKnown().isPresent) 1 else 0) + + (if (passingGoalCount.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + (if (storageUri.asKnown().isPresent) 1 else 0) + + (if (totalGoalCount.asKnown().isPresent) 1 else 0) + + (if (trainingDatasetId.asKnown().isPresent) 1 else 0) + + (if (validationDatasetId.asKnown().isPresent) 1 else 0) + + (if (archived.asKnown().isPresent) 1 else 0) + + (if (deploymentStatus.asKnown().isPresent) 1 else 0) + + (links.asKnown().getOrNull()?.validity() ?: 0) + /** The details of a commit (project version). */ class Commit private constructor( @@ -1592,6 +1643,35 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (authorId.asKnown().isPresent) 1 else 0) + + (if (fileSize.asKnown().isPresent) 1 else 0) + + (if (message.asKnown().isPresent) 1 else 0) + + (if (mlModelId.asKnown().isPresent) 1 else 0) + + (if (storageUri.asKnown().isPresent) 1 else 0) + + (if (trainingDatasetId.asKnown().isPresent) 1 else 0) + + (if (validationDatasetId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (gitCommitRef.asKnown().isPresent) 1 else 0) + + (if (gitCommitSha.asKnown().isPresent) 1 else 0) + + (if (gitCommitUrl.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1727,6 +1807,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1862,6 +1969,22 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (app.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt index da3c7f1e..4340da74 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt @@ -1639,7 +1639,7 @@ private constructor( name() passingGoalCount() bodyProjectId() - status() + status().validate() statusMessage() totalGoalCount() project().ifPresent { it.validate() } @@ -1648,6 +1648,41 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateLastEvaluated.asKnown().isPresent) 1 else 0) + + (if (dateLastSampleReceived.asKnown().isPresent) 1 else 0) + + (if (dateOfNextEvaluation.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (if (failingGoalCount.asKnown().isPresent) 1 else 0) + + (links.asKnown().getOrNull()?.validity() ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (passingGoalCount.asKnown().isPresent) 1 else 0) + + (if (bodyProjectId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + (if (totalGoalCount.asKnown().isPresent) 1 else 0) + + (project.asKnown().getOrNull()?.validity() ?: 0) + + (workspace.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1784,6 +1819,22 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (app.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1913,6 +1964,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2656,8 +2734,8 @@ private constructor( links().validate() monitoringGoalCount() name() - source() - taskType() + source().ifPresent { it.validate() } + taskType().validate() versionCount() workspaceId() description() @@ -2665,6 +2743,39 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (developmentGoalCount.asKnown().isPresent) 1 else 0) + + (if (goalCount.asKnown().isPresent) 1 else 0) + + (if (inferencePipelineCount.asKnown().isPresent) 1 else 0) + + (links.asKnown().getOrNull()?.validity() ?: 0) + + (if (monitoringGoalCount.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (source.asKnown().getOrNull()?.validity() ?: 0) + + (taskType.asKnown().getOrNull()?.validity() ?: 0) + + (if (versionCount.asKnown().isPresent) 1 else 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (gitRepo.asKnown().getOrNull()?.validity() ?: 0) + /** Links to the project. */ class Links private constructor( @@ -2788,6 +2899,22 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (app.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2901,6 +3028,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Source = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3017,6 +3171,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): TaskType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3561,6 +3742,35 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateConnected.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (gitAccountId.asKnown().isPresent) 1 else 0) + + (if (gitId.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (private_.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (url.asKnown().isPresent) 1 else 0) + + (if (branch.asKnown().isPresent) 1 else 0) + + (if (rootDir.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4353,7 +4563,7 @@ private constructor( periodStartDate() projectCount() slug() - status() + status().validate() inviteCode() monthlyUsage().ifPresent { it.forEach { it.validate() } } samlOnlyAccess() @@ -4361,6 +4571,39 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (inviteCount.asKnown().isPresent) 1 else 0) + + (if (memberCount.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (periodEndDate.asKnown().isPresent) 1 else 0) + + (if (periodStartDate.asKnown().isPresent) 1 else 0) + + (if (projectCount.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (inviteCode.asKnown().isPresent) 1 else 0) + + (monthlyUsage.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (samlOnlyAccess.asKnown().isPresent) 1 else 0) + + (wildcardDomains.asKnown().getOrNull()?.size ?: 0) + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -4486,6 +4729,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4709,6 +4979,26 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (executionTimeMs.asKnown().isPresent) 1 else 0) + + (if (monthYear.asKnown().isPresent) 1 else 0) + + (if (predictionCount.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt index 332de897..5df9ab5a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt @@ -843,7 +843,7 @@ private constructor( name() passingGoalCount() projectId() - status() + status().validate() statusMessage() totalGoalCount() project().ifPresent { it.validate() } @@ -852,6 +852,40 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateLastEvaluated.asKnown().isPresent) 1 else 0) + + (if (dateLastSampleReceived.asKnown().isPresent) 1 else 0) + + (if (dateOfNextEvaluation.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (if (failingGoalCount.asKnown().isPresent) 1 else 0) + + (links.asKnown().getOrNull()?.validity() ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (passingGoalCount.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + (if (totalGoalCount.asKnown().isPresent) 1 else 0) + + (project.asKnown().getOrNull()?.validity() ?: 0) + + (workspace.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + class Links private constructor( private val app: JsonField, @@ -970,6 +1004,22 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (app.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1099,6 +1149,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1842,8 +1919,8 @@ private constructor( links().validate() monitoringGoalCount() name() - source() - taskType() + source().ifPresent { it.validate() } + taskType().validate() versionCount() workspaceId() description() @@ -1851,6 +1928,39 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (developmentGoalCount.asKnown().isPresent) 1 else 0) + + (if (goalCount.asKnown().isPresent) 1 else 0) + + (if (inferencePipelineCount.asKnown().isPresent) 1 else 0) + + (links.asKnown().getOrNull()?.validity() ?: 0) + + (if (monitoringGoalCount.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (source.asKnown().getOrNull()?.validity() ?: 0) + + (taskType.asKnown().getOrNull()?.validity() ?: 0) + + (if (versionCount.asKnown().isPresent) 1 else 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (gitRepo.asKnown().getOrNull()?.validity() ?: 0) + /** Links to the project. */ class Links private constructor( @@ -1974,6 +2084,22 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (app.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2087,6 +2213,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Source = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2203,6 +2356,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): TaskType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2747,6 +2927,35 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateConnected.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (gitAccountId.asKnown().isPresent) 1 else 0) + + (if (gitId.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (private_.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (url.asKnown().isPresent) 1 else 0) + + (if (branch.asKnown().isPresent) 1 else 0) + + (if (rootDir.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3539,7 +3748,7 @@ private constructor( periodStartDate() projectCount() slug() - status() + status().validate() inviteCode() monthlyUsage().ifPresent { it.forEach { it.validate() } } samlOnlyAccess() @@ -3547,6 +3756,39 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (inviteCount.asKnown().isPresent) 1 else 0) + + (if (memberCount.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (periodEndDate.asKnown().isPresent) 1 else 0) + + (if (periodStartDate.asKnown().isPresent) 1 else 0) + + (if (projectCount.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (inviteCode.asKnown().isPresent) 1 else 0) + + (monthlyUsage.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (samlOnlyAccess.asKnown().isPresent) 1 else 0) + + (wildcardDomains.asKnown().getOrNull()?.size ?: 0) + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -3672,6 +3914,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3895,6 +4164,26 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (executionTimeMs.asKnown().isPresent) 1 else 0) + + (if (monthYear.asKnown().isPresent) 1 else 0) + + (if (predictionCount.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt index 829158de..33ca0476 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt @@ -156,6 +156,23 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + class Item private constructor( private val id: JsonField, @@ -996,7 +1013,7 @@ private constructor( name() passingGoalCount() projectId() - status() + status().validate() statusMessage() totalGoalCount() project().ifPresent { it.validate() } @@ -1005,6 +1022,41 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateLastEvaluated.asKnown().isPresent) 1 else 0) + + (if (dateLastSampleReceived.asKnown().isPresent) 1 else 0) + + (if (dateOfNextEvaluation.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (if (failingGoalCount.asKnown().isPresent) 1 else 0) + + (links.asKnown().getOrNull()?.validity() ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (passingGoalCount.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + (if (totalGoalCount.asKnown().isPresent) 1 else 0) + + (project.asKnown().getOrNull()?.validity() ?: 0) + + (workspace.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + class Links private constructor( private val app: JsonField, @@ -1127,6 +1179,22 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (app.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1258,6 +1326,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2038,8 +2133,8 @@ private constructor( links().validate() monitoringGoalCount() name() - source() - taskType() + source().ifPresent { it.validate() } + taskType().validate() versionCount() workspaceId() description() @@ -2047,6 +2142,39 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (developmentGoalCount.asKnown().isPresent) 1 else 0) + + (if (goalCount.asKnown().isPresent) 1 else 0) + + (if (inferencePipelineCount.asKnown().isPresent) 1 else 0) + + (links.asKnown().getOrNull()?.validity() ?: 0) + + (if (monitoringGoalCount.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (source.asKnown().getOrNull()?.validity() ?: 0) + + (taskType.asKnown().getOrNull()?.validity() ?: 0) + + (if (versionCount.asKnown().isPresent) 1 else 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (gitRepo.asKnown().getOrNull()?.validity() ?: 0) + /** Links to the project. */ class Links private constructor( @@ -2170,6 +2298,22 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (app.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2286,6 +2430,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Source = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2403,6 +2574,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): TaskType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2964,6 +3162,35 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateConnected.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (gitAccountId.asKnown().isPresent) 1 else 0) + + (if (gitId.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (private_.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (url.asKnown().isPresent) 1 else 0) + + (if (branch.asKnown().isPresent) 1 else 0) + + (if (rootDir.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3789,7 +4016,7 @@ private constructor( periodStartDate() projectCount() slug() - status() + status().validate() inviteCode() monthlyUsage().ifPresent { it.forEach { it.validate() } } samlOnlyAccess() @@ -3797,6 +4024,39 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (inviteCount.asKnown().isPresent) 1 else 0) + + (if (memberCount.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (periodEndDate.asKnown().isPresent) 1 else 0) + + (if (periodStartDate.asKnown().isPresent) 1 else 0) + + (if (projectCount.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (inviteCode.asKnown().isPresent) 1 else 0) + + (monthlyUsage.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (samlOnlyAccess.asKnown().isPresent) 1 else 0) + + (wildcardDomains.asKnown().getOrNull()?.size ?: 0) + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -3924,6 +4184,33 @@ private constructor( OpenlayerInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4148,6 +4435,26 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (executionTimeMs.asKnown().isPresent) 1 else 0) + + (if (monthYear.asKnown().isPresent) 1 else 0) + + (if (predictionCount.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt index 5cdbc35e..953cc735 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponse.kt @@ -186,6 +186,23 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (storageUri.asKnown().isPresent) 1 else 0) + (if (url.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt index b7f0de52..0d78d471 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt @@ -2,6 +2,8 @@ package com.openlayer.api.models.commits +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -98,4 +100,57 @@ internal class CommitRetrieveResponseTest { .build() ) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val commitRetrieveResponse = + CommitRetrieveResponse.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commit( + CommitRetrieveResponse.Commit.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .fileSize(1024L) + .message("Updated the prompt.") + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .storageUri("s3://...") + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .gitCommitRef("main") + .gitCommitSha(0L) + .gitCommitUrl("gitCommitUrl") + .build() + ) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(1L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(CommitRetrieveResponse.Status.QUEUED) + .statusMessage("Commit successfully processed.") + .totalGoalCount(6L) + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .archived(false) + .deploymentStatus("Deployed") + .links( + CommitRetrieveResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .build() + + val roundtrippedCommitRetrieveResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(commitRetrieveResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedCommitRetrieveResponse).isEqualTo(commitRetrieveResponse) + } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt index 11c30854..db3fb096 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt @@ -2,7 +2,9 @@ package com.openlayer.api.models.commits.testresults +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -121,4 +123,72 @@ internal class TestResultListResponseTest { .build() ) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val testResultListResponse = + TestResultListResponse.builder() + .addItem( + TestResultListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateDataEnds(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateDataStarts(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(TestResultListResponse.Item.Status.RUNNING) + .statusMessage("Test successfully processed.") + .goal( + TestResultListResponse.Item.Goal.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(0L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description( + JsonValue.from( + "This test checks for duplicate rows in the dataset." + ) + ) + .name("No duplicate rows") + .number(1L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(false) + .addThreshold( + TestResultListResponse.Item.Goal.Threshold.builder() + .insightName("duplicateRowCount") + .addInsightParameter(JsonValue.from(mapOf())) + .measurement("duplicateRowCount") + .operator("<=") + .value(0.0) + .build() + ) + .type("integrity") + .archived(false) + .delayWindow(0.0) + .evaluationWindow(3600.0) + .usesMlModel(false) + .usesProductionData(false) + .usesReferenceDataset(false) + .usesTrainingDataset(false) + .usesValidationDataset(true) + .build() + ) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + ) + .build() + + val roundtrippedTestResultListResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(testResultListResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedTestResultListResponse).isEqualTo(testResultListResponse) + } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt index cdfc0ddb..e7793364 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt @@ -2,6 +2,8 @@ package com.openlayer.api.models.inferencepipelines +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper import java.time.LocalDate import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat @@ -206,4 +208,109 @@ internal class InferencePipelineRetrieveResponseTest { assertThat(inferencePipelineRetrieveResponse.workspaceId()) .contains("055fddb1-261f-4654-8598-f6347ee46a09") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val inferencePipelineRetrieveResponse = + InferencePipelineRetrieveResponse.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastSampleReceived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description("This pipeline is used for production.") + .failingGoalCount(1L) + .links( + InferencePipelineRetrieveResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .name("production") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(InferencePipelineRetrieveResponse.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(6L) + .project( + InferencePipelineRetrieveResponse.Project.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + InferencePipelineRetrieveResponse.Project.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) + .name("My Project") + .source(InferencePipelineRetrieveResponse.Project.Source.WEB) + .taskType(InferencePipelineRetrieveResponse.Project.TaskType.LLM_BASE) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .description("My project description.") + .gitRepo( + InferencePipelineRetrieveResponse.Project.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .build() + ) + .workspace( + InferencePipelineRetrieveResponse.Workspace.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .inviteCount(0L) + .memberCount(0L) + .name("Openlayer") + .periodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .projectCount(0L) + .slug("openlayer") + .status(InferencePipelineRetrieveResponse.Workspace.Status.ACTIVE) + .addMonthlyUsage( + InferencePipelineRetrieveResponse.Workspace.MonthlyUsage.builder() + .executionTimeMs(0L) + .monthYear(LocalDate.parse("2019-12-27")) + .predictionCount(0L) + .build() + ) + .samlOnlyAccess(true) + .addWildcardDomain("string") + .build() + ) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .build() + + val roundtrippedInferencePipelineRetrieveResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(inferencePipelineRetrieveResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedInferencePipelineRetrieveResponse) + .isEqualTo(inferencePipelineRetrieveResponse) + } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt index ed7a6ec2..c7efc74e 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt @@ -2,6 +2,8 @@ package com.openlayer.api.models.inferencepipelines +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper import java.time.LocalDate import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat @@ -206,4 +208,109 @@ internal class InferencePipelineUpdateResponseTest { assertThat(inferencePipelineUpdateResponse.workspaceId()) .contains("055fddb1-261f-4654-8598-f6347ee46a09") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val inferencePipelineUpdateResponse = + InferencePipelineUpdateResponse.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastSampleReceived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description("This pipeline is used for production.") + .failingGoalCount(1L) + .links( + InferencePipelineUpdateResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .name("production") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(InferencePipelineUpdateResponse.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(6L) + .project( + InferencePipelineUpdateResponse.Project.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + InferencePipelineUpdateResponse.Project.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) + .name("My Project") + .source(InferencePipelineUpdateResponse.Project.Source.WEB) + .taskType(InferencePipelineUpdateResponse.Project.TaskType.LLM_BASE) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .description("My project description.") + .gitRepo( + InferencePipelineUpdateResponse.Project.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .build() + ) + .workspace( + InferencePipelineUpdateResponse.Workspace.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .inviteCount(0L) + .memberCount(0L) + .name("Openlayer") + .periodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .projectCount(0L) + .slug("openlayer") + .status(InferencePipelineUpdateResponse.Workspace.Status.ACTIVE) + .addMonthlyUsage( + InferencePipelineUpdateResponse.Workspace.MonthlyUsage.builder() + .executionTimeMs(0L) + .monthYear(LocalDate.parse("2019-12-27")) + .predictionCount(0L) + .build() + ) + .samlOnlyAccess(true) + .addWildcardDomain("string") + .build() + ) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .build() + + val roundtrippedInferencePipelineUpdateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(inferencePipelineUpdateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedInferencePipelineUpdateResponse) + .isEqualTo(inferencePipelineUpdateResponse) + } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponseTest.kt index c4973097..650b2051 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamResponseTest.kt @@ -2,6 +2,8 @@ package com.openlayer.api.models.inferencepipelines.data +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -14,4 +16,19 @@ internal class DataStreamResponseTest { assertThat(dataStreamResponse.success()).isEqualTo(DataStreamResponse.Success.TRUE) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val dataStreamResponse = + DataStreamResponse.builder().success(DataStreamResponse.Success.TRUE).build() + + val roundtrippedDataStreamResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(dataStreamResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedDataStreamResponse).isEqualTo(dataStreamResponse) + } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponseTest.kt index 28568e08..102493a0 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateResponseTest.kt @@ -2,6 +2,8 @@ package com.openlayer.api.models.inferencepipelines.rows +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -14,4 +16,19 @@ internal class RowUpdateResponseTest { assertThat(rowUpdateResponse.success()).isEqualTo(RowUpdateResponse.Success.TRUE) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val rowUpdateResponse = + RowUpdateResponse.builder().success(RowUpdateResponse.Success.TRUE).build() + + val roundtrippedRowUpdateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(rowUpdateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRowUpdateResponse).isEqualTo(rowUpdateResponse) + } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt index aaddfb19..18efcffe 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt @@ -2,7 +2,9 @@ package com.openlayer.api.models.inferencepipelines.testresults +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -121,4 +123,72 @@ internal class TestResultListResponseTest { .build() ) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val testResultListResponse = + TestResultListResponse.builder() + .addItem( + TestResultListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateDataEnds(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateDataStarts(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(TestResultListResponse.Item.Status.RUNNING) + .statusMessage("Test successfully processed.") + .goal( + TestResultListResponse.Item.Goal.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(0L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description( + JsonValue.from( + "This test checks for duplicate rows in the dataset." + ) + ) + .name("No duplicate rows") + .number(1L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(false) + .addThreshold( + TestResultListResponse.Item.Goal.Threshold.builder() + .insightName("duplicateRowCount") + .addInsightParameter(JsonValue.from(mapOf())) + .measurement("duplicateRowCount") + .operator("<=") + .value(0.0) + .build() + ) + .type("integrity") + .archived(false) + .delayWindow(0.0) + .evaluationWindow(3600.0) + .usesMlModel(false) + .usesProductionData(false) + .usesReferenceDataset(false) + .usesTrainingDataset(false) + .usesValidationDataset(true) + .build() + ) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + ) + .build() + + val roundtrippedTestResultListResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(testResultListResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedTestResultListResponse).isEqualTo(testResultListResponse) + } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateResponseTest.kt index f3ecb620..9eae557b 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectCreateResponseTest.kt @@ -2,6 +2,8 @@ package com.openlayer.api.models.projects +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -96,4 +98,57 @@ internal class ProjectCreateResponseTest { .build() ) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val projectCreateResponse = + ProjectCreateResponse.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + ProjectCreateResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) + .name("My Project") + .source(ProjectCreateResponse.Source.WEB) + .taskType(ProjectCreateResponse.TaskType.LLM_BASE) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .description("My project description.") + .gitRepo( + ProjectCreateResponse.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .build() + + val roundtrippedProjectCreateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(projectCreateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedProjectCreateResponse).isEqualTo(projectCreateResponse) + } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListResponseTest.kt index 1a8a28c7..5b68ccac 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/ProjectListResponseTest.kt @@ -2,6 +2,8 @@ package com.openlayer.api.models.projects +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -98,4 +100,61 @@ internal class ProjectListResponseTest { .build() ) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val projectListResponse = + ProjectListResponse.builder() + .addItem( + ProjectListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + ProjectListResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) + .name("My Project") + .source(ProjectListResponse.Item.Source.WEB) + .taskType(ProjectListResponse.Item.TaskType.LLM_BASE) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .description("My project description.") + .gitRepo( + ProjectListResponse.Item.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .build() + ) + .build() + + val roundtrippedProjectListResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(projectListResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedProjectListResponse).isEqualTo(projectListResponse) + } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt index b8ec9cd9..ad2e5cb1 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt @@ -2,6 +2,8 @@ package com.openlayer.api.models.projects.commits +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -97,4 +99,57 @@ internal class CommitCreateResponseTest { .build() ) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val commitCreateResponse = + CommitCreateResponse.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commit( + CommitCreateResponse.Commit.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .fileSize(1024L) + .message("Updated the prompt.") + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .storageUri("s3://...") + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .gitCommitRef("main") + .gitCommitSha(0L) + .gitCommitUrl("gitCommitUrl") + .build() + ) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(1L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(CommitCreateResponse.Status.QUEUED) + .statusMessage("Commit successfully processed.") + .totalGoalCount(6L) + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .archived(false) + .deploymentStatus("Deployed") + .links( + CommitCreateResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .build() + + val roundtrippedCommitCreateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(commitCreateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedCommitCreateResponse).isEqualTo(commitCreateResponse) + } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt index a6ef21e7..89a9b7f0 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt @@ -2,6 +2,8 @@ package com.openlayer.api.models.projects.commits +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -98,4 +100,61 @@ internal class CommitListResponseTest { .build() ) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val commitListResponse = + CommitListResponse.builder() + .addItem( + CommitListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commit( + CommitListResponse.Item.Commit.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .fileSize(1024L) + .message("Updated the prompt.") + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .storageUri("s3://...") + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .gitCommitRef("main") + .gitCommitSha(0L) + .gitCommitUrl("gitCommitUrl") + .build() + ) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(1L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(CommitListResponse.Item.Status.QUEUED) + .statusMessage("Commit successfully processed.") + .totalGoalCount(6L) + .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .archived(false) + .deploymentStatus("Deployed") + .links( + CommitListResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .build() + ) + .build() + + val roundtrippedCommitListResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(commitListResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedCommitListResponse).isEqualTo(commitListResponse) + } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt index 27e5e421..75f658b8 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt @@ -2,6 +2,8 @@ package com.openlayer.api.models.projects.inferencepipelines +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper import java.time.LocalDate import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat @@ -206,4 +208,109 @@ internal class InferencePipelineCreateResponseTest { assertThat(inferencePipelineCreateResponse.workspaceId()) .contains("055fddb1-261f-4654-8598-f6347ee46a09") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val inferencePipelineCreateResponse = + InferencePipelineCreateResponse.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastSampleReceived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description("This pipeline is used for production.") + .failingGoalCount(1L) + .links( + InferencePipelineCreateResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .name("production") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(InferencePipelineCreateResponse.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(6L) + .project( + InferencePipelineCreateResponse.Project.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + InferencePipelineCreateResponse.Project.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) + .name("My Project") + .source(InferencePipelineCreateResponse.Project.Source.WEB) + .taskType(InferencePipelineCreateResponse.Project.TaskType.LLM_BASE) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .description("My project description.") + .gitRepo( + InferencePipelineCreateResponse.Project.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .build() + ) + .workspace( + InferencePipelineCreateResponse.Workspace.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .inviteCount(0L) + .memberCount(0L) + .name("Openlayer") + .periodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .projectCount(0L) + .slug("openlayer") + .status(InferencePipelineCreateResponse.Workspace.Status.ACTIVE) + .addMonthlyUsage( + InferencePipelineCreateResponse.Workspace.MonthlyUsage.builder() + .executionTimeMs(0L) + .monthYear(LocalDate.parse("2019-12-27")) + .predictionCount(0L) + .build() + ) + .samlOnlyAccess(true) + .addWildcardDomain("string") + .build() + ) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .build() + + val roundtrippedInferencePipelineCreateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(inferencePipelineCreateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedInferencePipelineCreateResponse) + .isEqualTo(inferencePipelineCreateResponse) + } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt index 54344291..9ace9e03 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt @@ -2,6 +2,8 @@ package com.openlayer.api.models.projects.inferencepipelines +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper import java.time.LocalDate import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat @@ -208,4 +210,120 @@ internal class InferencePipelineListResponseTest { .build() ) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val inferencePipelineListResponse = + InferencePipelineListResponse.builder() + .addItem( + InferencePipelineListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastSampleReceived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description("This pipeline is used for production.") + .failingGoalCount(1L) + .links( + InferencePipelineListResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .name("production") + .passingGoalCount(5L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(InferencePipelineListResponse.Item.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(6L) + .project( + InferencePipelineListResponse.Item.Project.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + InferencePipelineListResponse.Item.Project.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) + .name("My Project") + .source(InferencePipelineListResponse.Item.Project.Source.WEB) + .taskType( + InferencePipelineListResponse.Item.Project.TaskType.LLM_BASE + ) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .description("My project description.") + .gitRepo( + InferencePipelineListResponse.Item.Project.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .dateUpdated( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .build() + ) + .workspace( + InferencePipelineListResponse.Item.Workspace.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .inviteCount(0L) + .memberCount(0L) + .name("Openlayer") + .periodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .periodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .projectCount(0L) + .slug("openlayer") + .status(InferencePipelineListResponse.Item.Workspace.Status.ACTIVE) + .addMonthlyUsage( + InferencePipelineListResponse.Item.Workspace.MonthlyUsage + .builder() + .executionTimeMs(0L) + .monthYear(LocalDate.parse("2019-12-27")) + .predictionCount(0L) + .build() + ) + .samlOnlyAccess(true) + .addWildcardDomain("string") + .build() + ) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .build() + ) + .build() + + val roundtrippedInferencePipelineListResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(inferencePipelineListResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedInferencePipelineListResponse) + .isEqualTo(inferencePipelineListResponse) + } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponseTest.kt index af5fd427..7ae0134d 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateResponseTest.kt @@ -2,7 +2,9 @@ package com.openlayer.api.models.storage.presignedurl +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -22,4 +24,23 @@ internal class PresignedUrlCreateResponseTest { assertThat(presignedUrlCreateResponse._fields()) .isEqualTo(JsonValue.from(mapOf())) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val presignedUrlCreateResponse = + PresignedUrlCreateResponse.builder() + .storageUri("storageUri") + .url("url") + .fields(JsonValue.from(mapOf())) + .build() + + val roundtrippedPresignedUrlCreateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(presignedUrlCreateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedPresignedUrlCreateResponse).isEqualTo(presignedUrlCreateResponse) + } } From ac0fa470239a5ad32e3d372354f63da231a98480 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 3 Apr 2025 07:55:36 +0000 Subject: [PATCH 40/74] feat(client): make datetime deserialization more lenient (#105) --- .../com/openlayer/api/core/ObjectMappers.kt | 64 ++++++++++++++++++- .../openlayer/api/core/ObjectMappersTest.kt | 21 ++++++ 2 files changed, 83 insertions(+), 2 deletions(-) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt index 1a642eb0..1438d8ea 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ObjectMappers.kt @@ -4,12 +4,16 @@ package com.openlayer.api.core import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.JsonParseException +import com.fasterxml.jackson.core.JsonParser +import com.fasterxml.jackson.databind.DeserializationContext import com.fasterxml.jackson.databind.DeserializationFeature import com.fasterxml.jackson.databind.MapperFeature import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.cfg.CoercionAction import com.fasterxml.jackson.databind.cfg.CoercionInputShape +import com.fasterxml.jackson.databind.deser.std.StdDeserializer import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.databind.module.SimpleModule import com.fasterxml.jackson.databind.type.LogicalType @@ -17,13 +21,23 @@ import com.fasterxml.jackson.datatype.jdk8.Jdk8Module import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import com.fasterxml.jackson.module.kotlin.kotlinModule import java.io.InputStream +import java.time.DateTimeException +import java.time.LocalDate +import java.time.LocalDateTime +import java.time.ZonedDateTime +import java.time.format.DateTimeFormatter +import java.time.temporal.ChronoField fun jsonMapper(): JsonMapper = JsonMapper.builder() .addModule(kotlinModule()) .addModule(Jdk8Module()) .addModule(JavaTimeModule()) - .addModule(SimpleModule().addSerializer(InputStreamJsonSerializer)) + .addModule( + SimpleModule() + .addSerializer(InputStreamSerializer) + .addDeserializer(LocalDateTime::class.java, LenientLocalDateTimeDeserializer()) + ) .withCoercionConfig(LogicalType.Boolean) { it.setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) @@ -91,7 +105,10 @@ fun jsonMapper(): JsonMapper = .disable(MapperFeature.AUTO_DETECT_SETTERS) .build() -private object InputStreamJsonSerializer : BaseSerializer(InputStream::class) { +/** A serializer that serializes [InputStream] to bytes. */ +private object InputStreamSerializer : BaseSerializer(InputStream::class) { + + private fun readResolve(): Any = InputStreamSerializer override fun serialize( value: InputStream?, @@ -105,3 +122,46 @@ private object InputStreamJsonSerializer : BaseSerializer(InputStre } } } + +/** + * A deserializer that can deserialize [LocalDateTime] from datetimes, dates, and zoned datetimes. + */ +private class LenientLocalDateTimeDeserializer : + StdDeserializer(LocalDateTime::class.java) { + + companion object { + + private val DATE_TIME_FORMATTERS = + listOf( + DateTimeFormatter.ISO_LOCAL_DATE_TIME, + DateTimeFormatter.ISO_LOCAL_DATE, + DateTimeFormatter.ISO_ZONED_DATE_TIME, + ) + } + + override fun logicalType(): LogicalType = LogicalType.DateTime + + override fun deserialize(p: JsonParser, context: DeserializationContext?): LocalDateTime { + val exceptions = mutableListOf() + + for (formatter in DATE_TIME_FORMATTERS) { + try { + val temporal = formatter.parse(p.text) + + return when { + !temporal.isSupported(ChronoField.HOUR_OF_DAY) -> + LocalDate.from(temporal).atStartOfDay() + !temporal.isSupported(ChronoField.OFFSET_SECONDS) -> + LocalDateTime.from(temporal) + else -> ZonedDateTime.from(temporal).toLocalDateTime() + } + } catch (e: DateTimeException) { + exceptions.add(e) + } + } + + throw JsonParseException(p, "Cannot parse `LocalDateTime` from value: ${p.text}").apply { + exceptions.forEach { addSuppressed(it) } + } + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/ObjectMappersTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/ObjectMappersTest.kt index 6689f351..d1ae0df7 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/ObjectMappersTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/ObjectMappersTest.kt @@ -2,10 +2,15 @@ package com.openlayer.api.core import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.exc.MismatchedInputException +import com.fasterxml.jackson.module.kotlin.readValue +import java.time.LocalDateTime import kotlin.reflect.KClass import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.catchThrowable import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertDoesNotThrow +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.EnumSource import org.junitpioneer.jupiter.cartesian.CartesianTest internal class ObjectMappersTest { @@ -78,4 +83,20 @@ internal class ObjectMappersTest { assertThat(e).isInstanceOf(MismatchedInputException::class.java) } } + + enum class LenientLocalDateTimeTestCase(val string: String) { + DATE("1998-04-21"), + DATE_TIME("1998-04-21T04:00:00"), + ZONED_DATE_TIME_1("1998-04-21T04:00:00+03:00"), + ZONED_DATE_TIME_2("1998-04-21T04:00:00Z"), + } + + @ParameterizedTest + @EnumSource + fun readLocalDateTime_lenient(testCase: LenientLocalDateTimeTestCase) { + val jsonMapper = jsonMapper() + val json = jsonMapper.writeValueAsString(testCase.string) + + assertDoesNotThrow { jsonMapper().readValue(json) } + } } From 8725baa3ddd8d7fe53c607cd9d2e7f14373b37df Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 3 Apr 2025 08:36:36 +0000 Subject: [PATCH 41/74] feat(client): expose request body setter and getter (#106) --- .../InferencePipelineDeleteParams.kt | 3 +-- .../InferencePipelineUpdateParams.kt | 13 ++++++++++++- .../inferencepipelines/data/DataStreamParams.kt | 12 +++++++++++- .../inferencepipelines/rows/RowUpdateParams.kt | 12 +++++++++++- .../api/models/projects/ProjectCreateParams.kt | 16 +++++++++++++++- .../projects/commits/CommitCreateParams.kt | 16 +++++++++++++++- .../InferencePipelineCreateParams.kt | 16 +++++++++++++++- .../presignedurl/PresignedUrlCreateParams.kt | 3 +-- 8 files changed, 81 insertions(+), 10 deletions(-) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt index 74adcaf7..f1034953 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineDeleteParams.kt @@ -206,8 +206,7 @@ private constructor( ) } - @JvmSynthetic - internal fun _body(): Optional> = + fun _body(): Optional> = Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) fun _pathParam(index: Int): String = diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt index 3a9bc18e..9b3e669d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt @@ -120,6 +120,17 @@ private constructor( this.inferencePipelineId = inferencePipelineId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [description] + * - [name] + * - [referenceDatasetUri] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** The inference pipeline description. */ fun description(description: String?) = apply { body.description(description) } @@ -309,7 +320,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt index 0c636717..f5f6fcf1 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt @@ -117,6 +117,16 @@ private constructor( this.inferencePipelineId = inferencePipelineId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [config] + * - [rows] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ fun config(config: Config) = apply { body.config(config) } @@ -312,7 +322,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt index 720e088b..f04159d5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt @@ -98,6 +98,16 @@ private constructor( /** Specify the inference id as a query param. */ fun inferenceId(inferenceId: String) = apply { this.inferenceId = inferenceId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [row] + * - [config] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + fun row(row: JsonValue) = apply { body.row(row) } fun config(config: Config?) = apply { body.config(config) } @@ -254,7 +264,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt index adf8f852..a1c5a3f4 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt @@ -319,6 +319,20 @@ private constructor( additionalQueryParams = projectCreateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [id] + * - [creatorId] + * - [dateCreated] + * - [dateUpdated] + * - [developmentGoalCount] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** The project id. */ fun id(id: String) = apply { body.id(id) } @@ -685,7 +699,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt index 9ca0dea6..98df0084 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt @@ -345,6 +345,20 @@ private constructor( fun pathProjectId(pathProjectId: String) = apply { this.pathProjectId = pathProjectId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [id] + * - [commit] + * - [dateArchived] + * - [dateCreated] + * - [failingGoalCount] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** The project version (commit) id. */ fun id(id: String) = apply { body.id(id) } @@ -760,7 +774,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt index 4340da74..e0019dbe 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt @@ -360,6 +360,20 @@ private constructor( fun pathProjectId(pathProjectId: String) = apply { this.pathProjectId = pathProjectId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [id] + * - [dateCreated] + * - [dateLastEvaluated] + * - [dateLastSampleReceived] + * - [dateOfNextEvaluation] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** The inference pipeline id. */ fun id(id: String) = apply { body.id(id) } @@ -782,7 +796,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt index 10434f89..b4bde349 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlCreateParams.kt @@ -205,8 +205,7 @@ private constructor( ) } - @JvmSynthetic - internal fun _body(): Optional> = + fun _body(): Optional> = Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) override fun _headers(): Headers = additionalHeaders From 3bd7a4cc174f22a5e2ef4510ee1576563ad608c2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 4 Apr 2025 09:45:54 +0000 Subject: [PATCH 42/74] perf(client): cached parsed type in `HttpResponseFor` (#107) --- .../kotlin/com/openlayer/api/core/http/HttpResponseFor.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponseFor.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponseFor.kt index 594d4825..3ef21016 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponseFor.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpResponseFor.kt @@ -11,7 +11,9 @@ interface HttpResponseFor : HttpResponse { internal fun HttpResponse.parseable(parse: () -> T): HttpResponseFor = object : HttpResponseFor { - override fun parse(): T = parse() + private val parsed: T by lazy { parse() } + + override fun parse(): T = parsed override fun statusCode(): Int = this@parseable.statusCode() From 3975381f2e6a9183a11200ca5a2e1ff5a260e784 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 5 Apr 2025 02:31:20 +0000 Subject: [PATCH 43/74] chore(internal): swap from `getNullable` to `getOptional` (#108) --- .../kotlin/com/openlayer/api/core/Values.kt | 8 +- .../models/commits/CommitRetrieveResponse.kt | 40 ++++------ .../testresults/TestResultListResponse.kt | 57 ++++++------- .../InferencePipelineRetrieveResponse.kt | 62 ++++++--------- .../InferencePipelineUpdateParams.kt | 7 +- .../InferencePipelineUpdateResponse.kt | 62 ++++++--------- .../data/DataStreamParams.kt | 79 ++++++++----------- .../rows/RowUpdateParams.kt | 12 +-- .../testresults/TestResultListResponse.kt | 57 ++++++------- .../models/projects/ProjectCreateParams.kt | 16 ++-- .../models/projects/ProjectCreateResponse.kt | 16 ++-- .../models/projects/ProjectListResponse.kt | 16 ++-- .../projects/commits/CommitCreateParams.kt | 39 ++++----- .../projects/commits/CommitCreateResponse.kt | 40 ++++------ .../projects/commits/CommitListResponse.kt | 40 ++++------ .../InferencePipelineCreateParams.kt | 63 ++++++--------- .../InferencePipelineCreateResponse.kt | 62 ++++++--------- .../InferencePipelineListResponse.kt | 62 ++++++--------- 18 files changed, 303 insertions(+), 435 deletions(-) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt index 3fdd3641..4fcdb37d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt @@ -132,11 +132,11 @@ sealed class JsonField { } @JvmSynthetic - internal fun getNullable(name: String): T? = + internal fun getOptional(name: String): Optional<@UnsafeVariance T> = when (this) { - is KnownValue -> value - is JsonMissing -> null - is JsonNull -> null + is KnownValue -> Optional.of(value) + is JsonMissing, + is JsonNull -> Optional.empty() else -> throw OpenlayerInvalidDataException("`$name` is invalid, received $this") } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt index 99fb06d6..952bdd3c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt @@ -123,8 +123,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun dateArchived(): Optional = - Optional.ofNullable(dateArchived.getNullable("dateArchived")) + fun dateArchived(): Optional = dateArchived.getOptional("dateArchived") /** * The project version (commit) creation date. @@ -148,7 +147,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + fun mlModelId(): Optional = mlModelId.getOptional("mlModelId") /** * The number of tests that are passing for the commit. @@ -181,8 +180,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") /** * The storage URI where the commit bundle is stored. @@ -206,8 +204,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun trainingDatasetId(): Optional = - Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + fun trainingDatasetId(): Optional = trainingDatasetId.getOptional("trainingDatasetId") /** * The validation dataset id. @@ -216,7 +213,7 @@ private constructor( * server responded with an unexpected value). */ fun validationDatasetId(): Optional = - Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + validationDatasetId.getOptional("validationDatasetId") /** * Whether the commit is archived. @@ -224,7 +221,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) + fun archived(): Optional = archived.getOptional("archived") /** * The deployment status associated with the commit's model. @@ -232,14 +229,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun deploymentStatus(): Optional = - Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + fun deploymentStatus(): Optional = deploymentStatus.getOptional("deploymentStatus") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun links(): Optional = Optional.ofNullable(links.getNullable("links")) + fun links(): Optional = links.getOptional("links") /** * Returns the raw JSON value of [id]. @@ -938,7 +934,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun fileSize(): Optional = Optional.ofNullable(fileSize.getNullable("fileSize")) + fun fileSize(): Optional = fileSize.getOptional("fileSize") /** * The commit message. @@ -954,7 +950,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + fun mlModelId(): Optional = mlModelId.getOptional("mlModelId") /** * The storage URI where the commit bundle is stored. @@ -971,7 +967,7 @@ private constructor( * the server responded with an unexpected value). */ fun trainingDatasetId(): Optional = - Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + trainingDatasetId.getOptional("trainingDatasetId") /** * The validation dataset id. @@ -980,7 +976,7 @@ private constructor( * the server responded with an unexpected value). */ fun validationDatasetId(): Optional = - Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + validationDatasetId.getOptional("validationDatasetId") /** * The commit creation date. @@ -988,8 +984,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun dateCreated(): Optional = - Optional.ofNullable(dateCreated.getNullable("dateCreated")) + fun dateCreated(): Optional = dateCreated.getOptional("dateCreated") /** * The ref of the corresponding git commit. @@ -997,8 +992,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun gitCommitRef(): Optional = - Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) + fun gitCommitRef(): Optional = gitCommitRef.getOptional("gitCommitRef") /** * The SHA of the corresponding git commit. @@ -1006,8 +1000,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun gitCommitSha(): Optional = - Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) + fun gitCommitSha(): Optional = gitCommitSha.getOptional("gitCommitSha") /** * The URL of the corresponding git commit. @@ -1015,8 +1008,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun gitCommitUrl(): Optional = - Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) + fun gitCommitUrl(): Optional = gitCommitUrl.getOptional("gitCommitUrl") /** * Returns the raw JSON value of [id]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt index e7a82450..fb24b414 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt @@ -262,8 +262,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun dateDataEnds(): Optional = - Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) + fun dateDataEnds(): Optional = dateDataEnds.getOptional("dateDataEnds") /** * The data start date. @@ -272,7 +271,7 @@ private constructor( * the server responded with an unexpected value). */ fun dateDataStarts(): Optional = - Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) + dateDataStarts.getOptional("dateDataStarts") /** * The last updated date. @@ -289,7 +288,7 @@ private constructor( * the server responded with an unexpected value). */ fun inferencePipelineId(): Optional = - Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) + inferencePipelineId.getOptional("inferencePipelineId") /** * The project version (commit) id. @@ -297,8 +296,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun projectVersionId(): Optional = - Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) + fun projectVersionId(): Optional = projectVersionId.getOptional("projectVersionId") /** * The status of the test. @@ -314,14 +312,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun goal(): Optional = Optional.ofNullable(goal.getNullable("goal")) + fun goal(): Optional = goal.getOptional("goal") /** * The test id. @@ -329,7 +326,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun goalId(): Optional = Optional.ofNullable(goalId.getNullable("goalId")) + fun goalId(): Optional = goalId.getOptional("goalId") /** * Returns the raw JSON value of [id]. @@ -1060,8 +1057,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun creatorId(): Optional = - Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = creatorId.getOptional("creatorId") /** * The date the test was archived. @@ -1069,8 +1065,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun dateArchived(): Optional = - Optional.ofNullable(dateArchived.getNullable("dateArchived")) + fun dateArchived(): Optional = dateArchived.getOptional("dateArchived") /** * The creation date. @@ -1118,7 +1113,7 @@ private constructor( * if the server responded with an unexpected value). */ fun originProjectVersionId(): Optional = - Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) + originProjectVersionId.getOptional("originProjectVersionId") /** * The test subtype. @@ -1160,8 +1155,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun archived(): Optional = - Optional.ofNullable(archived.getNullable("archived")) + fun archived(): Optional = archived.getOptional("archived") /** * The delay window in seconds. Only applies to tests that use production data. @@ -1169,8 +1163,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun delayWindow(): Optional = - Optional.ofNullable(delayWindow.getNullable("delayWindow")) + fun delayWindow(): Optional = delayWindow.getOptional("delayWindow") /** * The evaluation window in seconds. Only applies to tests that use production data. @@ -1179,7 +1172,7 @@ private constructor( * if the server responded with an unexpected value). */ fun evaluationWindow(): Optional = - Optional.ofNullable(evaluationWindow.getNullable("evaluationWindow")) + evaluationWindow.getOptional("evaluationWindow") /** * Whether the test uses an ML model. @@ -1187,8 +1180,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun usesMlModel(): Optional = - Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) + fun usesMlModel(): Optional = usesMlModel.getOptional("usesMlModel") /** * Whether the test uses production data (monitoring mode only). @@ -1197,7 +1189,7 @@ private constructor( * if the server responded with an unexpected value). */ fun usesProductionData(): Optional = - Optional.ofNullable(usesProductionData.getNullable("usesProductionData")) + usesProductionData.getOptional("usesProductionData") /** * Whether the test uses a reference dataset (monitoring mode only). @@ -1206,7 +1198,7 @@ private constructor( * if the server responded with an unexpected value). */ fun usesReferenceDataset(): Optional = - Optional.ofNullable(usesReferenceDataset.getNullable("usesReferenceDataset")) + usesReferenceDataset.getOptional("usesReferenceDataset") /** * Whether the test uses a training dataset. @@ -1215,7 +1207,7 @@ private constructor( * if the server responded with an unexpected value). */ fun usesTrainingDataset(): Optional = - Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) + usesTrainingDataset.getOptional("usesTrainingDataset") /** * Whether the test uses a validation dataset. @@ -1224,7 +1216,7 @@ private constructor( * if the server responded with an unexpected value). */ fun usesValidationDataset(): Optional = - Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) + usesValidationDataset.getOptional("usesValidationDataset") /** * Returns the raw JSON value of [id]. @@ -2041,15 +2033,14 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun insightName(): Optional = - Optional.ofNullable(insightName.getNullable("insightName")) + fun insightName(): Optional = insightName.getOptional("insightName") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun insightParameters(): Optional> = - Optional.ofNullable(insightParameters.getNullable("insightParameters")) + insightParameters.getOptional("insightParameters") /** * The measurement to be evaluated. @@ -2057,8 +2048,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun measurement(): Optional = - Optional.ofNullable(measurement.getNullable("measurement")) + fun measurement(): Optional = measurement.getOptional("measurement") /** * The operator to be used for the evaluation. @@ -2066,8 +2056,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun operator(): Optional = - Optional.ofNullable(operator.getNullable("operator")) + fun operator(): Optional = operator.getOptional("operator") /** * The value to be compared. @@ -2075,7 +2064,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun value(): Optional = Optional.ofNullable(value.getNullable("value")) + fun value(): Optional = value.getOptional("value") /** * Returns the raw JSON value of [insightName]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt index 80f97a34..75ca452b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt @@ -134,7 +134,7 @@ private constructor( * server responded with an unexpected value). */ fun dateLastEvaluated(): Optional = - Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + dateLastEvaluated.getOptional("dateLastEvaluated") /** * The last data sample received date. @@ -143,7 +143,7 @@ private constructor( * server responded with an unexpected value). */ fun dateLastSampleReceived(): Optional = - Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + dateLastSampleReceived.getOptional("dateLastSampleReceived") /** * The next test evaluation date. @@ -152,7 +152,7 @@ private constructor( * server responded with an unexpected value). */ fun dateOfNextEvaluation(): Optional = - Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + dateOfNextEvaluation.getOptional("dateOfNextEvaluation") /** * The last updated date. @@ -168,8 +168,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * The number of tests failing. @@ -223,8 +222,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") /** * The total number of tests. @@ -238,13 +236,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun project(): Optional = Optional.ofNullable(project.getNullable("project")) + fun project(): Optional = project.getOptional("project") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun workspace(): Optional = Optional.ofNullable(workspace.getNullable("workspace")) + fun workspace(): Optional = workspace.getOptional("workspace") /** * The workspace id. @@ -252,8 +250,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = workspaceId.getOptional("workspaceId") /** * Returns the raw JSON value of [id]. @@ -1284,7 +1281,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = creatorId.getOptional("creatorId") /** * The project creation date. @@ -1357,7 +1354,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun source(): Optional = Optional.ofNullable(source.getNullable("source")) + fun source(): Optional = source.getOptional("source") /** * The task type of the project. @@ -1381,8 +1378,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = workspaceId.getOptional("workspaceId") /** * The project description. @@ -1390,14 +1386,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) + fun gitRepo(): Optional = gitRepo.getOptional("gitRepo") /** * Returns the raw JSON value of [id]. @@ -2531,13 +2526,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + fun branch(): Optional = branch.getOptional("branch") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) + fun rootDir(): Optional = rootDir.getOptional("rootDir") /** * Returns the raw JSON value of [id]. @@ -3089,7 +3084,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = creatorId.getOptional("creatorId") /** * The workspace creation date. @@ -3137,8 +3132,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun periodEndDate(): Optional = - Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) + fun periodEndDate(): Optional = periodEndDate.getOptional("periodEndDate") /** * The start date of the current billing period. @@ -3147,7 +3141,7 @@ private constructor( * the server responded with an unexpected value). */ fun periodStartDate(): Optional = - Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) + periodStartDate.getOptional("periodStartDate") /** * The number of projects in the workspace. @@ -3177,15 +3171,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun inviteCode(): Optional = - Optional.ofNullable(inviteCode.getNullable("inviteCode")) + fun inviteCode(): Optional = inviteCode.getOptional("inviteCode") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun monthlyUsage(): Optional> = - Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) + fun monthlyUsage(): Optional> = monthlyUsage.getOptional("monthlyUsage") /** * Whether the workspace only allows SAML authentication. @@ -3193,15 +3185,14 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun samlOnlyAccess(): Optional = - Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) + fun samlOnlyAccess(): Optional = samlOnlyAccess.getOptional("samlOnlyAccess") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ fun wildcardDomains(): Optional> = - Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) + wildcardDomains.getOptional("wildcardDomains") /** * Returns the raw JSON value of [id]. @@ -3979,22 +3970,19 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun executionTimeMs(): Optional = - Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) + fun executionTimeMs(): Optional = executionTimeMs.getOptional("executionTimeMs") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun monthYear(): Optional = - Optional.ofNullable(monthYear.getNullable("monthYear")) + fun monthYear(): Optional = monthYear.getOptional("monthYear") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun predictionCount(): Optional = - Optional.ofNullable(predictionCount.getNullable("predictionCount")) + fun predictionCount(): Optional = predictionCount.getOptional("predictionCount") /** * Returns the raw JSON value of [executionTimeMs]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt index 9b3e669d..26cd8180 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateParams.kt @@ -357,8 +357,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * The inference pipeline name. @@ -366,7 +365,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to @@ -376,7 +375,7 @@ private constructor( * the server responded with an unexpected value). */ fun referenceDatasetUri(): Optional = - Optional.ofNullable(referenceDatasetUri.getNullable("referenceDatasetUri")) + referenceDatasetUri.getOptional("referenceDatasetUri") /** * Returns the raw JSON value of [description]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt index 363ce7c4..af87f6ae 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt @@ -134,7 +134,7 @@ private constructor( * server responded with an unexpected value). */ fun dateLastEvaluated(): Optional = - Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + dateLastEvaluated.getOptional("dateLastEvaluated") /** * The last data sample received date. @@ -143,7 +143,7 @@ private constructor( * server responded with an unexpected value). */ fun dateLastSampleReceived(): Optional = - Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + dateLastSampleReceived.getOptional("dateLastSampleReceived") /** * The next test evaluation date. @@ -152,7 +152,7 @@ private constructor( * server responded with an unexpected value). */ fun dateOfNextEvaluation(): Optional = - Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + dateOfNextEvaluation.getOptional("dateOfNextEvaluation") /** * The last updated date. @@ -168,8 +168,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * The number of tests failing. @@ -223,8 +222,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") /** * The total number of tests. @@ -238,13 +236,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun project(): Optional = Optional.ofNullable(project.getNullable("project")) + fun project(): Optional = project.getOptional("project") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun workspace(): Optional = Optional.ofNullable(workspace.getNullable("workspace")) + fun workspace(): Optional = workspace.getOptional("workspace") /** * The workspace id. @@ -252,8 +250,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = workspaceId.getOptional("workspaceId") /** * Returns the raw JSON value of [id]. @@ -1284,7 +1281,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = creatorId.getOptional("creatorId") /** * The project creation date. @@ -1357,7 +1354,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun source(): Optional = Optional.ofNullable(source.getNullable("source")) + fun source(): Optional = source.getOptional("source") /** * The task type of the project. @@ -1381,8 +1378,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = workspaceId.getOptional("workspaceId") /** * The project description. @@ -1390,14 +1386,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) + fun gitRepo(): Optional = gitRepo.getOptional("gitRepo") /** * Returns the raw JSON value of [id]. @@ -2531,13 +2526,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + fun branch(): Optional = branch.getOptional("branch") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) + fun rootDir(): Optional = rootDir.getOptional("rootDir") /** * Returns the raw JSON value of [id]. @@ -3089,7 +3084,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = creatorId.getOptional("creatorId") /** * The workspace creation date. @@ -3137,8 +3132,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun periodEndDate(): Optional = - Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) + fun periodEndDate(): Optional = periodEndDate.getOptional("periodEndDate") /** * The start date of the current billing period. @@ -3147,7 +3141,7 @@ private constructor( * the server responded with an unexpected value). */ fun periodStartDate(): Optional = - Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) + periodStartDate.getOptional("periodStartDate") /** * The number of projects in the workspace. @@ -3177,15 +3171,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun inviteCode(): Optional = - Optional.ofNullable(inviteCode.getNullable("inviteCode")) + fun inviteCode(): Optional = inviteCode.getOptional("inviteCode") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun monthlyUsage(): Optional> = - Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) + fun monthlyUsage(): Optional> = monthlyUsage.getOptional("monthlyUsage") /** * Whether the workspace only allows SAML authentication. @@ -3193,15 +3185,14 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun samlOnlyAccess(): Optional = - Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) + fun samlOnlyAccess(): Optional = samlOnlyAccess.getOptional("samlOnlyAccess") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ fun wildcardDomains(): Optional> = - Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) + wildcardDomains.getOptional("wildcardDomains") /** * Returns the raw JSON value of [id]. @@ -3979,22 +3970,19 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun executionTimeMs(): Optional = - Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) + fun executionTimeMs(): Optional = executionTimeMs.getOptional("executionTimeMs") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun monthYear(): Optional = - Optional.ofNullable(monthYear.getNullable("monthYear")) + fun monthYear(): Optional = monthYear.getOptional("monthYear") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun predictionCount(): Optional = - Optional.ofNullable(predictionCount.getNullable("predictionCount")) + fun predictionCount(): Optional = predictionCount.getOptional("predictionCount") /** * Returns the raw JSON value of [executionTimeMs]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt index f5f6fcf1..9d246237 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/data/DataStreamParams.kt @@ -906,7 +906,7 @@ private constructor( * if the server responded with an unexpected value). */ fun contextColumnName(): Optional = - Optional.ofNullable(contextColumnName.getNullable("contextColumnName")) + contextColumnName.getOptional("contextColumnName") /** * Name of the column with the cost associated with each row. @@ -914,8 +914,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun costColumnName(): Optional = - Optional.ofNullable(costColumnName.getNullable("costColumnName")) + fun costColumnName(): Optional = costColumnName.getOptional("costColumnName") /** * Name of the column with the ground truths. @@ -924,7 +923,7 @@ private constructor( * if the server responded with an unexpected value). */ fun groundTruthColumnName(): Optional = - Optional.ofNullable(groundTruthColumnName.getNullable("groundTruthColumnName")) + groundTruthColumnName.getOptional("groundTruthColumnName") /** * Name of the column with the inference ids. This is useful if you want to update rows @@ -934,7 +933,7 @@ private constructor( * if the server responded with an unexpected value). */ fun inferenceIdColumnName(): Optional = - Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + inferenceIdColumnName.getOptional("inferenceIdColumnName") /** * Array of input variable names. Each input variable should be a dataset column. @@ -943,7 +942,7 @@ private constructor( * if the server responded with an unexpected value). */ fun inputVariableNames(): Optional> = - Optional.ofNullable(inputVariableNames.getNullable("inputVariableNames")) + inputVariableNames.getOptional("inputVariableNames") /** * Name of the column with the latencies. @@ -952,7 +951,7 @@ private constructor( * if the server responded with an unexpected value). */ fun latencyColumnName(): Optional = - Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + latencyColumnName.getOptional("latencyColumnName") /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata @@ -964,7 +963,7 @@ private constructor( * if the server responded with an unexpected value). */ fun numOfTokenColumnName(): Optional = - Optional.ofNullable(numOfTokenColumnName.getNullable("numOfTokenColumnName")) + numOfTokenColumnName.getOptional("numOfTokenColumnName") /** * Prompt for the LLM. @@ -972,7 +971,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun prompt(): Optional> = Optional.ofNullable(prompt.getNullable("prompt")) + fun prompt(): Optional> = prompt.getOptional("prompt") /** * Name of the column with the questions. Applies to RAG use cases. Providing the @@ -982,7 +981,7 @@ private constructor( * if the server responded with an unexpected value). */ fun questionColumnName(): Optional = - Optional.ofNullable(questionColumnName.getNullable("questionColumnName")) + questionColumnName.getOptional("questionColumnName") /** * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not @@ -992,7 +991,7 @@ private constructor( * if the server responded with an unexpected value). */ fun timestampColumnName(): Optional = - Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + timestampColumnName.getOptional("timestampColumnName") /** * Returns the raw JSON value of [outputColumnName]. @@ -1495,8 +1494,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun content(): Optional = - Optional.ofNullable(content.getNullable("content")) + fun content(): Optional = content.getOptional("content") /** * Role of the prompt. @@ -1504,7 +1502,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun role(): Optional = Optional.ofNullable(role.getNullable("role")) + fun role(): Optional = role.getOptional("role") /** * Returns the raw JSON value of [content]. @@ -1752,7 +1750,7 @@ private constructor( * if the server responded with an unexpected value). */ fun categoricalFeatureNames(): Optional> = - Optional.ofNullable(categoricalFeatureNames.getNullable("categoricalFeatureNames")) + categoricalFeatureNames.getOptional("categoricalFeatureNames") /** * Array with all input feature names. @@ -1760,8 +1758,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun featureNames(): Optional> = - Optional.ofNullable(featureNames.getNullable("featureNames")) + fun featureNames(): Optional> = featureNames.getOptional("featureNames") /** * Name of the column with the inference ids. This is useful if you want to update rows @@ -1771,7 +1768,7 @@ private constructor( * if the server responded with an unexpected value). */ fun inferenceIdColumnName(): Optional = - Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + inferenceIdColumnName.getOptional("inferenceIdColumnName") /** * Name of the column with the labels. The data in this column must be **zero-indexed @@ -1780,8 +1777,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun labelColumnName(): Optional = - Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) + fun labelColumnName(): Optional = labelColumnName.getOptional("labelColumnName") /** * Name of the column with the latencies. @@ -1790,7 +1786,7 @@ private constructor( * if the server responded with an unexpected value). */ fun latencyColumnName(): Optional = - Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + latencyColumnName.getOptional("latencyColumnName") /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata @@ -1802,7 +1798,7 @@ private constructor( * if the server responded with an unexpected value). */ fun predictionsColumnName(): Optional = - Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) + predictionsColumnName.getOptional("predictionsColumnName") /** * Name of the column with the model's predictions as **lists of class probabilities**. @@ -1811,9 +1807,7 @@ private constructor( * if the server responded with an unexpected value). */ fun predictionScoresColumnName(): Optional = - Optional.ofNullable( - predictionScoresColumnName.getNullable("predictionScoresColumnName") - ) + predictionScoresColumnName.getOptional("predictionScoresColumnName") /** * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not @@ -1823,7 +1817,7 @@ private constructor( * if the server responded with an unexpected value). */ fun timestampColumnName(): Optional = - Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + timestampColumnName.getOptional("timestampColumnName") /** * Returns the raw JSON value of [classNames]. @@ -2339,7 +2333,7 @@ private constructor( * if the server responded with an unexpected value). */ fun categoricalFeatureNames(): Optional> = - Optional.ofNullable(categoricalFeatureNames.getNullable("categoricalFeatureNames")) + categoricalFeatureNames.getOptional("categoricalFeatureNames") /** * Array with all input feature names. @@ -2347,8 +2341,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun featureNames(): Optional> = - Optional.ofNullable(featureNames.getNullable("featureNames")) + fun featureNames(): Optional> = featureNames.getOptional("featureNames") /** * Name of the column with the inference ids. This is useful if you want to update rows @@ -2358,7 +2351,7 @@ private constructor( * if the server responded with an unexpected value). */ fun inferenceIdColumnName(): Optional = - Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + inferenceIdColumnName.getOptional("inferenceIdColumnName") /** * Name of the column with the latencies. @@ -2367,7 +2360,7 @@ private constructor( * if the server responded with an unexpected value). */ fun latencyColumnName(): Optional = - Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + latencyColumnName.getOptional("latencyColumnName") /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata @@ -2379,7 +2372,7 @@ private constructor( * if the server responded with an unexpected value). */ fun predictionsColumnName(): Optional = - Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) + predictionsColumnName.getOptional("predictionsColumnName") /** * Name of the column with the targets (ground truth values). @@ -2388,7 +2381,7 @@ private constructor( * if the server responded with an unexpected value). */ fun targetColumnName(): Optional = - Optional.ofNullable(targetColumnName.getNullable("targetColumnName")) + targetColumnName.getOptional("targetColumnName") /** * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not @@ -2398,7 +2391,7 @@ private constructor( * if the server responded with an unexpected value). */ fun timestampColumnName(): Optional = - Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + timestampColumnName.getOptional("timestampColumnName") /** * Returns the raw JSON value of [categoricalFeatureNames]. @@ -2834,7 +2827,7 @@ private constructor( * if the server responded with an unexpected value). */ fun inferenceIdColumnName(): Optional = - Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + inferenceIdColumnName.getOptional("inferenceIdColumnName") /** * Name of the column with the labels. The data in this column must be **zero-indexed @@ -2843,8 +2836,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun labelColumnName(): Optional = - Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) + fun labelColumnName(): Optional = labelColumnName.getOptional("labelColumnName") /** * Name of the column with the latencies. @@ -2853,7 +2845,7 @@ private constructor( * if the server responded with an unexpected value). */ fun latencyColumnName(): Optional = - Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + latencyColumnName.getOptional("latencyColumnName") /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata @@ -2865,7 +2857,7 @@ private constructor( * if the server responded with an unexpected value). */ fun predictionsColumnName(): Optional = - Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) + predictionsColumnName.getOptional("predictionsColumnName") /** * Name of the column with the model's predictions as **lists of class probabilities**. @@ -2874,9 +2866,7 @@ private constructor( * if the server responded with an unexpected value). */ fun predictionScoresColumnName(): Optional = - Optional.ofNullable( - predictionScoresColumnName.getNullable("predictionScoresColumnName") - ) + predictionScoresColumnName.getOptional("predictionScoresColumnName") /** * Name of the column with the text data. @@ -2884,8 +2874,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun textColumnName(): Optional = - Optional.ofNullable(textColumnName.getNullable("textColumnName")) + fun textColumnName(): Optional = textColumnName.getOptional("textColumnName") /** * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not @@ -2895,7 +2884,7 @@ private constructor( * if the server responded with an unexpected value). */ fun timestampColumnName(): Optional = - Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + timestampColumnName.getOptional("timestampColumnName") /** * Returns the raw JSON value of [classNames]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt index f04159d5..93e28ac6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/rows/RowUpdateParams.kt @@ -301,7 +301,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun config(): Optional = Optional.ofNullable(config.getNullable("config")) + fun config(): Optional = config.getOptional("config") /** * Returns the raw JSON value of [config]. @@ -488,7 +488,7 @@ private constructor( * the server responded with an unexpected value). */ fun groundTruthColumnName(): Optional = - Optional.ofNullable(groundTruthColumnName.getNullable("groundTruthColumnName")) + groundTruthColumnName.getOptional("groundTruthColumnName") /** * Name of the column with human feedback. @@ -497,7 +497,7 @@ private constructor( * the server responded with an unexpected value). */ fun humanFeedbackColumnName(): Optional = - Optional.ofNullable(humanFeedbackColumnName.getNullable("humanFeedbackColumnName")) + humanFeedbackColumnName.getOptional("humanFeedbackColumnName") /** * Name of the column with the inference ids. This is useful if you want to update rows at a @@ -507,7 +507,7 @@ private constructor( * the server responded with an unexpected value). */ fun inferenceIdColumnName(): Optional = - Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + inferenceIdColumnName.getOptional("inferenceIdColumnName") /** * Name of the column with the latencies. @@ -516,7 +516,7 @@ private constructor( * the server responded with an unexpected value). */ fun latencyColumnName(): Optional = - Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + latencyColumnName.getOptional("latencyColumnName") /** * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not @@ -526,7 +526,7 @@ private constructor( * the server responded with an unexpected value). */ fun timestampColumnName(): Optional = - Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + timestampColumnName.getOptional("timestampColumnName") /** * Returns the raw JSON value of [groundTruthColumnName]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt index 48db95ef..f43e5f63 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt @@ -262,8 +262,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun dateDataEnds(): Optional = - Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) + fun dateDataEnds(): Optional = dateDataEnds.getOptional("dateDataEnds") /** * The data start date. @@ -272,7 +271,7 @@ private constructor( * the server responded with an unexpected value). */ fun dateDataStarts(): Optional = - Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) + dateDataStarts.getOptional("dateDataStarts") /** * The last updated date. @@ -289,7 +288,7 @@ private constructor( * the server responded with an unexpected value). */ fun inferencePipelineId(): Optional = - Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) + inferencePipelineId.getOptional("inferencePipelineId") /** * The project version (commit) id. @@ -297,8 +296,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun projectVersionId(): Optional = - Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) + fun projectVersionId(): Optional = projectVersionId.getOptional("projectVersionId") /** * The status of the test. @@ -314,14 +312,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun goal(): Optional = Optional.ofNullable(goal.getNullable("goal")) + fun goal(): Optional = goal.getOptional("goal") /** * The test id. @@ -329,7 +326,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun goalId(): Optional = Optional.ofNullable(goalId.getNullable("goalId")) + fun goalId(): Optional = goalId.getOptional("goalId") /** * Returns the raw JSON value of [id]. @@ -1060,8 +1057,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun creatorId(): Optional = - Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = creatorId.getOptional("creatorId") /** * The date the test was archived. @@ -1069,8 +1065,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun dateArchived(): Optional = - Optional.ofNullable(dateArchived.getNullable("dateArchived")) + fun dateArchived(): Optional = dateArchived.getOptional("dateArchived") /** * The creation date. @@ -1118,7 +1113,7 @@ private constructor( * if the server responded with an unexpected value). */ fun originProjectVersionId(): Optional = - Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) + originProjectVersionId.getOptional("originProjectVersionId") /** * The test subtype. @@ -1160,8 +1155,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun archived(): Optional = - Optional.ofNullable(archived.getNullable("archived")) + fun archived(): Optional = archived.getOptional("archived") /** * The delay window in seconds. Only applies to tests that use production data. @@ -1169,8 +1163,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun delayWindow(): Optional = - Optional.ofNullable(delayWindow.getNullable("delayWindow")) + fun delayWindow(): Optional = delayWindow.getOptional("delayWindow") /** * The evaluation window in seconds. Only applies to tests that use production data. @@ -1179,7 +1172,7 @@ private constructor( * if the server responded with an unexpected value). */ fun evaluationWindow(): Optional = - Optional.ofNullable(evaluationWindow.getNullable("evaluationWindow")) + evaluationWindow.getOptional("evaluationWindow") /** * Whether the test uses an ML model. @@ -1187,8 +1180,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun usesMlModel(): Optional = - Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) + fun usesMlModel(): Optional = usesMlModel.getOptional("usesMlModel") /** * Whether the test uses production data (monitoring mode only). @@ -1197,7 +1189,7 @@ private constructor( * if the server responded with an unexpected value). */ fun usesProductionData(): Optional = - Optional.ofNullable(usesProductionData.getNullable("usesProductionData")) + usesProductionData.getOptional("usesProductionData") /** * Whether the test uses a reference dataset (monitoring mode only). @@ -1206,7 +1198,7 @@ private constructor( * if the server responded with an unexpected value). */ fun usesReferenceDataset(): Optional = - Optional.ofNullable(usesReferenceDataset.getNullable("usesReferenceDataset")) + usesReferenceDataset.getOptional("usesReferenceDataset") /** * Whether the test uses a training dataset. @@ -1215,7 +1207,7 @@ private constructor( * if the server responded with an unexpected value). */ fun usesTrainingDataset(): Optional = - Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) + usesTrainingDataset.getOptional("usesTrainingDataset") /** * Whether the test uses a validation dataset. @@ -1224,7 +1216,7 @@ private constructor( * if the server responded with an unexpected value). */ fun usesValidationDataset(): Optional = - Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) + usesValidationDataset.getOptional("usesValidationDataset") /** * Returns the raw JSON value of [id]. @@ -2041,15 +2033,14 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun insightName(): Optional = - Optional.ofNullable(insightName.getNullable("insightName")) + fun insightName(): Optional = insightName.getOptional("insightName") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun insightParameters(): Optional> = - Optional.ofNullable(insightParameters.getNullable("insightParameters")) + insightParameters.getOptional("insightParameters") /** * The measurement to be evaluated. @@ -2057,8 +2048,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun measurement(): Optional = - Optional.ofNullable(measurement.getNullable("measurement")) + fun measurement(): Optional = measurement.getOptional("measurement") /** * The operator to be used for the evaluation. @@ -2066,8 +2056,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun operator(): Optional = - Optional.ofNullable(operator.getNullable("operator")) + fun operator(): Optional = operator.getOptional("operator") /** * The value to be compared. @@ -2075,7 +2064,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun value(): Optional = Optional.ofNullable(value.getNullable("value")) + fun value(): Optional = value.getOptional("value") /** * Returns the raw JSON value of [insightName]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt index a1c5a3f4..e3a8a42c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt @@ -800,7 +800,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = creatorId.getOptional("creatorId") /** * The project creation date. @@ -873,7 +873,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun source(): Optional = Optional.ofNullable(source.getNullable("source")) + fun source(): Optional = source.getOptional("source") /** * The task type of the project. @@ -897,8 +897,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = workspaceId.getOptional("workspaceId") /** * The project description. @@ -906,14 +905,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) + fun gitRepo(): Optional = gitRepo.getOptional("gitRepo") /** * Returns the raw JSON value of [id]. @@ -2042,13 +2040,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + fun branch(): Optional = branch.getOptional("branch") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) + fun rootDir(): Optional = rootDir.getOptional("rootDir") /** * Returns the raw JSON value of [id]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt index 51d01c80..e6709bce 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt @@ -108,7 +108,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = creatorId.getOptional("creatorId") /** * The project creation date. @@ -181,7 +181,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun source(): Optional = Optional.ofNullable(source.getNullable("source")) + fun source(): Optional = source.getOptional("source") /** * The task type of the project. @@ -205,8 +205,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = workspaceId.getOptional("workspaceId") /** * The project description. @@ -214,14 +213,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) + fun gitRepo(): Optional = gitRepo.getOptional("gitRepo") /** * Returns the raw JSON value of [id]. @@ -1314,13 +1312,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + fun branch(): Optional = branch.getOptional("branch") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) + fun rootDir(): Optional = rootDir.getOptional("rootDir") /** * Returns the raw JSON value of [id]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt index f811e71a..c8bd6d45 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt @@ -266,7 +266,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = creatorId.getOptional("creatorId") /** * The project creation date. @@ -339,7 +339,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun source(): Optional = Optional.ofNullable(source.getNullable("source")) + fun source(): Optional = source.getOptional("source") /** * The task type of the project. @@ -363,8 +363,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = workspaceId.getOptional("workspaceId") /** * The project description. @@ -372,14 +371,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) + fun gitRepo(): Optional = gitRepo.getOptional("gitRepo") /** * Returns the raw JSON value of [id]. @@ -1513,13 +1511,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + fun branch(): Optional = branch.getOptional("branch") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) + fun rootDir(): Optional = rootDir.getOptional("rootDir") /** * Returns the raw JSON value of [id]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt index 98df0084..d616219c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParams.kt @@ -896,8 +896,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun dateArchived(): Optional = - Optional.ofNullable(dateArchived.getNullable("dateArchived")) + fun dateArchived(): Optional = dateArchived.getOptional("dateArchived") /** * The project version (commit) creation date. @@ -921,7 +920,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + fun mlModelId(): Optional = mlModelId.getOptional("mlModelId") /** * The number of tests that are passing for the commit. @@ -954,8 +953,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") /** * The storage URI where the commit bundle is stored. @@ -980,7 +978,7 @@ private constructor( * the server responded with an unexpected value). */ fun trainingDatasetId(): Optional = - Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + trainingDatasetId.getOptional("trainingDatasetId") /** * The validation dataset id. @@ -989,7 +987,7 @@ private constructor( * the server responded with an unexpected value). */ fun validationDatasetId(): Optional = - Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + validationDatasetId.getOptional("validationDatasetId") /** * Whether the commit is archived. @@ -997,7 +995,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) + fun archived(): Optional = archived.getOptional("archived") /** * The deployment status associated with the commit's model. @@ -1005,14 +1003,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun deploymentStatus(): Optional = - Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + fun deploymentStatus(): Optional = deploymentStatus.getOptional("deploymentStatus") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun links(): Optional = Optional.ofNullable(links.getNullable("links")) + fun links(): Optional = links.getOptional("links") /** * Returns the raw JSON value of [id]. @@ -1747,7 +1744,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun fileSize(): Optional = Optional.ofNullable(fileSize.getNullable("fileSize")) + fun fileSize(): Optional = fileSize.getOptional("fileSize") /** * The commit message. @@ -1763,7 +1760,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + fun mlModelId(): Optional = mlModelId.getOptional("mlModelId") /** * The storage URI where the commit bundle is stored. @@ -1780,7 +1777,7 @@ private constructor( * the server responded with an unexpected value). */ fun trainingDatasetId(): Optional = - Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + trainingDatasetId.getOptional("trainingDatasetId") /** * The validation dataset id. @@ -1789,7 +1786,7 @@ private constructor( * the server responded with an unexpected value). */ fun validationDatasetId(): Optional = - Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + validationDatasetId.getOptional("validationDatasetId") /** * The commit creation date. @@ -1797,8 +1794,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun dateCreated(): Optional = - Optional.ofNullable(dateCreated.getNullable("dateCreated")) + fun dateCreated(): Optional = dateCreated.getOptional("dateCreated") /** * The ref of the corresponding git commit. @@ -1806,8 +1802,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun gitCommitRef(): Optional = - Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) + fun gitCommitRef(): Optional = gitCommitRef.getOptional("gitCommitRef") /** * The SHA of the corresponding git commit. @@ -1815,8 +1810,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun gitCommitSha(): Optional = - Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) + fun gitCommitSha(): Optional = gitCommitSha.getOptional("gitCommitSha") /** * The URL of the corresponding git commit. @@ -1824,8 +1818,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun gitCommitUrl(): Optional = - Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) + fun gitCommitUrl(): Optional = gitCommitUrl.getOptional("gitCommitUrl") /** * Returns the raw JSON value of [id]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt index f28b09ce..5e56889b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponse.kt @@ -123,8 +123,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun dateArchived(): Optional = - Optional.ofNullable(dateArchived.getNullable("dateArchived")) + fun dateArchived(): Optional = dateArchived.getOptional("dateArchived") /** * The project version (commit) creation date. @@ -148,7 +147,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + fun mlModelId(): Optional = mlModelId.getOptional("mlModelId") /** * The number of tests that are passing for the commit. @@ -181,8 +180,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") /** * The storage URI where the commit bundle is stored. @@ -206,8 +204,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun trainingDatasetId(): Optional = - Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + fun trainingDatasetId(): Optional = trainingDatasetId.getOptional("trainingDatasetId") /** * The validation dataset id. @@ -216,7 +213,7 @@ private constructor( * server responded with an unexpected value). */ fun validationDatasetId(): Optional = - Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + validationDatasetId.getOptional("validationDatasetId") /** * Whether the commit is archived. @@ -224,7 +221,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) + fun archived(): Optional = archived.getOptional("archived") /** * The deployment status associated with the commit's model. @@ -232,14 +229,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun deploymentStatus(): Optional = - Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + fun deploymentStatus(): Optional = deploymentStatus.getOptional("deploymentStatus") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun links(): Optional = Optional.ofNullable(links.getNullable("links")) + fun links(): Optional = links.getOptional("links") /** * Returns the raw JSON value of [id]. @@ -938,7 +934,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun fileSize(): Optional = Optional.ofNullable(fileSize.getNullable("fileSize")) + fun fileSize(): Optional = fileSize.getOptional("fileSize") /** * The commit message. @@ -954,7 +950,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + fun mlModelId(): Optional = mlModelId.getOptional("mlModelId") /** * The storage URI where the commit bundle is stored. @@ -971,7 +967,7 @@ private constructor( * the server responded with an unexpected value). */ fun trainingDatasetId(): Optional = - Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + trainingDatasetId.getOptional("trainingDatasetId") /** * The validation dataset id. @@ -980,7 +976,7 @@ private constructor( * the server responded with an unexpected value). */ fun validationDatasetId(): Optional = - Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + validationDatasetId.getOptional("validationDatasetId") /** * The commit creation date. @@ -988,8 +984,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun dateCreated(): Optional = - Optional.ofNullable(dateCreated.getNullable("dateCreated")) + fun dateCreated(): Optional = dateCreated.getOptional("dateCreated") /** * The ref of the corresponding git commit. @@ -997,8 +992,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun gitCommitRef(): Optional = - Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) + fun gitCommitRef(): Optional = gitCommitRef.getOptional("gitCommitRef") /** * The SHA of the corresponding git commit. @@ -1006,8 +1000,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun gitCommitSha(): Optional = - Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) + fun gitCommitSha(): Optional = gitCommitSha.getOptional("gitCommitSha") /** * The URL of the corresponding git commit. @@ -1015,8 +1008,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun gitCommitUrl(): Optional = - Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) + fun gitCommitUrl(): Optional = gitCommitUrl.getOptional("gitCommitUrl") /** * Returns the raw JSON value of [id]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt index ff18b25d..34423156 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/commits/CommitListResponse.kt @@ -281,8 +281,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun dateArchived(): Optional = - Optional.ofNullable(dateArchived.getNullable("dateArchived")) + fun dateArchived(): Optional = dateArchived.getOptional("dateArchived") /** * The project version (commit) creation date. @@ -306,7 +305,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + fun mlModelId(): Optional = mlModelId.getOptional("mlModelId") /** * The number of tests that are passing for the commit. @@ -339,8 +338,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") /** * The storage URI where the commit bundle is stored. @@ -365,7 +363,7 @@ private constructor( * the server responded with an unexpected value). */ fun trainingDatasetId(): Optional = - Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + trainingDatasetId.getOptional("trainingDatasetId") /** * The validation dataset id. @@ -374,7 +372,7 @@ private constructor( * the server responded with an unexpected value). */ fun validationDatasetId(): Optional = - Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + validationDatasetId.getOptional("validationDatasetId") /** * Whether the commit is archived. @@ -382,7 +380,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) + fun archived(): Optional = archived.getOptional("archived") /** * The deployment status associated with the commit's model. @@ -390,14 +388,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun deploymentStatus(): Optional = - Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + fun deploymentStatus(): Optional = deploymentStatus.getOptional("deploymentStatus") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun links(): Optional = Optional.ofNullable(links.getNullable("links")) + fun links(): Optional = links.getOptional("links") /** * Returns the raw JSON value of [id]. @@ -1115,7 +1112,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun fileSize(): Optional = Optional.ofNullable(fileSize.getNullable("fileSize")) + fun fileSize(): Optional = fileSize.getOptional("fileSize") /** * The commit message. @@ -1132,8 +1129,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun mlModelId(): Optional = - Optional.ofNullable(mlModelId.getNullable("mlModelId")) + fun mlModelId(): Optional = mlModelId.getOptional("mlModelId") /** * The storage URI where the commit bundle is stored. @@ -1151,7 +1147,7 @@ private constructor( * if the server responded with an unexpected value). */ fun trainingDatasetId(): Optional = - Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + trainingDatasetId.getOptional("trainingDatasetId") /** * The validation dataset id. @@ -1160,7 +1156,7 @@ private constructor( * if the server responded with an unexpected value). */ fun validationDatasetId(): Optional = - Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + validationDatasetId.getOptional("validationDatasetId") /** * The commit creation date. @@ -1168,8 +1164,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun dateCreated(): Optional = - Optional.ofNullable(dateCreated.getNullable("dateCreated")) + fun dateCreated(): Optional = dateCreated.getOptional("dateCreated") /** * The ref of the corresponding git commit. @@ -1177,8 +1172,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun gitCommitRef(): Optional = - Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) + fun gitCommitRef(): Optional = gitCommitRef.getOptional("gitCommitRef") /** * The SHA of the corresponding git commit. @@ -1186,8 +1180,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun gitCommitSha(): Optional = - Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) + fun gitCommitSha(): Optional = gitCommitSha.getOptional("gitCommitSha") /** * The URL of the corresponding git commit. @@ -1195,8 +1188,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun gitCommitUrl(): Optional = - Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) + fun gitCommitUrl(): Optional = gitCommitUrl.getOptional("gitCommitUrl") /** * Returns the raw JSON value of [id]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt index e0019dbe..b5db2cb8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt @@ -922,7 +922,7 @@ private constructor( * the server responded with an unexpected value). */ fun dateLastEvaluated(): Optional = - Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + dateLastEvaluated.getOptional("dateLastEvaluated") /** * The last data sample received date. @@ -931,7 +931,7 @@ private constructor( * the server responded with an unexpected value). */ fun dateLastSampleReceived(): Optional = - Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + dateLastSampleReceived.getOptional("dateLastSampleReceived") /** * The next test evaluation date. @@ -940,7 +940,7 @@ private constructor( * the server responded with an unexpected value). */ fun dateOfNextEvaluation(): Optional = - Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + dateOfNextEvaluation.getOptional("dateOfNextEvaluation") /** * The last updated date. @@ -956,8 +956,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * The number of tests failing. @@ -1011,8 +1010,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") /** * The total number of tests. @@ -1026,14 +1024,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun project(): Optional = Optional.ofNullable(project.getNullable("project")) + fun project(): Optional = project.getOptional("project") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun workspace(): Optional = - Optional.ofNullable(workspace.getNullable("workspace")) + fun workspace(): Optional = workspace.getOptional("workspace") /** * The workspace id. @@ -1041,8 +1038,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = workspaceId.getOptional("workspaceId") /** * Returns the raw JSON value of [id]. @@ -2113,7 +2109,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = creatorId.getOptional("creatorId") /** * The project creation date. @@ -2186,7 +2182,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun source(): Optional = Optional.ofNullable(source.getNullable("source")) + fun source(): Optional = source.getOptional("source") /** * The task type of the project. @@ -2210,8 +2206,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = workspaceId.getOptional("workspaceId") /** * The project description. @@ -2219,14 +2214,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) + fun gitRepo(): Optional = gitRepo.getOptional("gitRepo") /** * Returns the raw JSON value of [id]. @@ -3360,13 +3354,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + fun branch(): Optional = branch.getOptional("branch") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) + fun rootDir(): Optional = rootDir.getOptional("rootDir") /** * Returns the raw JSON value of [id]. @@ -3918,7 +3912,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = creatorId.getOptional("creatorId") /** * The workspace creation date. @@ -3966,8 +3960,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun periodEndDate(): Optional = - Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) + fun periodEndDate(): Optional = periodEndDate.getOptional("periodEndDate") /** * The start date of the current billing period. @@ -3976,7 +3969,7 @@ private constructor( * the server responded with an unexpected value). */ fun periodStartDate(): Optional = - Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) + periodStartDate.getOptional("periodStartDate") /** * The number of projects in the workspace. @@ -4006,15 +3999,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun inviteCode(): Optional = - Optional.ofNullable(inviteCode.getNullable("inviteCode")) + fun inviteCode(): Optional = inviteCode.getOptional("inviteCode") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun monthlyUsage(): Optional> = - Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) + fun monthlyUsage(): Optional> = monthlyUsage.getOptional("monthlyUsage") /** * Whether the workspace only allows SAML authentication. @@ -4022,15 +4013,14 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun samlOnlyAccess(): Optional = - Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) + fun samlOnlyAccess(): Optional = samlOnlyAccess.getOptional("samlOnlyAccess") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ fun wildcardDomains(): Optional> = - Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) + wildcardDomains.getOptional("wildcardDomains") /** * Returns the raw JSON value of [id]. @@ -4808,22 +4798,19 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun executionTimeMs(): Optional = - Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) + fun executionTimeMs(): Optional = executionTimeMs.getOptional("executionTimeMs") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun monthYear(): Optional = - Optional.ofNullable(monthYear.getNullable("monthYear")) + fun monthYear(): Optional = monthYear.getOptional("monthYear") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun predictionCount(): Optional = - Optional.ofNullable(predictionCount.getNullable("predictionCount")) + fun predictionCount(): Optional = predictionCount.getOptional("predictionCount") /** * Returns the raw JSON value of [executionTimeMs]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt index 5df9ab5a..c04c36d6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt @@ -134,7 +134,7 @@ private constructor( * server responded with an unexpected value). */ fun dateLastEvaluated(): Optional = - Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + dateLastEvaluated.getOptional("dateLastEvaluated") /** * The last data sample received date. @@ -143,7 +143,7 @@ private constructor( * server responded with an unexpected value). */ fun dateLastSampleReceived(): Optional = - Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + dateLastSampleReceived.getOptional("dateLastSampleReceived") /** * The next test evaluation date. @@ -152,7 +152,7 @@ private constructor( * server responded with an unexpected value). */ fun dateOfNextEvaluation(): Optional = - Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + dateOfNextEvaluation.getOptional("dateOfNextEvaluation") /** * The last updated date. @@ -168,8 +168,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * The number of tests failing. @@ -223,8 +222,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") /** * The total number of tests. @@ -238,13 +236,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun project(): Optional = Optional.ofNullable(project.getNullable("project")) + fun project(): Optional = project.getOptional("project") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun workspace(): Optional = Optional.ofNullable(workspace.getNullable("workspace")) + fun workspace(): Optional = workspace.getOptional("workspace") /** * The workspace id. @@ -252,8 +250,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = workspaceId.getOptional("workspaceId") /** * Returns the raw JSON value of [id]. @@ -1284,7 +1281,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = creatorId.getOptional("creatorId") /** * The project creation date. @@ -1357,7 +1354,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun source(): Optional = Optional.ofNullable(source.getNullable("source")) + fun source(): Optional = source.getOptional("source") /** * The task type of the project. @@ -1381,8 +1378,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = workspaceId.getOptional("workspaceId") /** * The project description. @@ -1390,14 +1386,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) + fun gitRepo(): Optional = gitRepo.getOptional("gitRepo") /** * Returns the raw JSON value of [id]. @@ -2531,13 +2526,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + fun branch(): Optional = branch.getOptional("branch") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun rootDir(): Optional = Optional.ofNullable(rootDir.getNullable("rootDir")) + fun rootDir(): Optional = rootDir.getOptional("rootDir") /** * Returns the raw JSON value of [id]. @@ -3089,7 +3084,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = creatorId.getOptional("creatorId") /** * The workspace creation date. @@ -3137,8 +3132,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun periodEndDate(): Optional = - Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) + fun periodEndDate(): Optional = periodEndDate.getOptional("periodEndDate") /** * The start date of the current billing period. @@ -3147,7 +3141,7 @@ private constructor( * the server responded with an unexpected value). */ fun periodStartDate(): Optional = - Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) + periodStartDate.getOptional("periodStartDate") /** * The number of projects in the workspace. @@ -3177,15 +3171,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun inviteCode(): Optional = - Optional.ofNullable(inviteCode.getNullable("inviteCode")) + fun inviteCode(): Optional = inviteCode.getOptional("inviteCode") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun monthlyUsage(): Optional> = - Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) + fun monthlyUsage(): Optional> = monthlyUsage.getOptional("monthlyUsage") /** * Whether the workspace only allows SAML authentication. @@ -3193,15 +3185,14 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun samlOnlyAccess(): Optional = - Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) + fun samlOnlyAccess(): Optional = samlOnlyAccess.getOptional("samlOnlyAccess") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ fun wildcardDomains(): Optional> = - Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) + wildcardDomains.getOptional("wildcardDomains") /** * Returns the raw JSON value of [id]. @@ -3979,22 +3970,19 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun executionTimeMs(): Optional = - Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) + fun executionTimeMs(): Optional = executionTimeMs.getOptional("executionTimeMs") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun monthYear(): Optional = - Optional.ofNullable(monthYear.getNullable("monthYear")) + fun monthYear(): Optional = monthYear.getOptional("monthYear") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun predictionCount(): Optional = - Optional.ofNullable(predictionCount.getNullable("predictionCount")) + fun predictionCount(): Optional = predictionCount.getOptional("predictionCount") /** * Returns the raw JSON value of [executionTimeMs]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt index 33ca0476..38b3bf4c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt @@ -287,7 +287,7 @@ private constructor( * the server responded with an unexpected value). */ fun dateLastEvaluated(): Optional = - Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + dateLastEvaluated.getOptional("dateLastEvaluated") /** * The last data sample received date. @@ -296,7 +296,7 @@ private constructor( * the server responded with an unexpected value). */ fun dateLastSampleReceived(): Optional = - Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + dateLastSampleReceived.getOptional("dateLastSampleReceived") /** * The next test evaluation date. @@ -305,7 +305,7 @@ private constructor( * the server responded with an unexpected value). */ fun dateOfNextEvaluation(): Optional = - Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + dateOfNextEvaluation.getOptional("dateOfNextEvaluation") /** * The last updated date. @@ -321,8 +321,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * The number of tests failing. @@ -376,8 +375,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") /** * The total number of tests. @@ -391,14 +389,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun project(): Optional = Optional.ofNullable(project.getNullable("project")) + fun project(): Optional = project.getOptional("project") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun workspace(): Optional = - Optional.ofNullable(workspace.getNullable("workspace")) + fun workspace(): Optional = workspace.getOptional("workspace") /** * The workspace id. @@ -406,8 +403,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = workspaceId.getOptional("workspaceId") /** * Returns the raw JSON value of [id]. @@ -1466,8 +1462,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun creatorId(): Optional = - Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = creatorId.getOptional("creatorId") /** * The project creation date. @@ -1549,7 +1544,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun source(): Optional = Optional.ofNullable(source.getNullable("source")) + fun source(): Optional = source.getOptional("source") /** * The task type of the project. @@ -1575,8 +1570,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun workspaceId(): Optional = - Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = workspaceId.getOptional("workspaceId") /** * The project description. @@ -1584,14 +1578,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) + fun gitRepo(): Optional = gitRepo.getOptional("gitRepo") /** * Returns the raw JSON value of [id]. @@ -2755,14 +2748,13 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) + fun branch(): Optional = branch.getOptional("branch") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun rootDir(): Optional = - Optional.ofNullable(rootDir.getNullable("rootDir")) + fun rootDir(): Optional = rootDir.getOptional("rootDir") /** * Returns the raw JSON value of [id]. @@ -3327,8 +3319,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun creatorId(): Optional = - Optional.ofNullable(creatorId.getNullable("creatorId")) + fun creatorId(): Optional = creatorId.getOptional("creatorId") /** * The workspace creation date. @@ -3382,7 +3373,7 @@ private constructor( * if the server responded with an unexpected value). */ fun periodEndDate(): Optional = - Optional.ofNullable(periodEndDate.getNullable("periodEndDate")) + periodEndDate.getOptional("periodEndDate") /** * The start date of the current billing period. @@ -3391,7 +3382,7 @@ private constructor( * if the server responded with an unexpected value). */ fun periodStartDate(): Optional = - Optional.ofNullable(periodStartDate.getNullable("periodStartDate")) + periodStartDate.getOptional("periodStartDate") /** * The number of projects in the workspace. @@ -3424,15 +3415,14 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun inviteCode(): Optional = - Optional.ofNullable(inviteCode.getNullable("inviteCode")) + fun inviteCode(): Optional = inviteCode.getOptional("inviteCode") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ fun monthlyUsage(): Optional> = - Optional.ofNullable(monthlyUsage.getNullable("monthlyUsage")) + monthlyUsage.getOptional("monthlyUsage") /** * Whether the workspace only allows SAML authentication. @@ -3440,15 +3430,14 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun samlOnlyAccess(): Optional = - Optional.ofNullable(samlOnlyAccess.getNullable("samlOnlyAccess")) + fun samlOnlyAccess(): Optional = samlOnlyAccess.getOptional("samlOnlyAccess") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ fun wildcardDomains(): Optional> = - Optional.ofNullable(wildcardDomains.getNullable("wildcardDomains")) + wildcardDomains.getOptional("wildcardDomains") /** * Returns the raw JSON value of [id]. @@ -4250,21 +4239,20 @@ private constructor( * (e.g. if the server responded with an unexpected value). */ fun executionTimeMs(): Optional = - Optional.ofNullable(executionTimeMs.getNullable("executionTimeMs")) + executionTimeMs.getOptional("executionTimeMs") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun monthYear(): Optional = - Optional.ofNullable(monthYear.getNullable("monthYear")) + fun monthYear(): Optional = monthYear.getOptional("monthYear") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun predictionCount(): Optional = - Optional.ofNullable(predictionCount.getNullable("predictionCount")) + predictionCount.getOptional("predictionCount") /** * Returns the raw JSON value of [executionTimeMs]. From c2c150161ea17067c68e3ce7c54deebdf2461c4a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 5 Apr 2025 02:36:48 +0000 Subject: [PATCH 44/74] fix(client): return `Optional` instead of `Optional` (#109) docs: add comments to `JsonField` classes --- .../kotlin/com/openlayer/api/core/Values.kt | 237 ++++++++++++++++-- 1 file changed, 218 insertions(+), 19 deletions(-) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt index 4fcdb37d..88f25c14 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt @@ -29,30 +29,51 @@ import java.io.InputStream import java.util.Objects import java.util.Optional +/** + * A class representing a serializable JSON field. + * + * It can either be a [KnownValue] value of type [T], matching the type the SDK expects, or an + * arbitrary JSON value that bypasses the type system (via [JsonValue]). + */ @JsonDeserialize(using = JsonField.Deserializer::class) sealed class JsonField { + /** + * Returns whether this field is missing, which means it will be omitted from the serialized + * JSON entirely. + */ fun isMissing(): Boolean = this is JsonMissing + /** Whether this field is explicitly set to `null`. */ fun isNull(): Boolean = this is JsonNull - fun asKnown(): Optional = - when (this) { - is KnownValue -> Optional.of(value) - else -> Optional.empty() - } + /** + * Returns an [Optional] containing this field's "known" value, meaning it matches the type the + * SDK expects, or an empty [Optional] if this field contains an arbitrary [JsonValue]. + * + * This is the opposite of [asUnknown]. + */ + fun asKnown(): + Optional< + // Safe because `Optional` is effectively covariant, but Kotlin doesn't know that. + @UnsafeVariance + T + > = Optional.ofNullable((this as? KnownValue)?.value) /** - * If the "known" value (i.e. matching the type that the SDK expects) is returned by the API - * then this method will return an empty `Optional`, otherwise the returned `Optional` is given - * a `JsonValue`. + * Returns an [Optional] containing this field's arbitrary [JsonValue], meaning it mismatches + * the type the SDK expects, or an empty [Optional] if this field contains a "known" value. + * + * This is the opposite of [asKnown]. */ - fun asUnknown(): Optional = - when (this) { - is JsonValue -> Optional.of(this) - else -> Optional.empty() - } + fun asUnknown(): Optional = Optional.ofNullable(this as? JsonValue) + /** + * Returns an [Optional] containing this field's boolean value, or an empty [Optional] if it + * doesn't contain a boolean. + * + * This method checks for both a [KnownValue] containing a boolean and for [JsonBoolean]. + */ fun asBoolean(): Optional = when (this) { is JsonBoolean -> Optional.of(value) @@ -60,6 +81,12 @@ sealed class JsonField { else -> Optional.empty() } + /** + * Returns an [Optional] containing this field's numerical value, or an empty [Optional] if it + * doesn't contain a number. + * + * This method checks for both a [KnownValue] containing a number and for [JsonNumber]. + */ fun asNumber(): Optional = when (this) { is JsonNumber -> Optional.of(value) @@ -67,6 +94,12 @@ sealed class JsonField { else -> Optional.empty() } + /** + * Returns an [Optional] containing this field's string value, or an empty [Optional] if it + * doesn't contain a string. + * + * This method checks for both a [KnownValue] containing a string and for [JsonString]. + */ fun asString(): Optional = when (this) { is JsonString -> Optional.of(value) @@ -77,6 +110,12 @@ sealed class JsonField { fun asStringOrThrow(): String = asString().orElseThrow { OpenlayerInvalidDataException("Value is not a string") } + /** + * Returns an [Optional] containing this field's list value, or an empty [Optional] if it + * doesn't contain a list. + * + * This method checks for both a [KnownValue] containing a list and for [JsonArray]. + */ fun asArray(): Optional> = when (this) { is JsonArray -> Optional.of(values) @@ -95,6 +134,12 @@ sealed class JsonField { else -> Optional.empty() } + /** + * Returns an [Optional] containing this field's map value, or an empty [Optional] if it doesn't + * contain a map. + * + * This method checks for both a [KnownValue] containing a map and for [JsonObject]. + */ fun asObject(): Optional> = when (this) { is JsonObject -> Optional.of(values) @@ -132,7 +177,13 @@ sealed class JsonField { } @JvmSynthetic - internal fun getOptional(name: String): Optional<@UnsafeVariance T> = + internal fun getOptional( + name: String + ): Optional< + // Safe because `Optional` is effectively covariant, but Kotlin doesn't know that. + @UnsafeVariance + T + > = when (this) { is KnownValue -> Optional.of(value) is JsonMissing, @@ -147,21 +198,33 @@ sealed class JsonField { is JsonValue -> this } - @JvmSynthetic fun accept(consume: (T) -> Unit) = asKnown().ifPresent(consume) + @JvmSynthetic internal fun accept(consume: (T) -> Unit) = asKnown().ifPresent(consume) + /** Returns the result of calling the [visitor] method corresponding to this field's state. */ fun accept(visitor: Visitor): R = when (this) { is KnownValue -> visitor.visitKnown(value) is JsonValue -> accept(visitor as JsonValue.Visitor) } + /** + * An interface that defines how to map each possible state of a `JsonField` to a value of + * type [R]. + */ interface Visitor : JsonValue.Visitor { + fun visitKnown(value: T): R = visitDefault() } companion object { + + /** Returns a [JsonField] containing the given "known" [value]. */ @JvmStatic fun of(value: T): JsonField = KnownValue.of(value) + /** + * Returns a [JsonField] containing the given "known" [value], or [JsonNull] if [value] is + * null. + */ @JvmStatic fun ofNullable(value: T?): JsonField = when (value) { @@ -176,6 +239,7 @@ sealed class JsonField { * annotation. */ class IsMissing { + override fun equals(other: Any?): Boolean = other is JsonMissing override fun hashCode(): Int = Objects.hash() @@ -197,6 +261,12 @@ sealed class JsonField { } } +/** + * A class representing an arbitrary JSON value. + * + * It is immutable and assignable to any [JsonField], regardless of its expected type (i.e. its + * generic type argument). + */ @JsonDeserialize(using = JsonValue.Deserializer::class) sealed class JsonValue : JsonField() { @@ -204,6 +274,7 @@ sealed class JsonValue : JsonField() { fun convert(type: Class): R? = JSON_MAPPER.convertValue(this, type) + /** Returns the result of calling the [visitor] method corresponding to this value's variant. */ fun accept(visitor: Visitor): R = when (this) { is JsonMissing -> visitor.visitMissing() @@ -215,7 +286,12 @@ sealed class JsonValue : JsonField() { is JsonObject -> visitor.visitObject(values) } + /** + * An interface that defines how to map each variant state of a [JsonValue] to a value of type + * [R]. + */ interface Visitor { + fun visitNull(): R = visitDefault() fun visitMissing(): R = visitDefault() @@ -230,15 +306,52 @@ sealed class JsonValue : JsonField() { fun visitObject(values: Map): R = visitDefault() - fun visitDefault(): R { - throw RuntimeException("Unexpected value") - } + /** + * The default implementation for unimplemented visitor methods. + * + * @throws IllegalArgumentException in the default implementation. + */ + fun visitDefault(): R = throw IllegalArgumentException("Unexpected value") } companion object { private val JSON_MAPPER = jsonMapper() + /** + * Converts the given [value] to a [JsonValue]. + * + * This method works best on primitive types, [List] values, [Map] values, and nested + * combinations of these. For example: + * ```java + * // Create primitive JSON values + * JsonValue nullValue = JsonValue.from(null); + * JsonValue booleanValue = JsonValue.from(true); + * JsonValue numberValue = JsonValue.from(42); + * JsonValue stringValue = JsonValue.from("Hello World!"); + * + * // Create a JSON array value equivalent to `["Hello", "World"]` + * JsonValue arrayValue = JsonValue.from(List.of("Hello", "World")); + * + * // Create a JSON object value equivalent to `{ "a": 1, "b": 2 }` + * JsonValue objectValue = JsonValue.from(Map.of( + * "a", 1, + * "b", 2 + * )); + * + * // Create an arbitrarily nested JSON equivalent to: + * // { + * // "a": [1, 2], + * // "b": [3, 4] + * // } + * JsonValue complexValue = JsonValue.from(Map.of( + * "a", List.of(1, 2), + * "b", List.of(3, 4) + * )); + * ``` + * + * @throws IllegalArgumentException if [value] is not JSON serializable. + */ @JvmStatic fun from(value: Any?): JsonValue = when (value) { @@ -247,6 +360,11 @@ sealed class JsonValue : JsonField() { else -> JSON_MAPPER.convertValue(value, JsonValue::class.java) } + /** + * Returns a [JsonValue] converted from the given Jackson [JsonNode]. + * + * @throws IllegalStateException for unsupported node types. + */ @JvmStatic fun fromJsonNode(node: JsonNode): JsonValue = when (node.nodeType) { @@ -268,12 +386,19 @@ sealed class JsonValue : JsonField() { } class Deserializer : BaseDeserializer(JsonValue::class) { + override fun ObjectCodec.deserialize(node: JsonNode): JsonValue = fromJsonNode(node) override fun getNullValue(context: DeserializationContext?): JsonValue = JsonNull.of() } } +/** + * A class representing a "known" JSON serializable value of type [T], matching the type the SDK + * expects. + * + * It is assignable to `JsonField`. + */ class KnownValue private constructor( @com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: T @@ -292,44 +417,59 @@ private constructor( override fun toString() = value.contentToString() companion object { + + /** Returns a [KnownValue] containing the given [value]. */ @JsonCreator @JvmStatic fun of(value: T) = KnownValue(value) } } +/** + * A [JsonValue] representing an omitted JSON field. + * + * An instance of this class will cause a JSON field to be omitted from the serialized JSON + * entirely. + */ @JsonSerialize(using = JsonMissing.Serializer::class) class JsonMissing : JsonValue() { override fun toString() = "" companion object { + private val INSTANCE: JsonMissing = JsonMissing() + /** Returns the singleton instance of [JsonMissing]. */ @JvmStatic fun of() = INSTANCE } class Serializer : BaseSerializer(JsonMissing::class) { + override fun serialize( value: JsonMissing, generator: JsonGenerator, provider: SerializerProvider, ) { - throw RuntimeException("JsonMissing cannot be serialized") + throw IllegalStateException("JsonMissing cannot be serialized") } } } +/** A [JsonValue] representing a JSON `null` value. */ @JsonSerialize(using = NullSerializer::class) class JsonNull : JsonValue() { override fun toString() = "null" companion object { + private val INSTANCE: JsonNull = JsonNull() + /** Returns the singleton instance of [JsonMissing]. */ @JsonCreator @JvmStatic fun of() = INSTANCE } } +/** A [JsonValue] representing a JSON boolean value. */ class JsonBoolean private constructor( @get:com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: Boolean @@ -348,14 +488,18 @@ private constructor( override fun toString() = value.toString() companion object { + + /** Returns a [JsonBoolean] containing the given [value]. */ @JsonCreator @JvmStatic fun of(value: Boolean) = JsonBoolean(value) } } +/** A [JsonValue] representing a JSON number value. */ class JsonNumber private constructor( @get:com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: Number ) : JsonValue() { + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -369,10 +513,13 @@ private constructor( override fun toString() = value.toString() companion object { + + /** Returns a [JsonNumber] containing the given [value]. */ @JsonCreator @JvmStatic fun of(value: Number) = JsonNumber(value) } } +/** A [JsonValue] representing a JSON string value. */ class JsonString private constructor( @get:com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: String @@ -391,10 +538,13 @@ private constructor( override fun toString() = value companion object { + + /** Returns a [JsonString] containing the given [value]. */ @JsonCreator @JvmStatic fun of(value: String) = JsonString(value) } } +/** A [JsonValue] representing a JSON array value. */ class JsonArray private constructor( @get:com.fasterxml.jackson.annotation.JsonValue @@ -415,10 +565,13 @@ private constructor( override fun toString() = values.toString() companion object { + + /** Returns a [JsonArray] containing the given [values]. */ @JsonCreator @JvmStatic fun of(values: List) = JsonArray(values.toImmutable()) } } +/** A [JsonValue] representing a JSON object value. */ class JsonObject private constructor( @get:com.fasterxml.jackson.annotation.JsonValue @@ -439,32 +592,62 @@ private constructor( override fun toString() = values.toString() companion object { + + /** Returns a [JsonObject] containing the given [values]. */ @JsonCreator @JvmStatic fun of(values: Map) = JsonObject(values.toImmutable()) } } +/** A Jackson annotation for excluding fields set to [JsonMissing] from the serialized JSON. */ @JacksonAnnotationsInside @JsonInclude(JsonInclude.Include.CUSTOM, valueFilter = JsonField.IsMissing::class) annotation class ExcludeMissing +/** A class representing a field in a `multipart/form-data` request. */ class MultipartField private constructor( + /** A [JsonField] value, which will be serialized to zero or more parts. */ @get:com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: JsonField, + /** A content type for the serialized parts. */ @get:JvmName("contentType") val contentType: String, private val filename: String?, ) { companion object { + /** + * Returns a [MultipartField] containing the given [value] as a [KnownValue]. + * + * [contentType] will be set to `application/octet-stream` if [value] is binary data, or + * `text/plain; charset=utf-8` otherwise. + */ @JvmStatic fun of(value: T?) = builder().value(value).build() + /** + * Returns a [MultipartField] containing the given [value]. + * + * [contentType] will be set to `application/octet-stream` if [value] is binary data, or + * `text/plain; charset=utf-8` otherwise. + */ @JvmStatic fun of(value: JsonField) = builder().value(value).build() + /** + * Returns a mutable builder for constructing an instance of [MultipartField]. + * + * The following fields are required: + * ```java + * .value() + * ``` + * + * If [contentType] is unset, then it will be set to `application/octet-stream` if [value] + * is binary data, or `text/plain; charset=utf-8` otherwise. + */ @JvmStatic fun builder() = Builder() } + /** Returns the filename directive that will be included in the serialized field. */ fun filename(): Optional = Optional.ofNullable(filename) @JvmSynthetic @@ -486,8 +669,24 @@ private constructor( fun filename(filename: String?) = apply { this.filename = filename } + /** Alias for calling [Builder.filename] with `filename.orElse(null)`. */ fun filename(filename: Optional) = filename(filename.orElse(null)) + /** + * Returns an immutable instance of [MultipartField]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .value() + * ``` + * + * If [contentType] is unset, then it will be set to `application/octet-stream` if [value] + * is binary data, or `text/plain; charset=utf-8` otherwise. + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): MultipartField { val value = checkRequired("value", value) return MultipartField( From f7bf9f790253baaf2b8f9a192eac238db160e62b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 5 Apr 2025 02:47:25 +0000 Subject: [PATCH 45/74] docs: swap examples used in readme (#110) docs: document how to forcibly omit required field --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 12c92b56..94cfe6c8 100644 --- a/README.md +++ b/README.md @@ -459,6 +459,30 @@ JsonValue complexValue = JsonValue.from(Map.of( )); ``` +Normally a `Builder` class's `build` method will throw [`IllegalStateException`](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html) if any required parameter or property is unset. + +To forcibly omit a required parameter or property, pass [`JsonMissing`](openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt): + +```java +import com.openlayer.api.core.JsonMissing; +import com.openlayer.api.core.JsonValue; +import com.openlayer.api.models.inferencepipelines.data.DataStreamParams; + +DataStreamParams params = DataStreamParams.builder() + .config(DataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .build()) + .addRow(DataStreamParams.Row.builder() + .putAdditionalProperty("user_query", JsonValue.from("bar")) + .putAdditionalProperty("output", JsonValue.from("bar")) + .putAdditionalProperty("tokens", JsonValue.from("bar")) + .putAdditionalProperty("cost", JsonValue.from("bar")) + .putAdditionalProperty("timestamp", JsonValue.from("bar")) + .build()) + .inferencePipelineId(JsonMissing.of()) + .build(); +``` + ### Response properties To access undocumented response properties, call the `_additionalProperties()` method: From b8c855b09d13118ca76e7c053f5a1c76f33c4640 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 02:42:08 +0000 Subject: [PATCH 46/74] chore(tests): improve enum examples (#111) --- .../api/models/commits/CommitRetrieveResponseTest.kt | 7 ++++--- .../commits/testresults/TestResultListParamsTest.kt | 6 +++--- .../testresults/TestResultListResponseTest.kt | 6 +++--- .../InferencePipelineRetrieveResponseTest.kt | 6 +++--- .../InferencePipelineUpdateResponseTest.kt | 6 +++--- .../testresults/TestResultListParamsTest.kt | 6 +++--- .../testresults/TestResultListResponseTest.kt | 6 +++--- .../projects/commits/CommitCreateParamsTest.kt | 12 ++++++------ .../projects/commits/CommitCreateResponseTest.kt | 6 +++--- .../projects/commits/CommitListResponseTest.kt | 6 +++--- .../InferencePipelineCreateParamsTest.kt | 12 ++++++------ .../InferencePipelineCreateResponseTest.kt | 6 +++--- .../InferencePipelineListResponseTest.kt | 6 +++--- .../async/commits/TestResultServiceAsyncTest.kt | 2 +- .../inferencepipelines/TestResultServiceAsyncTest.kt | 2 +- .../async/projects/CommitServiceAsyncTest.kt | 2 +- .../projects/InferencePipelineServiceAsyncTest.kt | 2 +- .../blocking/commits/TestResultServiceTest.kt | 2 +- .../inferencepipelines/TestResultServiceTest.kt | 2 +- .../services/blocking/projects/CommitServiceTest.kt | 2 +- .../projects/InferencePipelineServiceTest.kt | 2 +- 21 files changed, 54 insertions(+), 53 deletions(-) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt index 0d78d471..1183d6fe 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponseTest.kt @@ -37,7 +37,7 @@ internal class CommitRetrieveResponseTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(CommitRetrieveResponse.Status.QUEUED) + .status(CommitRetrieveResponse.Status.COMPLETED) .statusMessage("Commit successfully processed.") .totalGoalCount(6L) .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -81,7 +81,8 @@ internal class CommitRetrieveResponseTest { assertThat(commitRetrieveResponse.passingGoalCount()).isEqualTo(5L) assertThat(commitRetrieveResponse.projectId()) .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(commitRetrieveResponse.status()).isEqualTo(CommitRetrieveResponse.Status.QUEUED) + assertThat(commitRetrieveResponse.status()) + .isEqualTo(CommitRetrieveResponse.Status.COMPLETED) assertThat(commitRetrieveResponse.statusMessage()) .contains("Commit successfully processed.") assertThat(commitRetrieveResponse.totalGoalCount()).isEqualTo(6L) @@ -129,7 +130,7 @@ internal class CommitRetrieveResponseTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(CommitRetrieveResponse.Status.QUEUED) + .status(CommitRetrieveResponse.Status.COMPLETED) .statusMessage("Commit successfully processed.") .totalGoalCount(6L) .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt index 7de79c1c..4d27d136 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParamsTest.kt @@ -15,7 +15,7 @@ internal class TestResultListParamsTest { .includeArchived(true) .page(1L) .perPage(1L) - .status(TestResultListParams.Status.RUNNING) + .status(TestResultListParams.Status.PASSING) .type(TestResultListParams.Type.INTEGRITY) .build() } @@ -40,7 +40,7 @@ internal class TestResultListParamsTest { .includeArchived(true) .page(1L) .perPage(1L) - .status(TestResultListParams.Status.RUNNING) + .status(TestResultListParams.Status.PASSING) .type(TestResultListParams.Type.INTEGRITY) .build() @@ -52,7 +52,7 @@ internal class TestResultListParamsTest { .put("includeArchived", "true") .put("page", "1") .put("perPage", "1") - .put("status", "running") + .put("status", "passing") .put("type", "integrity") .build() ) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt index db3fb096..93ea3add 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt @@ -24,7 +24,7 @@ internal class TestResultListResponseTest { .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(TestResultListResponse.Item.Status.RUNNING) + .status(TestResultListResponse.Item.Status.PASSING) .statusMessage("Test successfully processed.") .goal( TestResultListResponse.Item.Goal.builder() @@ -79,7 +79,7 @@ internal class TestResultListResponseTest { .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(TestResultListResponse.Item.Status.RUNNING) + .status(TestResultListResponse.Item.Status.PASSING) .statusMessage("Test successfully processed.") .goal( TestResultListResponse.Item.Goal.builder() @@ -138,7 +138,7 @@ internal class TestResultListResponseTest { .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(TestResultListResponse.Item.Status.RUNNING) + .status(TestResultListResponse.Item.Status.PASSING) .statusMessage("Test successfully processed.") .goal( TestResultListResponse.Item.Goal.builder() diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt index e7793364..38456bee 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponseTest.kt @@ -33,7 +33,7 @@ internal class InferencePipelineRetrieveResponseTest { .name("production") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineRetrieveResponse.Status.QUEUED) + .status(InferencePipelineRetrieveResponse.Status.COMPLETED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( @@ -133,7 +133,7 @@ internal class InferencePipelineRetrieveResponseTest { assertThat(inferencePipelineRetrieveResponse.projectId()) .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(inferencePipelineRetrieveResponse.status()) - .isEqualTo(InferencePipelineRetrieveResponse.Status.QUEUED) + .isEqualTo(InferencePipelineRetrieveResponse.Status.COMPLETED) assertThat(inferencePipelineRetrieveResponse.statusMessage()) .contains("Tests successfully evaluated") assertThat(inferencePipelineRetrieveResponse.totalGoalCount()).isEqualTo(6L) @@ -232,7 +232,7 @@ internal class InferencePipelineRetrieveResponseTest { .name("production") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineRetrieveResponse.Status.QUEUED) + .status(InferencePipelineRetrieveResponse.Status.COMPLETED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt index c7efc74e..30ad9635 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponseTest.kt @@ -33,7 +33,7 @@ internal class InferencePipelineUpdateResponseTest { .name("production") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineUpdateResponse.Status.QUEUED) + .status(InferencePipelineUpdateResponse.Status.COMPLETED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( @@ -133,7 +133,7 @@ internal class InferencePipelineUpdateResponseTest { assertThat(inferencePipelineUpdateResponse.projectId()) .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(inferencePipelineUpdateResponse.status()) - .isEqualTo(InferencePipelineUpdateResponse.Status.QUEUED) + .isEqualTo(InferencePipelineUpdateResponse.Status.COMPLETED) assertThat(inferencePipelineUpdateResponse.statusMessage()) .contains("Tests successfully evaluated") assertThat(inferencePipelineUpdateResponse.totalGoalCount()).isEqualTo(6L) @@ -232,7 +232,7 @@ internal class InferencePipelineUpdateResponseTest { .name("production") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineUpdateResponse.Status.QUEUED) + .status(InferencePipelineUpdateResponse.Status.COMPLETED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt index 3ea847a1..4def730e 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListParamsTest.kt @@ -14,7 +14,7 @@ internal class TestResultListParamsTest { .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .page(1L) .perPage(1L) - .status(TestResultListParams.Status.RUNNING) + .status(TestResultListParams.Status.PASSING) .type(TestResultListParams.Type.INTEGRITY) .build() } @@ -38,7 +38,7 @@ internal class TestResultListParamsTest { .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .page(1L) .perPage(1L) - .status(TestResultListParams.Status.RUNNING) + .status(TestResultListParams.Status.PASSING) .type(TestResultListParams.Type.INTEGRITY) .build() @@ -49,7 +49,7 @@ internal class TestResultListParamsTest { QueryParams.builder() .put("page", "1") .put("perPage", "1") - .put("status", "running") + .put("status", "passing") .put("type", "integrity") .build() ) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt index 18efcffe..f0c7244a 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt @@ -24,7 +24,7 @@ internal class TestResultListResponseTest { .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(TestResultListResponse.Item.Status.RUNNING) + .status(TestResultListResponse.Item.Status.PASSING) .statusMessage("Test successfully processed.") .goal( TestResultListResponse.Item.Goal.builder() @@ -79,7 +79,7 @@ internal class TestResultListResponseTest { .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(TestResultListResponse.Item.Status.RUNNING) + .status(TestResultListResponse.Item.Status.PASSING) .statusMessage("Test successfully processed.") .goal( TestResultListResponse.Item.Goal.builder() @@ -138,7 +138,7 @@ internal class TestResultListResponseTest { .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(TestResultListResponse.Item.Status.RUNNING) + .status(TestResultListResponse.Item.Status.PASSING) .statusMessage("Test successfully processed.") .goal( TestResultListResponse.Item.Goal.builder() diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt index 465adccc..063b196d 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateParamsTest.kt @@ -35,7 +35,7 @@ internal class CommitCreateParamsTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(CommitCreateParams.Status.QUEUED) + .status(CommitCreateParams.Status.COMPLETED) .statusMessage("Commit successfully processed.") .storageUri("s3://...") .totalGoalCount(6L) @@ -77,7 +77,7 @@ internal class CommitCreateParamsTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(CommitCreateParams.Status.QUEUED) + .status(CommitCreateParams.Status.COMPLETED) .statusMessage("Commit successfully processed.") .storageUri("s3://...") .totalGoalCount(6L) @@ -118,7 +118,7 @@ internal class CommitCreateParamsTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(CommitCreateParams.Status.QUEUED) + .status(CommitCreateParams.Status.COMPLETED) .statusMessage("Commit successfully processed.") .storageUri("s3://...") .totalGoalCount(6L) @@ -161,7 +161,7 @@ internal class CommitCreateParamsTest { assertThat(body.mlModelId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.passingGoalCount()).isEqualTo(5L) assertThat(body.bodyProjectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(body.status()).isEqualTo(CommitCreateParams.Status.QUEUED) + assertThat(body.status()).isEqualTo(CommitCreateParams.Status.COMPLETED) assertThat(body.statusMessage()).contains("Commit successfully processed.") assertThat(body.storageUri()).isEqualTo("s3://...") assertThat(body.totalGoalCount()).isEqualTo(6L) @@ -203,7 +203,7 @@ internal class CommitCreateParamsTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(CommitCreateParams.Status.QUEUED) + .status(CommitCreateParams.Status.COMPLETED) .statusMessage("Commit successfully processed.") .storageUri("s3://...") .totalGoalCount(6L) @@ -233,7 +233,7 @@ internal class CommitCreateParamsTest { assertThat(body.mlModelId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(body.passingGoalCount()).isEqualTo(5L) assertThat(body.bodyProjectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(body.status()).isEqualTo(CommitCreateParams.Status.QUEUED) + assertThat(body.status()).isEqualTo(CommitCreateParams.Status.COMPLETED) assertThat(body.statusMessage()).contains("Commit successfully processed.") assertThat(body.storageUri()).isEqualTo("s3://...") assertThat(body.totalGoalCount()).isEqualTo(6L) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt index ad2e5cb1..39dde058 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitCreateResponseTest.kt @@ -37,7 +37,7 @@ internal class CommitCreateResponseTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(CommitCreateResponse.Status.QUEUED) + .status(CommitCreateResponse.Status.COMPLETED) .statusMessage("Commit successfully processed.") .totalGoalCount(6L) .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -81,7 +81,7 @@ internal class CommitCreateResponseTest { assertThat(commitCreateResponse.passingGoalCount()).isEqualTo(5L) assertThat(commitCreateResponse.projectId()) .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(commitCreateResponse.status()).isEqualTo(CommitCreateResponse.Status.QUEUED) + assertThat(commitCreateResponse.status()).isEqualTo(CommitCreateResponse.Status.COMPLETED) assertThat(commitCreateResponse.statusMessage()).contains("Commit successfully processed.") assertThat(commitCreateResponse.totalGoalCount()).isEqualTo(6L) assertThat(commitCreateResponse.trainingDatasetId()) @@ -128,7 +128,7 @@ internal class CommitCreateResponseTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(CommitCreateResponse.Status.QUEUED) + .status(CommitCreateResponse.Status.COMPLETED) .statusMessage("Commit successfully processed.") .totalGoalCount(6L) .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt index 89a9b7f0..458550ff 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/commits/CommitListResponseTest.kt @@ -39,7 +39,7 @@ internal class CommitListResponseTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(CommitListResponse.Item.Status.QUEUED) + .status(CommitListResponse.Item.Status.COMPLETED) .statusMessage("Commit successfully processed.") .totalGoalCount(6L) .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -83,7 +83,7 @@ internal class CommitListResponseTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(CommitListResponse.Item.Status.QUEUED) + .status(CommitListResponse.Item.Status.COMPLETED) .statusMessage("Commit successfully processed.") .totalGoalCount(6L) .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -131,7 +131,7 @@ internal class CommitListResponseTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(CommitListResponse.Item.Status.QUEUED) + .status(CommitListResponse.Item.Status.COMPLETED) .statusMessage("Commit successfully processed.") .totalGoalCount(6L) .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt index 22054f17..ec1a1c86 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParamsTest.kt @@ -31,7 +31,7 @@ internal class InferencePipelineCreateParamsTest { .name("production") .passingGoalCount(5L) .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineCreateParams.Status.QUEUED) + .status(InferencePipelineCreateParams.Status.COMPLETED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( @@ -127,7 +127,7 @@ internal class InferencePipelineCreateParamsTest { .name("production") .passingGoalCount(5L) .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineCreateParams.Status.QUEUED) + .status(InferencePipelineCreateParams.Status.COMPLETED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .build() @@ -160,7 +160,7 @@ internal class InferencePipelineCreateParamsTest { .name("production") .passingGoalCount(5L) .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineCreateParams.Status.QUEUED) + .status(InferencePipelineCreateParams.Status.COMPLETED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( @@ -256,7 +256,7 @@ internal class InferencePipelineCreateParamsTest { assertThat(body.name()).isEqualTo("production") assertThat(body.passingGoalCount()).isEqualTo(5L) assertThat(body.bodyProjectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(body.status()).isEqualTo(InferencePipelineCreateParams.Status.QUEUED) + assertThat(body.status()).isEqualTo(InferencePipelineCreateParams.Status.COMPLETED) assertThat(body.statusMessage()).contains("Tests successfully evaluated") assertThat(body.totalGoalCount()).isEqualTo(6L) assertThat(body.project()) @@ -353,7 +353,7 @@ internal class InferencePipelineCreateParamsTest { .name("production") .passingGoalCount(5L) .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineCreateParams.Status.QUEUED) + .status(InferencePipelineCreateParams.Status.COMPLETED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .build() @@ -382,7 +382,7 @@ internal class InferencePipelineCreateParamsTest { assertThat(body.name()).isEqualTo("production") assertThat(body.passingGoalCount()).isEqualTo(5L) assertThat(body.bodyProjectId()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(body.status()).isEqualTo(InferencePipelineCreateParams.Status.QUEUED) + assertThat(body.status()).isEqualTo(InferencePipelineCreateParams.Status.COMPLETED) assertThat(body.statusMessage()).contains("Tests successfully evaluated") assertThat(body.totalGoalCount()).isEqualTo(6L) } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt index 75f658b8..b6658491 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponseTest.kt @@ -33,7 +33,7 @@ internal class InferencePipelineCreateResponseTest { .name("production") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineCreateResponse.Status.QUEUED) + .status(InferencePipelineCreateResponse.Status.COMPLETED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( @@ -133,7 +133,7 @@ internal class InferencePipelineCreateResponseTest { assertThat(inferencePipelineCreateResponse.projectId()) .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") assertThat(inferencePipelineCreateResponse.status()) - .isEqualTo(InferencePipelineCreateResponse.Status.QUEUED) + .isEqualTo(InferencePipelineCreateResponse.Status.COMPLETED) assertThat(inferencePipelineCreateResponse.statusMessage()) .contains("Tests successfully evaluated") assertThat(inferencePipelineCreateResponse.totalGoalCount()).isEqualTo(6L) @@ -232,7 +232,7 @@ internal class InferencePipelineCreateResponseTest { .name("production") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineCreateResponse.Status.QUEUED) + .status(InferencePipelineCreateResponse.Status.COMPLETED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt index 9ace9e03..234dc317 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponseTest.kt @@ -35,7 +35,7 @@ internal class InferencePipelineListResponseTest { .name("production") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineListResponse.Item.Status.QUEUED) + .status(InferencePipelineListResponse.Item.Status.COMPLETED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( @@ -137,7 +137,7 @@ internal class InferencePipelineListResponseTest { .name("production") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineListResponse.Item.Status.QUEUED) + .status(InferencePipelineListResponse.Item.Status.COMPLETED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( @@ -236,7 +236,7 @@ internal class InferencePipelineListResponseTest { .name("production") .passingGoalCount(5L) .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineListResponse.Item.Status.QUEUED) + .status(InferencePipelineListResponse.Item.Status.COMPLETED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt index f78c4d42..d9bc2dc4 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncTest.kt @@ -27,7 +27,7 @@ internal class TestResultServiceAsyncTest { .includeArchived(true) .page(1L) .perPage(1L) - .status(TestResultListParams.Status.RUNNING) + .status(TestResultListParams.Status.PASSING) .type(TestResultListParams.Type.INTEGRITY) .build() ) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncTest.kt index 9f5103cc..c42e5bae 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/inferencepipelines/TestResultServiceAsyncTest.kt @@ -26,7 +26,7 @@ internal class TestResultServiceAsyncTest { .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .page(1L) .perPage(1L) - .status(TestResultListParams.Status.RUNNING) + .status(TestResultListParams.Status.PASSING) .type(TestResultListParams.Type.INTEGRITY) .build() ) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt index 59ae465f..3bdcb1a4 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncTest.kt @@ -49,7 +49,7 @@ internal class CommitServiceAsyncTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(CommitCreateParams.Status.QUEUED) + .status(CommitCreateParams.Status.COMPLETED) .statusMessage("Commit successfully processed.") .storageUri("s3://...") .totalGoalCount(6L) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt index 834205b2..7a76a2c1 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncTest.kt @@ -45,7 +45,7 @@ internal class InferencePipelineServiceAsyncTest { .name("production") .passingGoalCount(5L) .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineCreateParams.Status.QUEUED) + .status(InferencePipelineCreateParams.Status.COMPLETED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt index 2632cbaa..ed3c4923 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt @@ -27,7 +27,7 @@ internal class TestResultServiceTest { .includeArchived(true) .page(1L) .perPage(1L) - .status(TestResultListParams.Status.RUNNING) + .status(TestResultListParams.Status.PASSING) .type(TestResultListParams.Type.INTEGRITY) .build() ) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceTest.kt index 3686da0b..876a2f61 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencepipelines/TestResultServiceTest.kt @@ -26,7 +26,7 @@ internal class TestResultServiceTest { .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .page(1L) .perPage(1L) - .status(TestResultListParams.Status.RUNNING) + .status(TestResultListParams.Status.PASSING) .type(TestResultListParams.Type.INTEGRITY) .build() ) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt index 39f3730f..123a0e55 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt @@ -49,7 +49,7 @@ internal class CommitServiceTest { .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") .passingGoalCount(5L) .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(CommitCreateParams.Status.QUEUED) + .status(CommitCreateParams.Status.COMPLETED) .statusMessage("Commit successfully processed.") .storageUri("s3://...") .totalGoalCount(6L) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt index 20f412a4..e976bf54 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt @@ -45,7 +45,7 @@ internal class InferencePipelineServiceTest { .name("production") .passingGoalCount(5L) .bodyProjectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(InferencePipelineCreateParams.Status.QUEUED) + .status(InferencePipelineCreateParams.Status.COMPLETED) .statusMessage("Tests successfully evaluated") .totalGoalCount(6L) .project( From 08e6ac1c7327d8c832035b29242b10c8678f2543 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 03:02:17 +0000 Subject: [PATCH 47/74] feat(client): support setting base URL via env var --- README.md | 17 +++++++++-------- .../api/client/okhttp/OpenlayerOkHttpClient.kt | 8 ++------ .../client/okhttp/OpenlayerOkHttpClientAsync.kt | 8 ++------ .../com/openlayer/api/core/ClientOptions.kt | 7 ++++++- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 94cfe6c8..24e37006 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ import com.openlayer.api.core.JsonValue; import com.openlayer.api.models.inferencepipelines.data.DataStreamParams; import com.openlayer.api.models.inferencepipelines.data.DataStreamResponse; -// Configures using the `OPENLAYER_API_KEY` environment variable +// Configures using the `OPENLAYER_API_KEY` and `OPENLAYER_BASE_URL` environment variables OpenlayerClient client = OpenlayerOkHttpClient.fromEnv(); DataStreamParams params = DataStreamParams.builder() @@ -83,7 +83,7 @@ Configure the client using environment variables: import com.openlayer.api.client.OpenlayerClient; import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient; -// Configures using the `OPENLAYER_API_KEY` environment variable +// Configures using the `OPENLAYER_API_KEY` and `OPENLAYER_BASE_URL` environment variables OpenlayerClient client = OpenlayerOkHttpClient.fromEnv(); ``` @@ -105,7 +105,7 @@ import com.openlayer.api.client.OpenlayerClient; import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient; OpenlayerClient client = OpenlayerOkHttpClient.builder() - // Configures using the `OPENLAYER_API_KEY` environment variable + // Configures using the `OPENLAYER_API_KEY` and `OPENLAYER_BASE_URL` environment variables .fromEnv() .apiKey("My API Key") .build(); @@ -113,9 +113,10 @@ OpenlayerClient client = OpenlayerOkHttpClient.builder() See this table for the available options: -| Setter | Environment variable | Required | Default value | -| -------- | -------------------- | -------- | ------------- | -| `apiKey` | `OPENLAYER_API_KEY` | false | - | +| Setter | Environment variable | Required | Default value | +| --------- | -------------------- | -------- | -------------------------------- | +| `apiKey` | `OPENLAYER_API_KEY` | false | - | +| `baseUrl` | `OPENLAYER_BASE_URL` | true | `"https://api.openlayer.com/v1"` | > [!TIP] > Don't create more than one client in the same application. Each client has a connection pool and @@ -147,7 +148,7 @@ import com.openlayer.api.models.inferencepipelines.data.DataStreamParams; import com.openlayer.api.models.inferencepipelines.data.DataStreamResponse; import java.util.concurrent.CompletableFuture; -// Configures using the `OPENLAYER_API_KEY` environment variable +// Configures using the `OPENLAYER_API_KEY` and `OPENLAYER_BASE_URL` environment variables OpenlayerClient client = OpenlayerOkHttpClient.fromEnv(); DataStreamParams params = DataStreamParams.builder() @@ -180,7 +181,7 @@ import com.openlayer.api.models.inferencepipelines.data.DataStreamParams; import com.openlayer.api.models.inferencepipelines.data.DataStreamResponse; import java.util.concurrent.CompletableFuture; -// Configures using the `OPENLAYER_API_KEY` environment variable +// Configures using the `OPENLAYER_API_KEY` and `OPENLAYER_BASE_URL` environment variables OpenlayerClientAsync client = OpenlayerOkHttpClientAsync.fromEnv(); DataStreamParams params = DataStreamParams.builder() diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt index 73445a10..84b59f0f 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt @@ -29,14 +29,10 @@ class OpenlayerOkHttpClient private constructor() { class Builder internal constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() - private var baseUrl: String = ClientOptions.PRODUCTION_URL private var timeout: Timeout = Timeout.default() private var proxy: Proxy? = null - fun baseUrl(baseUrl: String) = apply { - clientOptions.baseUrl(baseUrl) - this.baseUrl = baseUrl - } + fun baseUrl(baseUrl: String) = apply { clientOptions.baseUrl(baseUrl) } /** * Whether to throw an exception if any of the Jackson versions detected at runtime are @@ -172,7 +168,7 @@ class OpenlayerOkHttpClient private constructor() { clientOptions .httpClient( OkHttpClient.builder() - .baseUrl(baseUrl) + .baseUrl(clientOptions.baseUrl()) .timeout(timeout) .proxy(proxy) .build() diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt index 54d60721..ed7c1612 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt @@ -31,14 +31,10 @@ class OpenlayerOkHttpClientAsync private constructor() { class Builder internal constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() - private var baseUrl: String = ClientOptions.PRODUCTION_URL private var timeout: Timeout = Timeout.default() private var proxy: Proxy? = null - fun baseUrl(baseUrl: String) = apply { - clientOptions.baseUrl(baseUrl) - this.baseUrl = baseUrl - } + fun baseUrl(baseUrl: String) = apply { clientOptions.baseUrl(baseUrl) } /** * Whether to throw an exception if any of the Jackson versions detected at runtime are @@ -174,7 +170,7 @@ class OpenlayerOkHttpClientAsync private constructor() { clientOptions .httpClient( OkHttpClient.builder() - .baseUrl(baseUrl) + .baseUrl(clientOptions.baseUrl()) .timeout(timeout) .proxy(proxy) .build() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt index 39084877..37bbbb54 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt @@ -190,7 +190,12 @@ private constructor( fun removeAllQueryParams(keys: Set) = apply { queryParams.removeAll(keys) } - fun fromEnv() = apply { System.getenv("OPENLAYER_API_KEY")?.let { apiKey(it) } } + fun baseUrl(): String = baseUrl + + fun fromEnv() = apply { + System.getenv("OPENLAYER_BASE_URL")?.let { baseUrl(it) } + System.getenv("OPENLAYER_API_KEY")?.let { apiKey(it) } + } /** * Returns an immutable instance of [ClientOptions]. From 273f4a712c63235e663b5e2ddba53797f2cf441c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 03:21:06 +0000 Subject: [PATCH 48/74] chore(internal): expand CI branch coverage --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e20299a2..eb0a9ad4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,18 @@ name: CI on: push: - branches: - - main - pull_request: - branches: - - main - - next + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'preview-head/**' + - 'preview-base/**' + - 'preview/**' jobs: lint: name: lint runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 From fc11f45df797c93281e670e35ecd00c6530d0af4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 03:43:08 +0000 Subject: [PATCH 49/74] fix(client): bump to better jackson version --- openlayer-java-core/build.gradle.kts | 12 ++++++------ .../src/main/kotlin/com/openlayer/api/core/Check.kt | 4 ++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/openlayer-java-core/build.gradle.kts b/openlayer-java-core/build.gradle.kts index 3390e95d..5e14f894 100644 --- a/openlayer-java-core/build.gradle.kts +++ b/openlayer-java-core/build.gradle.kts @@ -17,14 +17,14 @@ configurations.all { } dependencies { - api("com.fasterxml.jackson.core:jackson-core:2.18.1") - api("com.fasterxml.jackson.core:jackson-databind:2.18.1") + api("com.fasterxml.jackson.core:jackson-core:2.18.2") + api("com.fasterxml.jackson.core:jackson-databind:2.18.2") api("com.google.errorprone:error_prone_annotations:2.33.0") - implementation("com.fasterxml.jackson.core:jackson-annotations:2.18.1") - implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.1") - implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.1") - implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.1") + implementation("com.fasterxml.jackson.core:jackson-annotations:2.18.2") + implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.2") + implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2") + implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.2") implementation("org.apache.httpcomponents.core5:httpcore5:5.2.4") implementation("org.apache.httpcomponents.client5:httpclient5:5.3.1") diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt index a086432f..efcc5521 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt @@ -47,6 +47,7 @@ internal fun checkMaxLength(name: String, value: String, maxLength: Int): String internal fun checkJacksonVersionCompatibility() { val incompatibleJacksonVersions = RUNTIME_JACKSON_VERSIONS.mapNotNull { + val badVersionReason = BAD_JACKSON_VERSIONS[it.toString()] when { it.majorVersion != MINIMUM_JACKSON_VERSION.majorVersion -> it to "incompatible major version" @@ -55,6 +56,7 @@ internal fun checkJacksonVersionCompatibility() { it.minorVersion == MINIMUM_JACKSON_VERSION.minorVersion && it.patchLevel < MINIMUM_JACKSON_VERSION.patchLevel -> it to "patch version too low" + badVersionReason != null -> it to badVersionReason else -> null } } @@ -77,6 +79,8 @@ Double-check that you are depending on compatible Jackson versions. } private val MINIMUM_JACKSON_VERSION: Version = VersionUtil.parseVersion("2.13.4", null, null) +private val BAD_JACKSON_VERSIONS: Map = + mapOf("2.18.1" to "due to https://github.com/FasterXML/jackson-databind/issues/4639") private val RUNTIME_JACKSON_VERSIONS: List = listOf( com.fasterxml.jackson.core.json.PackageVersion.VERSION, From 3169980b67081c80cadb5af4869982a2a3eadedd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 04:21:53 +0000 Subject: [PATCH 50/74] chore(internal): reduce CI branch coverage --- .github/workflows/ci.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb0a9ad4..f72394e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,19 +1,17 @@ name: CI on: push: - branches-ignore: - - 'generated' - - 'codegen/**' - - 'integrated/**' - - 'preview-head/**' - - 'preview-base/**' - - 'preview/**' + branches: + - main + pull_request: + branches: + - main + - next jobs: lint: name: lint runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 From c2b3e9d3b77d6b7b0d5aadf6a5141fb4f00a47bc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 03:46:08 +0000 Subject: [PATCH 51/74] docs: update documentation links to be more uniform --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 24e37006..70cb9a9e 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ It is generated with [Stainless](https://www.stainless.com/). -The REST API documentation can be found on [openlayer.com](https://openlayer.com/docs/api-reference/rest/overview). Javadocs are also available on [javadoc.io](https://javadoc.io/doc/com.openlayer.api/openlayer-java/0.1.0-alpha.11). +The REST API documentation can be found on [openlayer.com](https://openlayer.com/docs/api-reference/rest/overview). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openlayer.api/openlayer-java/0.1.0-alpha.11). From 33c7cf90367555a55d05077d2846745cc6b0983d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 03:06:00 +0000 Subject: [PATCH 52/74] docs(client): update jackson compat error message --- .../src/main/kotlin/com/openlayer/api/core/Check.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt index efcc5521..98234498 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt @@ -62,7 +62,7 @@ internal fun checkJacksonVersionCompatibility() { } check(incompatibleJacksonVersions.isEmpty()) { """ -This SDK depends on Jackson version $MINIMUM_JACKSON_VERSION, but the following incompatible Jackson versions were detected at runtime: +This SDK requires a minimum Jackson version of $MINIMUM_JACKSON_VERSION, but the following incompatible Jackson versions were detected at runtime: ${incompatibleJacksonVersions.asSequence().map { (version, incompatibilityReason) -> "- `${version.toFullString().replace("/", ":")}` ($incompatibilityReason)" From 574dcea5c0841a33730b45f935393f5a21355c96 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 03:13:23 +0000 Subject: [PATCH 53/74] docs: explain jackson compat in readme --- README.md | 11 +++++++++++ .../src/main/kotlin/com/openlayer/api/core/Check.kt | 2 ++ 2 files changed, 13 insertions(+) diff --git a/README.md b/README.md index 70cb9a9e..05147a09 100644 --- a/README.md +++ b/README.md @@ -289,6 +289,17 @@ Or to `debug` for more verbose logging: $ export OPENLAYER_LOG=debug ``` +## Jackson + +The SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default. + +The SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config). + +If the SDK threw an exception, but you're _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`OpenlayerOkHttpClient`](openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt) or [`OpenlayerOkHttpClientAsync`](openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt). + +> [!CAUTION] +> We make no guarantee that the SDK works correctly when the Jackson version check is disabled. + ## Network options ### Retries diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt index 98234498..7d87824a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Check.kt @@ -73,6 +73,8 @@ This can happen if you are either: 2. Depending on some library that depends on different Jackson versions, potentially transitively Double-check that you are depending on compatible Jackson versions. + +See https://www.github.com/openlayer-ai/openlayer-java#jackson for more information. """ .trimIndent() } From e2aafa770f685aed27c842b1c7c6e61258d967b3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 03:17:52 +0000 Subject: [PATCH 54/74] perf(internal): improve compilation+test speed --- .github/workflows/publish-sonatype.yml | 2 +- .../main/kotlin/openlayer.kotlin.gradle.kts | 9 +-- gradle.properties | 16 +++++- .../api/core/http/RetryingHttpClient.kt | 56 ++++++++++++------- .../api/core/PhantomReachableTest.kt | 2 +- .../openlayer/api/core/http/HeadersTest.kt | 32 ----------- .../api/core/http/QueryParamsTest.kt | 32 ----------- .../api/core/http/RetryingHttpClientTest.kt | 36 ++++++++---- .../api/services/ErrorHandlingTest.kt | 2 + .../api/services/ServiceParamsTest.kt | 2 + 10 files changed, 85 insertions(+), 104 deletions(-) diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index de1b147f..1953ebeb 100644 --- a/.github/workflows/publish-sonatype.yml +++ b/.github/workflows/publish-sonatype.yml @@ -33,7 +33,7 @@ jobs: export -- GPG_SIGNING_KEY_ID printenv -- GPG_SIGNING_KEY | gpg --batch --passphrase-fd 3 --import 3<<< "$GPG_SIGNING_PASSWORD" GPG_SIGNING_KEY_ID="$(gpg --with-colons --list-keys | awk -F : -- '/^pub:/ { getline; print "0x" substr($10, length($10) - 7) }')" - ./gradlew publishAndReleaseToMavenCentral --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD" + ./gradlew publishAndReleaseToMavenCentral --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD" --no-configuration-cache env: SONATYPE_USERNAME: ${{ secrets.OPENLAYER_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.OPENLAYER_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }} diff --git a/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts b/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts index f8d2c677..0444f6dc 100644 --- a/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts @@ -9,7 +9,7 @@ plugins { kotlin { jvmToolchain { - languageVersion.set(JavaLanguageVersion.of(17)) + languageVersion.set(JavaLanguageVersion.of(21)) } compilerOptions { @@ -19,6 +19,8 @@ kotlin { // Suppress deprecation warnings because we may still reference and test deprecated members. // TODO: Replace with `-Xsuppress-warning=DEPRECATION` once we use Kotlin compiler 2.1.0+. "-nowarn", + // Use as many threads as there are CPU cores on the machine for compilation. + "-Xbackend-threads=0", ) jvmTarget.set(JvmTarget.JVM_1_8) languageVersion.set(KotlinVersion.KOTLIN_1_8) @@ -34,8 +36,7 @@ configure { } } -// Run tests in parallel to some degree. tasks.withType().configureEach { - maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1) - forkEvery = 100 + systemProperty("junit.jupiter.execution.parallel.enabled", true) + systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent") } diff --git a/gradle.properties b/gradle.properties index 0c8d4ded..ff76593f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,17 @@ org.gradle.caching=true +org.gradle.configuration-cache=true org.gradle.parallel=true org.gradle.daemon=false -org.gradle.jvmargs=-Xmx4g -kotlin.daemon.jvmargs=-Xmx4g +# These options improve our compilation and test performance. They are inherited by the Kotlin daemon. +org.gradle.jvmargs=\ + -Xms1g \ + -Xmx4g \ + -XX:+UseParallelGC \ + -XX:InitialCodeCacheSize=256m \ + -XX:ReservedCodeCacheSize=1G \ + -XX:MetaspaceSize=256m \ + -XX:TieredStopAtLevel=1 \ + -XX:GCTimeRatio=4 \ + -XX:CICompilerCount=4 \ + -XX:+OptimizeStringConcat \ + -XX:+UseStringDeduplication diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt index 63da1cea..9a87aef4 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt @@ -23,6 +23,7 @@ import kotlin.math.pow class RetryingHttpClient private constructor( private val httpClient: HttpClient, + private val sleeper: Sleeper, private val clock: Clock, private val maxRetries: Int, private val idempotencyHeader: String?, @@ -62,10 +63,10 @@ private constructor( null } - val backoffMillis = getRetryBackoffMillis(retries, response) + val backoffDuration = getRetryBackoffDuration(retries, response) // All responses must be closed, so close the failed one before retrying. response?.close() - Thread.sleep(backoffMillis.toMillis()) + sleeper.sleep(backoffDuration) } } @@ -111,10 +112,10 @@ private constructor( } } - val backoffMillis = getRetryBackoffMillis(retries, response) + val backoffDuration = getRetryBackoffDuration(retries, response) // All responses must be closed, so close the failed one before retrying. response?.close() - return sleepAsync(backoffMillis.toMillis()).thenCompose { + return sleeper.sleepAsync(backoffDuration).thenCompose { executeWithRetries(requestWithRetryCount, requestOptions) } } @@ -179,7 +180,7 @@ private constructor( // retried. throwable is IOException || throwable is OpenlayerIoException - private fun getRetryBackoffMillis(retries: Int, response: HttpResponse?): Duration { + private fun getRetryBackoffDuration(retries: Int, response: HttpResponse?): Duration { // About the Retry-After header: // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After response @@ -226,33 +227,40 @@ private constructor( companion object { - private val TIMER = Timer("RetryingHttpClient", true) - - private fun sleepAsync(millis: Long): CompletableFuture { - val future = CompletableFuture() - TIMER.schedule( - object : TimerTask() { - override fun run() { - future.complete(null) - } - }, - millis, - ) - return future - } - @JvmStatic fun builder() = Builder() } class Builder internal constructor() { private var httpClient: HttpClient? = null + private var sleeper: Sleeper = + object : Sleeper { + + private val timer = Timer("RetryingHttpClient", true) + + override fun sleep(duration: Duration) = Thread.sleep(duration.toMillis()) + + override fun sleepAsync(duration: Duration): CompletableFuture { + val future = CompletableFuture() + timer.schedule( + object : TimerTask() { + override fun run() { + future.complete(null) + } + }, + duration.toMillis(), + ) + return future + } + } private var clock: Clock = Clock.systemUTC() private var maxRetries: Int = 2 private var idempotencyHeader: String? = null fun httpClient(httpClient: HttpClient) = apply { this.httpClient = httpClient } + @JvmSynthetic internal fun sleeper(sleeper: Sleeper) = apply { this.sleeper = sleeper } + fun clock(clock: Clock) = apply { this.clock = clock } fun maxRetries(maxRetries: Int) = apply { this.maxRetries = maxRetries } @@ -262,9 +270,17 @@ private constructor( fun build(): HttpClient = RetryingHttpClient( checkRequired("httpClient", httpClient), + sleeper, clock, maxRetries, idempotencyHeader, ) } + + internal interface Sleeper { + + fun sleep(duration: Duration) + + fun sleepAsync(duration: Duration): CompletableFuture + } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/PhantomReachableTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/PhantomReachableTest.kt index e57f8a41..80cadc37 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/PhantomReachableTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/PhantomReachableTest.kt @@ -20,7 +20,7 @@ internal class PhantomReachableTest { assertThat(closed).isFalse() System.gc() - Thread.sleep(3000) + Thread.sleep(100) assertThat(closed).isTrue() } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HeadersTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HeadersTest.kt index c0127205..6b6600fb 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HeadersTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HeadersTest.kt @@ -1,8 +1,6 @@ package com.openlayer.api.core.http import org.assertj.core.api.Assertions.assertThat -import org.assertj.core.api.Assertions.catchThrowable -import org.assertj.core.api.Assumptions.assumeThat import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.EnumSource @@ -241,34 +239,4 @@ internal class HeadersTest { assertThat(size).isEqualTo(testCase.expectedSize) } - - @ParameterizedTest - @EnumSource - fun namesAreImmutable(testCase: TestCase) { - val headers = testCase.headers - val headerNamesCopy = headers.names().toSet() - - val throwable = catchThrowable { - (headers.names() as MutableSet).add("another name") - } - - assertThat(throwable).isInstanceOf(UnsupportedOperationException::class.java) - assertThat(headers.names()).isEqualTo(headerNamesCopy) - } - - @ParameterizedTest - @EnumSource - fun valuesAreImmutable(testCase: TestCase) { - val headers = testCase.headers - assumeThat(headers.size).isNotEqualTo(0) - val name = headers.names().first() - val headerValuesCopy = headers.values(name).toList() - - val throwable = catchThrowable { - (headers.values(name) as MutableList).add("another value") - } - - assertThat(throwable).isInstanceOf(UnsupportedOperationException::class.java) - assertThat(headers.values(name)).isEqualTo(headerValuesCopy) - } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/QueryParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/QueryParamsTest.kt index 51000b8c..792a264a 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/QueryParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/QueryParamsTest.kt @@ -1,8 +1,6 @@ package com.openlayer.api.core.http import org.assertj.core.api.Assertions.assertThat -import org.assertj.core.api.Assertions.catchThrowable -import org.assertj.core.api.Assumptions.assumeThat import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.EnumSource @@ -179,34 +177,4 @@ internal class QueryParamsTest { assertThat(size).isEqualTo(testCase.expectedSize) } - - @ParameterizedTest - @EnumSource - fun keysAreImmutable(testCase: TestCase) { - val queryParams = testCase.queryParams - val queryParamKeysCopy = queryParams.keys().toSet() - - val throwable = catchThrowable { - (queryParams.keys() as MutableSet).add("another key") - } - - assertThat(throwable).isInstanceOf(UnsupportedOperationException::class.java) - assertThat(queryParams.keys()).isEqualTo(queryParamKeysCopy) - } - - @ParameterizedTest - @EnumSource - fun valuesAreImmutable(testCase: TestCase) { - val queryParams = testCase.queryParams - assumeThat(queryParams.size).isNotEqualTo(0) - val key = queryParams.keys().first() - val queryParamValuesCopy = queryParams.values(key).toList() - - val throwable = catchThrowable { - (queryParams.values(key) as MutableList).add("another value") - } - - assertThat(throwable).isInstanceOf(UnsupportedOperationException::class.java) - assertThat(queryParams.values(key)).isEqualTo(queryParamValuesCopy) - } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt index 8e89c85e..f02b5b58 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt @@ -7,13 +7,16 @@ import com.github.tomakehurst.wiremock.stubbing.Scenario import com.openlayer.api.client.okhttp.OkHttpClient import com.openlayer.api.core.RequestOptions import java.io.InputStream +import java.time.Duration import java.util.concurrent.CompletableFuture import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.parallel.ResourceLock import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.ValueSource @WireMockTest +@ResourceLock("https://github.com/wiremock/wiremock/issues/169") internal class RetryingHttpClientTest { private var openResponseCount = 0 @@ -24,6 +27,7 @@ internal class RetryingHttpClientTest { val okHttpClient = OkHttpClient.builder().baseUrl(wmRuntimeInfo.httpBaseUrl).build() httpClient = object : HttpClient { + override fun execute( request: HttpRequest, requestOptions: RequestOptions, @@ -40,6 +44,7 @@ internal class RetryingHttpClientTest { private fun trackClose(response: HttpResponse): HttpResponse { openResponseCount++ return object : HttpResponse { + private var isClosed = false override fun statusCode(): Int = response.statusCode() @@ -66,7 +71,7 @@ internal class RetryingHttpClientTest { @ValueSource(booleans = [false, true]) fun execute(async: Boolean) { stubFor(post(urlPathEqualTo("/something")).willReturn(ok())) - val retryingClient = RetryingHttpClient.builder().httpClient(httpClient).build() + val retryingClient = retryingHttpClientBuilder().build() val response = retryingClient.execute( @@ -88,11 +93,7 @@ internal class RetryingHttpClientTest { .willReturn(ok()) ) val retryingClient = - RetryingHttpClient.builder() - .httpClient(httpClient) - .maxRetries(2) - .idempotencyHeader("X-Some-Header") - .build() + retryingHttpClientBuilder().maxRetries(2).idempotencyHeader("X-Some-Header").build() val response = retryingClient.execute( @@ -134,8 +135,7 @@ internal class RetryingHttpClientTest { .willReturn(ok()) .willSetStateTo("COMPLETED") ) - val retryingClient = - RetryingHttpClient.builder().httpClient(httpClient).maxRetries(2).build() + val retryingClient = retryingHttpClientBuilder().maxRetries(2).build() val response = retryingClient.execute( @@ -181,8 +181,7 @@ internal class RetryingHttpClientTest { .willReturn(ok()) .willSetStateTo("COMPLETED") ) - val retryingClient = - RetryingHttpClient.builder().httpClient(httpClient).maxRetries(2).build() + val retryingClient = retryingHttpClientBuilder().maxRetries(2).build() val response = retryingClient.execute( @@ -220,8 +219,7 @@ internal class RetryingHttpClientTest { .willReturn(ok()) .willSetStateTo("COMPLETED") ) - val retryingClient = - RetryingHttpClient.builder().httpClient(httpClient).maxRetries(1).build() + val retryingClient = retryingHttpClientBuilder().maxRetries(1).build() val response = retryingClient.execute( @@ -234,6 +232,20 @@ internal class RetryingHttpClientTest { assertNoResponseLeaks() } + private fun retryingHttpClientBuilder() = + RetryingHttpClient.builder() + .httpClient(httpClient) + // Use a no-op `Sleeper` to make the test fast. + .sleeper( + object : RetryingHttpClient.Sleeper { + + override fun sleep(duration: Duration) {} + + override fun sleepAsync(duration: Duration): CompletableFuture = + CompletableFuture.completedFuture(null) + } + ) + private fun HttpClient.execute(request: HttpRequest, async: Boolean): HttpResponse = if (async) executeAsync(request).get() else execute(request) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt index bcc988e0..ffc9ee34 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt @@ -28,8 +28,10 @@ import org.assertj.core.api.Assertions.entry import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows +import org.junit.jupiter.api.parallel.ResourceLock @WireMockTest +@ResourceLock("https://github.com/wiremock/wiremock/issues/169") internal class ErrorHandlingTest { companion object { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt index 28d1a606..8533b016 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt @@ -18,8 +18,10 @@ import com.openlayer.api.core.JsonValue import com.openlayer.api.models.inferencepipelines.data.DataStreamParams import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test +import org.junit.jupiter.api.parallel.ResourceLock @WireMockTest +@ResourceLock("https://github.com/wiremock/wiremock/issues/169") internal class ServiceParamsTest { private lateinit var client: OpenlayerClient From 5e6f54455db9a5a6ff8b9f5c7884813c17e57a0b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 03:56:25 +0000 Subject: [PATCH 55/74] docs: explain http client customization --- README.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/README.md b/README.md index 05147a09..ec50bf4d 100644 --- a/README.md +++ b/README.md @@ -377,6 +377,42 @@ OpenlayerClient client = OpenlayerOkHttpClient.builder() .build(); ``` +### Custom HTTP client + +The SDK consists of three artifacts: + +- `openlayer-java-core` + - Contains core SDK logic + - Does not depend on [OkHttp](https://square.github.io/okhttp) + - Exposes [`OpenlayerClient`](openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt), [`OpenlayerClientAsync`](openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt), [`OpenlayerClientImpl`](openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt), and [`OpenlayerClientAsyncImpl`](openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt), all of which can work with any HTTP client +- `openlayer-java-client-okhttp` + - Depends on [OkHttp](https://square.github.io/okhttp) + - Exposes [`OpenlayerOkHttpClient`](openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt) and [`OpenlayerOkHttpClientAsync`](openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt), which provide a way to construct [`OpenlayerClientImpl`](openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt) and [`OpenlayerClientAsyncImpl`](openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt), respectively, using OkHttp +- `openlayer-java` + - Depends on and exposes the APIs of both `openlayer-java-core` and `openlayer-java-client-okhttp` + - Does not have its own logic + +This structure allows replacing the SDK's default HTTP client without pulling in unnecessary dependencies. + +#### Customized [`OkHttpClient`](https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html) + +> [!TIP] +> Try the available [network options](#network-options) before replacing the default client. + +To use a customized `OkHttpClient`: + +1. Replace your [`openlayer-java` dependency](#installation) with `openlayer-java-core` +2. Copy `openlayer-java-client-okhttp`'s [`OkHttpClient`](openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt) class into your code and customize it +3. Construct [`OpenlayerClientImpl`](openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt) or [`OpenlayerClientAsyncImpl`](openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt), similarly to [`OpenlayerOkHttpClient`](openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt) or [`OpenlayerOkHttpClientAsync`](openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt), using your customized client + +### Completely custom HTTP client + +To use a completely custom HTTP client: + +1. Replace your [`openlayer-java` dependency](#installation) with `openlayer-java-core` +2. Write a class that implements the [`HttpClient`](openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpClient.kt) interface +3. Construct [`OpenlayerClientImpl`](openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt) or [`OpenlayerClientAsyncImpl`](openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt), similarly to [`OpenlayerOkHttpClient`](openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt) or [`OpenlayerOkHttpClientAsync`](openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt), using your new client class + ## Undocumented API functionality The SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API. From a18a3b06d20f8c2d8414d0b1ce116d8bd5dad387 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 18 Apr 2025 19:53:51 +0000 Subject: [PATCH 56/74] feat(api): api update --- .stats.yml | 2 +- .../testresults/TestResultListResponse.kt | 592 +++++++++++++++++- .../testresults/TestResultListResponse.kt | 592 +++++++++++++++++- .../testresults/TestResultListResponseTest.kt | 53 +- .../testresults/TestResultListResponseTest.kt | 53 +- 5 files changed, 1221 insertions(+), 71 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5fc516db..959df2a3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 15 -openapi_spec_hash: 9a0b363025305f6b086bcdfe43274830 +openapi_spec_hash: c01d40349b63e0d636eb3ae352a41341 config_hash: 21fb9730d1cdc9e3fd38724c4774b894 diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt index fb24b414..aa76f97a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt @@ -1994,9 +1994,10 @@ private constructor( class Threshold private constructor( private val insightName: JsonField, - private val insightParameters: JsonField>, + private val insightParameters: JsonField>, private val measurement: JsonField, - private val operator: JsonField, + private val operator: JsonField, + private val thresholdMode: JsonField, private val value: JsonField, private val additionalProperties: MutableMap, ) { @@ -2008,13 +2009,16 @@ private constructor( insightName: JsonField = JsonMissing.of(), @JsonProperty("insightParameters") @ExcludeMissing - insightParameters: JsonField> = JsonMissing.of(), + insightParameters: JsonField> = JsonMissing.of(), @JsonProperty("measurement") @ExcludeMissing measurement: JsonField = JsonMissing.of(), @JsonProperty("operator") @ExcludeMissing - operator: JsonField = JsonMissing.of(), + operator: JsonField = JsonMissing.of(), + @JsonProperty("thresholdMode") + @ExcludeMissing + thresholdMode: JsonField = JsonMissing.of(), @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), @@ -2023,6 +2027,7 @@ private constructor( insightParameters, measurement, operator, + thresholdMode, value, mutableMapOf(), ) @@ -2036,10 +2041,12 @@ private constructor( fun insightName(): Optional = insightName.getOptional("insightName") /** + * The insight parameters. Required only for some test subtypes. + * * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun insightParameters(): Optional> = + fun insightParameters(): Optional> = insightParameters.getOptional("insightParameters") /** @@ -2056,7 +2063,16 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun operator(): Optional = operator.getOptional("operator") + fun operator(): Optional = operator.getOptional("operator") + + /** + * Whether to use automatic anomaly detection or manual thresholds + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun thresholdMode(): Optional = + thresholdMode.getOptional("thresholdMode") /** * The value to be compared. @@ -2084,7 +2100,7 @@ private constructor( */ @JsonProperty("insightParameters") @ExcludeMissing - fun _insightParameters(): JsonField> = insightParameters + fun _insightParameters(): JsonField> = insightParameters /** * Returns the raw JSON value of [measurement]. @@ -2104,7 +2120,17 @@ private constructor( */ @JsonProperty("operator") @ExcludeMissing - fun _operator(): JsonField = operator + fun _operator(): JsonField = operator + + /** + * Returns the raw JSON value of [thresholdMode]. + * + * Unlike [thresholdMode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("thresholdMode") + @ExcludeMissing + fun _thresholdMode(): JsonField = thresholdMode /** * Returns the raw JSON value of [value]. @@ -2136,9 +2162,10 @@ private constructor( class Builder internal constructor() { private var insightName: JsonField = JsonMissing.of() - private var insightParameters: JsonField>? = null + private var insightParameters: JsonField>? = null private var measurement: JsonField = JsonMissing.of() - private var operator: JsonField = JsonMissing.of() + private var operator: JsonField = JsonMissing.of() + private var thresholdMode: JsonField = JsonMissing.of() private var value: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -2148,6 +2175,7 @@ private constructor( insightParameters = threshold.insightParameters.map { it.toMutableList() } measurement = threshold.measurement operator = threshold.operator + thresholdMode = threshold.thresholdMode value = threshold.value additionalProperties = threshold.additionalProperties.toMutableMap() } @@ -2166,26 +2194,35 @@ private constructor( this.insightName = insightName } - fun insightParameters(insightParameters: List) = - insightParameters(JsonField.of(insightParameters)) + /** The insight parameters. Required only for some test subtypes. */ + fun insightParameters(insightParameters: List?) = + insightParameters(JsonField.ofNullable(insightParameters)) + + /** + * Alias for calling [Builder.insightParameters] with + * `insightParameters.orElse(null)`. + */ + fun insightParameters(insightParameters: Optional>) = + insightParameters(insightParameters.getOrNull()) /** * Sets [Builder.insightParameters] to an arbitrary JSON value. * * You should usually call [Builder.insightParameters] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * `List` value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - fun insightParameters(insightParameters: JsonField>) = apply { - this.insightParameters = insightParameters.map { it.toMutableList() } - } + fun insightParameters(insightParameters: JsonField>) = + apply { + this.insightParameters = insightParameters.map { it.toMutableList() } + } /** - * Adds a single [JsonValue] to [insightParameters]. + * Adds a single [InsightParameter] to [insightParameters]. * * @throws IllegalStateException if the field was previously set to a non-list. */ - fun addInsightParameter(insightParameter: JsonValue) = apply { + fun addInsightParameter(insightParameter: InsightParameter) = apply { insightParameters = (insightParameters ?: JsonField.of(mutableListOf())).also { checkKnown("insightParameters", it).add(insightParameter) @@ -2207,16 +2244,31 @@ private constructor( } /** The operator to be used for the evaluation. */ - fun operator(operator: String) = operator(JsonField.of(operator)) + fun operator(operator: Operator) = operator(JsonField.of(operator)) /** * Sets [Builder.operator] to an arbitrary JSON value. * - * You should usually call [Builder.operator] with a well-typed [String] value + * You should usually call [Builder.operator] with a well-typed [Operator] value * instead. This method is primarily for setting the field to an undocumented or * not yet supported value. */ - fun operator(operator: JsonField) = apply { this.operator = operator } + fun operator(operator: JsonField) = apply { this.operator = operator } + + /** Whether to use automatic anomaly detection or manual thresholds */ + fun thresholdMode(thresholdMode: ThresholdMode) = + thresholdMode(JsonField.of(thresholdMode)) + + /** + * Sets [Builder.thresholdMode] to an arbitrary JSON value. + * + * You should usually call [Builder.thresholdMode] with a well-typed + * [ThresholdMode] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun thresholdMode(thresholdMode: JsonField) = apply { + this.thresholdMode = thresholdMode + } /** The value to be compared. */ fun value(value: Value) = value(JsonField.of(value)) @@ -2275,6 +2327,7 @@ private constructor( (insightParameters ?: JsonMissing.of()).map { it.toImmutable() }, measurement, operator, + thresholdMode, value, additionalProperties.toMutableMap(), ) @@ -2288,9 +2341,10 @@ private constructor( } insightName() - insightParameters() + insightParameters().ifPresent { it.forEach { it.validate() } } measurement() - operator() + operator().ifPresent { it.validate() } + thresholdMode().ifPresent { it.validate() } value().ifPresent { it.validate() } validated = true } @@ -2312,11 +2366,491 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (insightName.asKnown().isPresent) 1 else 0) + - (insightParameters.asKnown().getOrNull()?.size ?: 0) + + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } + ?: 0) + (if (measurement.asKnown().isPresent) 1 else 0) + - (if (operator.asKnown().isPresent) 1 else 0) + + (operator.asKnown().getOrNull()?.validity() ?: 0) + + (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) + class InsightParameter + private constructor( + private val name: JsonField, + private val value: JsonValue, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonValue = JsonMissing.of(), + ) : this(name, value, mutableMapOf()) + + /** + * The name of the insight filter. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ + fun name(): String = name.getRequired("name") + + @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [InsightParameter]. + * + * The following fields are required: + * ```java + * .name() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InsightParameter]. */ + class Builder internal constructor() { + + private var name: JsonField? = null + private var value: JsonValue? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(insightParameter: InsightParameter) = apply { + name = insightParameter.name + value = insightParameter.value + additionalProperties = + insightParameter.additionalProperties.toMutableMap() + } + + /** The name of the insight filter. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun value(value: JsonValue) = apply { this.value = value } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [InsightParameter]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .name() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): InsightParameter = + InsightParameter( + checkRequired("name", name), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): InsightParameter = apply { + if (validated) { + return@apply + } + + name() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (if (name.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InsightParameter && name == other.name && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(name, value, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InsightParameter{name=$name, value=$value, additionalProperties=$additionalProperties}" + } + + /** The operator to be used for the evaluation. */ + class Operator + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val IS = of("is") + + @JvmField val GREATER = of(">") + + @JvmField val GREATER_OR_EQUALS = of(">=") + + @JvmField val LESS = of("<") + + @JvmField val LESS_OR_EQUALS = of("<=") + + @JvmField val NOT_EQUALS = of("!=") + + @JvmStatic fun of(value: String) = Operator(JsonField.of(value)) + } + + /** An enum containing [Operator]'s known values. */ + enum class Known { + IS, + GREATER, + GREATER_OR_EQUALS, + LESS, + LESS_OR_EQUALS, + NOT_EQUALS, + } + + /** + * An enum containing [Operator]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Operator] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + IS, + GREATER, + GREATER_OR_EQUALS, + LESS, + LESS_OR_EQUALS, + NOT_EQUALS, + /** + * An enum member indicating that [Operator] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + IS -> Value.IS + GREATER -> Value.GREATER + GREATER_OR_EQUALS -> Value.GREATER_OR_EQUALS + LESS -> Value.LESS + LESS_OR_EQUALS -> Value.LESS_OR_EQUALS + NOT_EQUALS -> Value.NOT_EQUALS + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + IS -> Known.IS + GREATER -> Known.GREATER + GREATER_OR_EQUALS -> Known.GREATER_OR_EQUALS + LESS -> Known.LESS + LESS_OR_EQUALS -> Known.LESS_OR_EQUALS + NOT_EQUALS -> Known.NOT_EQUALS + else -> throw OpenlayerInvalidDataException("Unknown Operator: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Operator = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Operator && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Whether to use automatic anomaly detection or manual thresholds */ + class ThresholdMode + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val AUTOMATIC = of("automatic") + + @JvmField val MANUAL = of("manual") + + @JvmStatic fun of(value: String) = ThresholdMode(JsonField.of(value)) + } + + /** An enum containing [ThresholdMode]'s known values. */ + enum class Known { + AUTOMATIC, + MANUAL, + } + + /** + * An enum containing [ThresholdMode]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [ThresholdMode] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + AUTOMATIC, + MANUAL, + /** + * An enum member indicating that [ThresholdMode] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + AUTOMATIC -> Value.AUTOMATIC + MANUAL -> Value.MANUAL + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + AUTOMATIC -> Known.AUTOMATIC + MANUAL -> Known.MANUAL + else -> + throw OpenlayerInvalidDataException("Unknown ThresholdMode: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): ThresholdMode = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ThresholdMode && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + /** The value to be compared. */ @JsonDeserialize(using = Value.Deserializer::class) @JsonSerialize(using = Value.Serializer::class) @@ -2537,17 +3071,17 @@ private constructor( return true } - return /* spotless:off */ other is Threshold && insightName == other.insightName && insightParameters == other.insightParameters && measurement == other.measurement && operator == other.operator && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Threshold && insightName == other.insightName && insightParameters == other.insightParameters && measurement == other.measurement && operator == other.operator && thresholdMode == other.thresholdMode && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(insightName, insightParameters, measurement, operator, value, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(insightName, insightParameters, measurement, operator, thresholdMode, value, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Threshold{insightName=$insightName, insightParameters=$insightParameters, measurement=$measurement, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + "Threshold{insightName=$insightName, insightParameters=$insightParameters, measurement=$measurement, operator=$operator, thresholdMode=$thresholdMode, value=$value, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt index f43e5f63..6ffce66e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt @@ -1994,9 +1994,10 @@ private constructor( class Threshold private constructor( private val insightName: JsonField, - private val insightParameters: JsonField>, + private val insightParameters: JsonField>, private val measurement: JsonField, - private val operator: JsonField, + private val operator: JsonField, + private val thresholdMode: JsonField, private val value: JsonField, private val additionalProperties: MutableMap, ) { @@ -2008,13 +2009,16 @@ private constructor( insightName: JsonField = JsonMissing.of(), @JsonProperty("insightParameters") @ExcludeMissing - insightParameters: JsonField> = JsonMissing.of(), + insightParameters: JsonField> = JsonMissing.of(), @JsonProperty("measurement") @ExcludeMissing measurement: JsonField = JsonMissing.of(), @JsonProperty("operator") @ExcludeMissing - operator: JsonField = JsonMissing.of(), + operator: JsonField = JsonMissing.of(), + @JsonProperty("thresholdMode") + @ExcludeMissing + thresholdMode: JsonField = JsonMissing.of(), @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), @@ -2023,6 +2027,7 @@ private constructor( insightParameters, measurement, operator, + thresholdMode, value, mutableMapOf(), ) @@ -2036,10 +2041,12 @@ private constructor( fun insightName(): Optional = insightName.getOptional("insightName") /** + * The insight parameters. Required only for some test subtypes. + * * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun insightParameters(): Optional> = + fun insightParameters(): Optional> = insightParameters.getOptional("insightParameters") /** @@ -2056,7 +2063,16 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun operator(): Optional = operator.getOptional("operator") + fun operator(): Optional = operator.getOptional("operator") + + /** + * Whether to use automatic anomaly detection or manual thresholds + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun thresholdMode(): Optional = + thresholdMode.getOptional("thresholdMode") /** * The value to be compared. @@ -2084,7 +2100,7 @@ private constructor( */ @JsonProperty("insightParameters") @ExcludeMissing - fun _insightParameters(): JsonField> = insightParameters + fun _insightParameters(): JsonField> = insightParameters /** * Returns the raw JSON value of [measurement]. @@ -2104,7 +2120,17 @@ private constructor( */ @JsonProperty("operator") @ExcludeMissing - fun _operator(): JsonField = operator + fun _operator(): JsonField = operator + + /** + * Returns the raw JSON value of [thresholdMode]. + * + * Unlike [thresholdMode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("thresholdMode") + @ExcludeMissing + fun _thresholdMode(): JsonField = thresholdMode /** * Returns the raw JSON value of [value]. @@ -2136,9 +2162,10 @@ private constructor( class Builder internal constructor() { private var insightName: JsonField = JsonMissing.of() - private var insightParameters: JsonField>? = null + private var insightParameters: JsonField>? = null private var measurement: JsonField = JsonMissing.of() - private var operator: JsonField = JsonMissing.of() + private var operator: JsonField = JsonMissing.of() + private var thresholdMode: JsonField = JsonMissing.of() private var value: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -2148,6 +2175,7 @@ private constructor( insightParameters = threshold.insightParameters.map { it.toMutableList() } measurement = threshold.measurement operator = threshold.operator + thresholdMode = threshold.thresholdMode value = threshold.value additionalProperties = threshold.additionalProperties.toMutableMap() } @@ -2166,26 +2194,35 @@ private constructor( this.insightName = insightName } - fun insightParameters(insightParameters: List) = - insightParameters(JsonField.of(insightParameters)) + /** The insight parameters. Required only for some test subtypes. */ + fun insightParameters(insightParameters: List?) = + insightParameters(JsonField.ofNullable(insightParameters)) + + /** + * Alias for calling [Builder.insightParameters] with + * `insightParameters.orElse(null)`. + */ + fun insightParameters(insightParameters: Optional>) = + insightParameters(insightParameters.getOrNull()) /** * Sets [Builder.insightParameters] to an arbitrary JSON value. * * You should usually call [Builder.insightParameters] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * `List` value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - fun insightParameters(insightParameters: JsonField>) = apply { - this.insightParameters = insightParameters.map { it.toMutableList() } - } + fun insightParameters(insightParameters: JsonField>) = + apply { + this.insightParameters = insightParameters.map { it.toMutableList() } + } /** - * Adds a single [JsonValue] to [insightParameters]. + * Adds a single [InsightParameter] to [insightParameters]. * * @throws IllegalStateException if the field was previously set to a non-list. */ - fun addInsightParameter(insightParameter: JsonValue) = apply { + fun addInsightParameter(insightParameter: InsightParameter) = apply { insightParameters = (insightParameters ?: JsonField.of(mutableListOf())).also { checkKnown("insightParameters", it).add(insightParameter) @@ -2207,16 +2244,31 @@ private constructor( } /** The operator to be used for the evaluation. */ - fun operator(operator: String) = operator(JsonField.of(operator)) + fun operator(operator: Operator) = operator(JsonField.of(operator)) /** * Sets [Builder.operator] to an arbitrary JSON value. * - * You should usually call [Builder.operator] with a well-typed [String] value + * You should usually call [Builder.operator] with a well-typed [Operator] value * instead. This method is primarily for setting the field to an undocumented or * not yet supported value. */ - fun operator(operator: JsonField) = apply { this.operator = operator } + fun operator(operator: JsonField) = apply { this.operator = operator } + + /** Whether to use automatic anomaly detection or manual thresholds */ + fun thresholdMode(thresholdMode: ThresholdMode) = + thresholdMode(JsonField.of(thresholdMode)) + + /** + * Sets [Builder.thresholdMode] to an arbitrary JSON value. + * + * You should usually call [Builder.thresholdMode] with a well-typed + * [ThresholdMode] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun thresholdMode(thresholdMode: JsonField) = apply { + this.thresholdMode = thresholdMode + } /** The value to be compared. */ fun value(value: Value) = value(JsonField.of(value)) @@ -2275,6 +2327,7 @@ private constructor( (insightParameters ?: JsonMissing.of()).map { it.toImmutable() }, measurement, operator, + thresholdMode, value, additionalProperties.toMutableMap(), ) @@ -2288,9 +2341,10 @@ private constructor( } insightName() - insightParameters() + insightParameters().ifPresent { it.forEach { it.validate() } } measurement() - operator() + operator().ifPresent { it.validate() } + thresholdMode().ifPresent { it.validate() } value().ifPresent { it.validate() } validated = true } @@ -2312,11 +2366,491 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (insightName.asKnown().isPresent) 1 else 0) + - (insightParameters.asKnown().getOrNull()?.size ?: 0) + + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } + ?: 0) + (if (measurement.asKnown().isPresent) 1 else 0) + - (if (operator.asKnown().isPresent) 1 else 0) + + (operator.asKnown().getOrNull()?.validity() ?: 0) + + (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) + class InsightParameter + private constructor( + private val name: JsonField, + private val value: JsonValue, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonValue = JsonMissing.of(), + ) : this(name, value, mutableMapOf()) + + /** + * The name of the insight filter. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ + fun name(): String = name.getRequired("name") + + @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [InsightParameter]. + * + * The following fields are required: + * ```java + * .name() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InsightParameter]. */ + class Builder internal constructor() { + + private var name: JsonField? = null + private var value: JsonValue? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(insightParameter: InsightParameter) = apply { + name = insightParameter.name + value = insightParameter.value + additionalProperties = + insightParameter.additionalProperties.toMutableMap() + } + + /** The name of the insight filter. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun value(value: JsonValue) = apply { this.value = value } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [InsightParameter]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .name() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): InsightParameter = + InsightParameter( + checkRequired("name", name), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): InsightParameter = apply { + if (validated) { + return@apply + } + + name() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (if (name.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InsightParameter && name == other.name && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(name, value, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InsightParameter{name=$name, value=$value, additionalProperties=$additionalProperties}" + } + + /** The operator to be used for the evaluation. */ + class Operator + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val IS = of("is") + + @JvmField val GREATER = of(">") + + @JvmField val GREATER_OR_EQUALS = of(">=") + + @JvmField val LESS = of("<") + + @JvmField val LESS_OR_EQUALS = of("<=") + + @JvmField val NOT_EQUALS = of("!=") + + @JvmStatic fun of(value: String) = Operator(JsonField.of(value)) + } + + /** An enum containing [Operator]'s known values. */ + enum class Known { + IS, + GREATER, + GREATER_OR_EQUALS, + LESS, + LESS_OR_EQUALS, + NOT_EQUALS, + } + + /** + * An enum containing [Operator]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Operator] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + IS, + GREATER, + GREATER_OR_EQUALS, + LESS, + LESS_OR_EQUALS, + NOT_EQUALS, + /** + * An enum member indicating that [Operator] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + IS -> Value.IS + GREATER -> Value.GREATER + GREATER_OR_EQUALS -> Value.GREATER_OR_EQUALS + LESS -> Value.LESS + LESS_OR_EQUALS -> Value.LESS_OR_EQUALS + NOT_EQUALS -> Value.NOT_EQUALS + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + IS -> Known.IS + GREATER -> Known.GREATER + GREATER_OR_EQUALS -> Known.GREATER_OR_EQUALS + LESS -> Known.LESS + LESS_OR_EQUALS -> Known.LESS_OR_EQUALS + NOT_EQUALS -> Known.NOT_EQUALS + else -> throw OpenlayerInvalidDataException("Unknown Operator: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Operator = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Operator && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Whether to use automatic anomaly detection or manual thresholds */ + class ThresholdMode + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val AUTOMATIC = of("automatic") + + @JvmField val MANUAL = of("manual") + + @JvmStatic fun of(value: String) = ThresholdMode(JsonField.of(value)) + } + + /** An enum containing [ThresholdMode]'s known values. */ + enum class Known { + AUTOMATIC, + MANUAL, + } + + /** + * An enum containing [ThresholdMode]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [ThresholdMode] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + AUTOMATIC, + MANUAL, + /** + * An enum member indicating that [ThresholdMode] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + AUTOMATIC -> Value.AUTOMATIC + MANUAL -> Value.MANUAL + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + AUTOMATIC -> Known.AUTOMATIC + MANUAL -> Known.MANUAL + else -> + throw OpenlayerInvalidDataException("Unknown ThresholdMode: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): ThresholdMode = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ThresholdMode && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + /** The value to be compared. */ @JsonDeserialize(using = Value.Deserializer::class) @JsonSerialize(using = Value.Serializer::class) @@ -2537,17 +3071,17 @@ private constructor( return true } - return /* spotless:off */ other is Threshold && insightName == other.insightName && insightParameters == other.insightParameters && measurement == other.measurement && operator == other.operator && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Threshold && insightName == other.insightName && insightParameters == other.insightParameters && measurement == other.measurement && operator == other.operator && thresholdMode == other.thresholdMode && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(insightName, insightParameters, measurement, operator, value, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(insightName, insightParameters, measurement, operator, thresholdMode, value, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Threshold{insightName=$insightName, insightParameters=$insightParameters, measurement=$measurement, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + "Threshold{insightName=$insightName, insightParameters=$insightParameters, measurement=$measurement, operator=$operator, thresholdMode=$thresholdMode, value=$value, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt index 93ea3add..5003ff60 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt @@ -47,9 +47,23 @@ internal class TestResultListResponseTest { .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() .insightName("duplicateRowCount") - .addInsightParameter(JsonValue.from(mapOf())) + .addInsightParameter( + TestResultListResponse.Item.Goal.Threshold + .InsightParameter + .builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) .measurement("duplicateRowCount") - .operator("<=") + .operator( + TestResultListResponse.Item.Goal.Threshold.Operator + .LESS_OR_EQUALS + ) + .thresholdMode( + TestResultListResponse.Item.Goal.Threshold.ThresholdMode + .AUTOMATIC + ) .value(0.0) .build() ) @@ -102,9 +116,22 @@ internal class TestResultListResponseTest { .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() .insightName("duplicateRowCount") - .addInsightParameter(JsonValue.from(mapOf())) + .addInsightParameter( + TestResultListResponse.Item.Goal.Threshold.InsightParameter + .builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) .measurement("duplicateRowCount") - .operator("<=") + .operator( + TestResultListResponse.Item.Goal.Threshold.Operator + .LESS_OR_EQUALS + ) + .thresholdMode( + TestResultListResponse.Item.Goal.Threshold.ThresholdMode + .AUTOMATIC + ) .value(0.0) .build() ) @@ -161,9 +188,23 @@ internal class TestResultListResponseTest { .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() .insightName("duplicateRowCount") - .addInsightParameter(JsonValue.from(mapOf())) + .addInsightParameter( + TestResultListResponse.Item.Goal.Threshold + .InsightParameter + .builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) .measurement("duplicateRowCount") - .operator("<=") + .operator( + TestResultListResponse.Item.Goal.Threshold.Operator + .LESS_OR_EQUALS + ) + .thresholdMode( + TestResultListResponse.Item.Goal.Threshold.ThresholdMode + .AUTOMATIC + ) .value(0.0) .build() ) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt index f0c7244a..a58d76f7 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt @@ -47,9 +47,23 @@ internal class TestResultListResponseTest { .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() .insightName("duplicateRowCount") - .addInsightParameter(JsonValue.from(mapOf())) + .addInsightParameter( + TestResultListResponse.Item.Goal.Threshold + .InsightParameter + .builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) .measurement("duplicateRowCount") - .operator("<=") + .operator( + TestResultListResponse.Item.Goal.Threshold.Operator + .LESS_OR_EQUALS + ) + .thresholdMode( + TestResultListResponse.Item.Goal.Threshold.ThresholdMode + .AUTOMATIC + ) .value(0.0) .build() ) @@ -102,9 +116,22 @@ internal class TestResultListResponseTest { .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() .insightName("duplicateRowCount") - .addInsightParameter(JsonValue.from(mapOf())) + .addInsightParameter( + TestResultListResponse.Item.Goal.Threshold.InsightParameter + .builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) .measurement("duplicateRowCount") - .operator("<=") + .operator( + TestResultListResponse.Item.Goal.Threshold.Operator + .LESS_OR_EQUALS + ) + .thresholdMode( + TestResultListResponse.Item.Goal.Threshold.ThresholdMode + .AUTOMATIC + ) .value(0.0) .build() ) @@ -161,9 +188,23 @@ internal class TestResultListResponseTest { .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() .insightName("duplicateRowCount") - .addInsightParameter(JsonValue.from(mapOf())) + .addInsightParameter( + TestResultListResponse.Item.Goal.Threshold + .InsightParameter + .builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) .measurement("duplicateRowCount") - .operator("<=") + .operator( + TestResultListResponse.Item.Goal.Threshold.Operator + .LESS_OR_EQUALS + ) + .thresholdMode( + TestResultListResponse.Item.Goal.Threshold.ThresholdMode + .AUTOMATIC + ) .value(0.0) .build() ) From 88139660288ccb89b2228c5dce35c66d521208f7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 18 Apr 2025 20:10:40 +0000 Subject: [PATCH 57/74] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 959df2a3..11f2aabc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 15 -openapi_spec_hash: c01d40349b63e0d636eb3ae352a41341 +openapi_spec_hash: 7dd38774b534c352620bca63efa85b19 config_hash: 21fb9730d1cdc9e3fd38724c4774b894 From 02826344cb144623d177771d5cc066490cbe9bb5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 21 Apr 2025 13:14:09 +0000 Subject: [PATCH 58/74] feat(api): add test creation endpoint --- .stats.yml | 4 +- .../models/projects/tests/TestCreateParams.kt | 3047 +++++++++++++++++ .../projects/tests/TestCreateResponse.kt | 2118 ++++++++++++ .../api/services/async/ProjectServiceAsync.kt | 5 + .../services/async/ProjectServiceAsyncImpl.kt | 12 + .../async/projects/TestServiceAsync.kt | 49 + .../async/projects/TestServiceAsyncImpl.kt | 73 + .../api/services/blocking/ProjectService.kt | 5 + .../services/blocking/ProjectServiceImpl.kt | 12 + .../services/blocking/projects/TestService.kt | 45 + .../blocking/projects/TestServiceImpl.kt | 68 + .../projects/tests/TestCreateParamsTest.kt | 205 ++ .../projects/tests/TestCreateResponseTest.kt | 151 + .../async/projects/TestServiceAsyncTest.kt | 73 + .../blocking/projects/TestServiceTest.kt | 72 + 15 files changed, 5937 insertions(+), 2 deletions(-) create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsync.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestService.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestServiceImpl.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt diff --git a/.stats.yml b/.stats.yml index 11f2aabc..81ceaeb5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ -configured_endpoints: 15 +configured_endpoints: 16 openapi_spec_hash: 7dd38774b534c352620bca63efa85b19 -config_hash: 21fb9730d1cdc9e3fd38724c4774b894 +config_hash: 0383360784fc87d799bad2be203142b5 diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt new file mode 100644 index 00000000..70519a40 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt @@ -0,0 +1,3047 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.projects.tests + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.Params +import com.openlayer.api.core.allMaxBy +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.getOrThrow +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Create a test. */ +class TestCreateParams +private constructor( + private val projectId: String, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun projectId(): String = projectId + + /** + * The test id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = body.id() + + /** + * The number of comments on the test. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun commentCount(): Long = body.commentCount() + + /** + * The test creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun creatorId(): Optional = body.creatorId() + + /** + * The date the test was archived. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun dateArchived(): Optional = body.dateArchived() + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = body.dateCreated() + + /** + * The last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = body.dateUpdated() + + /** The test description. */ + fun _description(): JsonValue = body._description() + + /** + * The test name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = body.name() + + /** + * The test number. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun number(): Long = body.number() + + /** + * The project version (commit) id where the test was created. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun originProjectVersionId(): Optional = body.originProjectVersionId() + + /** + * The test subtype. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun subtype(): String = body.subtype() + + /** + * Whether the test is suggested or user-created. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun suggested(): Boolean = body.suggested() + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun thresholds(): List = body.thresholds() + + /** + * The test type. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): String = body.type() + + /** + * Whether the test is archived. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun archived(): Optional = body.archived() + + /** + * The delay window in seconds. Only applies to tests that use production data. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun delayWindow(): Optional = body.delayWindow() + + /** + * The evaluation window in seconds. Only applies to tests that use production data. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun evaluationWindow(): Optional = body.evaluationWindow() + + /** + * Whether the test uses an ML model. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun usesMlModel(): Optional = body.usesMlModel() + + /** + * Whether the test uses production data (monitoring mode only). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun usesProductionData(): Optional = body.usesProductionData() + + /** + * Whether the test uses a reference dataset (monitoring mode only). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun usesReferenceDataset(): Optional = body.usesReferenceDataset() + + /** + * Whether the test uses a training dataset. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun usesTrainingDataset(): Optional = body.usesTrainingDataset() + + /** + * Whether the test uses a validation dataset. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun usesValidationDataset(): Optional = body.usesValidationDataset() + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _id(): JsonField = body._id() + + /** + * Returns the raw JSON value of [commentCount]. + * + * Unlike [commentCount], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _commentCount(): JsonField = body._commentCount() + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _creatorId(): JsonField = body._creatorId() + + /** + * Returns the raw JSON value of [dateArchived]. + * + * Unlike [dateArchived], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _dateArchived(): JsonField = body._dateArchived() + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _dateCreated(): JsonField = body._dateCreated() + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _dateUpdated(): JsonField = body._dateUpdated() + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _name(): JsonField = body._name() + + /** + * Returns the raw JSON value of [number]. + * + * Unlike [number], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _number(): JsonField = body._number() + + /** + * Returns the raw JSON value of [originProjectVersionId]. + * + * Unlike [originProjectVersionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + fun _originProjectVersionId(): JsonField = body._originProjectVersionId() + + /** + * Returns the raw JSON value of [subtype]. + * + * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _subtype(): JsonField = body._subtype() + + /** + * Returns the raw JSON value of [suggested]. + * + * Unlike [suggested], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _suggested(): JsonField = body._suggested() + + /** + * Returns the raw JSON value of [thresholds]. + * + * Unlike [thresholds], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _thresholds(): JsonField> = body._thresholds() + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _type(): JsonField = body._type() + + /** + * Returns the raw JSON value of [archived]. + * + * Unlike [archived], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _archived(): JsonField = body._archived() + + /** + * Returns the raw JSON value of [delayWindow]. + * + * Unlike [delayWindow], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _delayWindow(): JsonField = body._delayWindow() + + /** + * Returns the raw JSON value of [evaluationWindow]. + * + * Unlike [evaluationWindow], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _evaluationWindow(): JsonField = body._evaluationWindow() + + /** + * Returns the raw JSON value of [usesMlModel]. + * + * Unlike [usesMlModel], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _usesMlModel(): JsonField = body._usesMlModel() + + /** + * Returns the raw JSON value of [usesProductionData]. + * + * Unlike [usesProductionData], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _usesProductionData(): JsonField = body._usesProductionData() + + /** + * Returns the raw JSON value of [usesReferenceDataset]. + * + * Unlike [usesReferenceDataset], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _usesReferenceDataset(): JsonField = body._usesReferenceDataset() + + /** + * Returns the raw JSON value of [usesTrainingDataset]. + * + * Unlike [usesTrainingDataset], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _usesTrainingDataset(): JsonField = body._usesTrainingDataset() + + /** + * Returns the raw JSON value of [usesValidationDataset]. + * + * Unlike [usesValidationDataset], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _usesValidationDataset(): JsonField = body._usesValidationDataset() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + fun _additionalHeaders(): Headers = additionalHeaders + + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [TestCreateParams]. + * + * The following fields are required: + * ```java + * .projectId() + * .id() + * .commentCount() + * .creatorId() + * .dateArchived() + * .dateCreated() + * .dateUpdated() + * .description() + * .name() + * .number() + * .originProjectVersionId() + * .subtype() + * .suggested() + * .thresholds() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TestCreateParams]. */ + class Builder internal constructor() { + + private var projectId: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(testCreateParams: TestCreateParams) = apply { + projectId = testCreateParams.projectId + body = testCreateParams.body.toBuilder() + additionalHeaders = testCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = testCreateParams.additionalQueryParams.toBuilder() + } + + fun projectId(projectId: String) = apply { this.projectId = projectId } + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [id] + * - [commentCount] + * - [creatorId] + * - [dateArchived] + * - [dateCreated] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + /** The test id. */ + fun id(id: String) = apply { body.id(id) } + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { body.id(id) } + + /** The number of comments on the test. */ + fun commentCount(commentCount: Long) = apply { body.commentCount(commentCount) } + + /** + * Sets [Builder.commentCount] to an arbitrary JSON value. + * + * You should usually call [Builder.commentCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun commentCount(commentCount: JsonField) = apply { body.commentCount(commentCount) } + + /** The test creator id. */ + fun creatorId(creatorId: String?) = apply { body.creatorId(creatorId) } + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun creatorId(creatorId: JsonField) = apply { body.creatorId(creatorId) } + + /** The date the test was archived. */ + fun dateArchived(dateArchived: OffsetDateTime?) = apply { body.dateArchived(dateArchived) } + + /** Alias for calling [Builder.dateArchived] with `dateArchived.orElse(null)`. */ + fun dateArchived(dateArchived: Optional) = + dateArchived(dateArchived.getOrNull()) + + /** + * Sets [Builder.dateArchived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateArchived] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateArchived(dateArchived: JsonField) = apply { + body.dateArchived(dateArchived) + } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = apply { body.dateCreated(dateCreated) } + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + body.dateCreated(dateCreated) + } + + /** The last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = apply { body.dateUpdated(dateUpdated) } + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + body.dateUpdated(dateUpdated) + } + + /** The test description. */ + fun description(description: JsonValue) = apply { body.description(description) } + + /** The test name. */ + fun name(name: String) = apply { body.name(name) } + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { body.name(name) } + + /** The test number. */ + fun number(number: Long) = apply { body.number(number) } + + /** + * Sets [Builder.number] to an arbitrary JSON value. + * + * You should usually call [Builder.number] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun number(number: JsonField) = apply { body.number(number) } + + /** The project version (commit) id where the test was created. */ + fun originProjectVersionId(originProjectVersionId: String?) = apply { + body.originProjectVersionId(originProjectVersionId) + } + + /** + * Alias for calling [Builder.originProjectVersionId] with + * `originProjectVersionId.orElse(null)`. + */ + fun originProjectVersionId(originProjectVersionId: Optional) = + originProjectVersionId(originProjectVersionId.getOrNull()) + + /** + * Sets [Builder.originProjectVersionId] to an arbitrary JSON value. + * + * You should usually call [Builder.originProjectVersionId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun originProjectVersionId(originProjectVersionId: JsonField) = apply { + body.originProjectVersionId(originProjectVersionId) + } + + /** The test subtype. */ + fun subtype(subtype: String) = apply { body.subtype(subtype) } + + /** + * Sets [Builder.subtype] to an arbitrary JSON value. + * + * You should usually call [Builder.subtype] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun subtype(subtype: JsonField) = apply { body.subtype(subtype) } + + /** Whether the test is suggested or user-created. */ + fun suggested(suggested: Boolean) = apply { body.suggested(suggested) } + + /** + * Sets [Builder.suggested] to an arbitrary JSON value. + * + * You should usually call [Builder.suggested] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun suggested(suggested: JsonField) = apply { body.suggested(suggested) } + + fun thresholds(thresholds: List) = apply { body.thresholds(thresholds) } + + /** + * Sets [Builder.thresholds] to an arbitrary JSON value. + * + * You should usually call [Builder.thresholds] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun thresholds(thresholds: JsonField>) = apply { + body.thresholds(thresholds) + } + + /** + * Adds a single [Threshold] to [thresholds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addThreshold(threshold: Threshold) = apply { body.addThreshold(threshold) } + + /** The test type. */ + fun type(type: String) = apply { body.type(type) } + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun type(type: JsonField) = apply { body.type(type) } + + /** Whether the test is archived. */ + fun archived(archived: Boolean) = apply { body.archived(archived) } + + /** + * Sets [Builder.archived] to an arbitrary JSON value. + * + * You should usually call [Builder.archived] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun archived(archived: JsonField) = apply { body.archived(archived) } + + /** The delay window in seconds. Only applies to tests that use production data. */ + fun delayWindow(delayWindow: Double?) = apply { body.delayWindow(delayWindow) } + + /** + * Alias for [Builder.delayWindow]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun delayWindow(delayWindow: Double) = delayWindow(delayWindow as Double?) + + /** Alias for calling [Builder.delayWindow] with `delayWindow.orElse(null)`. */ + fun delayWindow(delayWindow: Optional) = delayWindow(delayWindow.getOrNull()) + + /** + * Sets [Builder.delayWindow] to an arbitrary JSON value. + * + * You should usually call [Builder.delayWindow] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun delayWindow(delayWindow: JsonField) = apply { body.delayWindow(delayWindow) } + + /** The evaluation window in seconds. Only applies to tests that use production data. */ + fun evaluationWindow(evaluationWindow: Double?) = apply { + body.evaluationWindow(evaluationWindow) + } + + /** + * Alias for [Builder.evaluationWindow]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun evaluationWindow(evaluationWindow: Double) = + evaluationWindow(evaluationWindow as Double?) + + /** Alias for calling [Builder.evaluationWindow] with `evaluationWindow.orElse(null)`. */ + fun evaluationWindow(evaluationWindow: Optional) = + evaluationWindow(evaluationWindow.getOrNull()) + + /** + * Sets [Builder.evaluationWindow] to an arbitrary JSON value. + * + * You should usually call [Builder.evaluationWindow] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun evaluationWindow(evaluationWindow: JsonField) = apply { + body.evaluationWindow(evaluationWindow) + } + + /** Whether the test uses an ML model. */ + fun usesMlModel(usesMlModel: Boolean) = apply { body.usesMlModel(usesMlModel) } + + /** + * Sets [Builder.usesMlModel] to an arbitrary JSON value. + * + * You should usually call [Builder.usesMlModel] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun usesMlModel(usesMlModel: JsonField) = apply { body.usesMlModel(usesMlModel) } + + /** Whether the test uses production data (monitoring mode only). */ + fun usesProductionData(usesProductionData: Boolean) = apply { + body.usesProductionData(usesProductionData) + } + + /** + * Sets [Builder.usesProductionData] to an arbitrary JSON value. + * + * You should usually call [Builder.usesProductionData] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun usesProductionData(usesProductionData: JsonField) = apply { + body.usesProductionData(usesProductionData) + } + + /** Whether the test uses a reference dataset (monitoring mode only). */ + fun usesReferenceDataset(usesReferenceDataset: Boolean) = apply { + body.usesReferenceDataset(usesReferenceDataset) + } + + /** + * Sets [Builder.usesReferenceDataset] to an arbitrary JSON value. + * + * You should usually call [Builder.usesReferenceDataset] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun usesReferenceDataset(usesReferenceDataset: JsonField) = apply { + body.usesReferenceDataset(usesReferenceDataset) + } + + /** Whether the test uses a training dataset. */ + fun usesTrainingDataset(usesTrainingDataset: Boolean) = apply { + body.usesTrainingDataset(usesTrainingDataset) + } + + /** + * Sets [Builder.usesTrainingDataset] to an arbitrary JSON value. + * + * You should usually call [Builder.usesTrainingDataset] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun usesTrainingDataset(usesTrainingDataset: JsonField) = apply { + body.usesTrainingDataset(usesTrainingDataset) + } + + /** Whether the test uses a validation dataset. */ + fun usesValidationDataset(usesValidationDataset: Boolean) = apply { + body.usesValidationDataset(usesValidationDataset) + } + + /** + * Sets [Builder.usesValidationDataset] to an arbitrary JSON value. + * + * You should usually call [Builder.usesValidationDataset] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun usesValidationDataset(usesValidationDataset: JsonField) = apply { + body.usesValidationDataset(usesValidationDataset) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [TestCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .projectId() + * .id() + * .commentCount() + * .creatorId() + * .dateArchived() + * .dateCreated() + * .dateUpdated() + * .description() + * .name() + * .number() + * .originProjectVersionId() + * .subtype() + * .suggested() + * .thresholds() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TestCreateParams = + TestCreateParams( + checkRequired("projectId", projectId), + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> projectId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + private constructor( + private val id: JsonField, + private val commentCount: JsonField, + private val creatorId: JsonField, + private val dateArchived: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val description: JsonValue, + private val name: JsonField, + private val number: JsonField, + private val originProjectVersionId: JsonField, + private val subtype: JsonField, + private val suggested: JsonField, + private val thresholds: JsonField>, + private val type: JsonField, + private val archived: JsonField, + private val delayWindow: JsonField, + private val evaluationWindow: JsonField, + private val usesMlModel: JsonField, + private val usesProductionData: JsonField, + private val usesReferenceDataset: JsonField, + private val usesTrainingDataset: JsonField, + private val usesValidationDataset: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("commentCount") + @ExcludeMissing + commentCount: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateArchived") + @ExcludeMissing + dateArchived: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("description") @ExcludeMissing description: JsonValue = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("number") @ExcludeMissing number: JsonField = JsonMissing.of(), + @JsonProperty("originProjectVersionId") + @ExcludeMissing + originProjectVersionId: JsonField = JsonMissing.of(), + @JsonProperty("subtype") @ExcludeMissing subtype: JsonField = JsonMissing.of(), + @JsonProperty("suggested") + @ExcludeMissing + suggested: JsonField = JsonMissing.of(), + @JsonProperty("thresholds") + @ExcludeMissing + thresholds: JsonField> = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("archived") + @ExcludeMissing + archived: JsonField = JsonMissing.of(), + @JsonProperty("delayWindow") + @ExcludeMissing + delayWindow: JsonField = JsonMissing.of(), + @JsonProperty("evaluationWindow") + @ExcludeMissing + evaluationWindow: JsonField = JsonMissing.of(), + @JsonProperty("usesMlModel") + @ExcludeMissing + usesMlModel: JsonField = JsonMissing.of(), + @JsonProperty("usesProductionData") + @ExcludeMissing + usesProductionData: JsonField = JsonMissing.of(), + @JsonProperty("usesReferenceDataset") + @ExcludeMissing + usesReferenceDataset: JsonField = JsonMissing.of(), + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + usesTrainingDataset: JsonField = JsonMissing.of(), + @JsonProperty("usesValidationDataset") + @ExcludeMissing + usesValidationDataset: JsonField = JsonMissing.of(), + ) : this( + id, + commentCount, + creatorId, + dateArchived, + dateCreated, + dateUpdated, + description, + name, + number, + originProjectVersionId, + subtype, + suggested, + thresholds, + type, + archived, + delayWindow, + evaluationWindow, + usesMlModel, + usesProductionData, + usesReferenceDataset, + usesTrainingDataset, + usesValidationDataset, + mutableMapOf(), + ) + + /** + * The test id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The number of comments on the test. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun commentCount(): Long = commentCount.getRequired("commentCount") + + /** + * The test creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun creatorId(): Optional = creatorId.getOptional("creatorId") + + /** + * The date the test was archived. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateArchived(): Optional = dateArchived.getOptional("dateArchived") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** The test description. */ + @JsonProperty("description") @ExcludeMissing fun _description(): JsonValue = description + + /** + * The test name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * The test number. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun number(): Long = number.getRequired("number") + + /** + * The project version (commit) id where the test was created. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun originProjectVersionId(): Optional = + originProjectVersionId.getOptional("originProjectVersionId") + + /** + * The test subtype. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun subtype(): String = subtype.getRequired("subtype") + + /** + * Whether the test is suggested or user-created. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun suggested(): Boolean = suggested.getRequired("suggested") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun thresholds(): List = thresholds.getRequired("thresholds") + + /** + * The test type. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): String = type.getRequired("type") + + /** + * Whether the test is archived. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun archived(): Optional = archived.getOptional("archived") + + /** + * The delay window in seconds. Only applies to tests that use production data. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun delayWindow(): Optional = delayWindow.getOptional("delayWindow") + + /** + * The evaluation window in seconds. Only applies to tests that use production data. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun evaluationWindow(): Optional = evaluationWindow.getOptional("evaluationWindow") + + /** + * Whether the test uses an ML model. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun usesMlModel(): Optional = usesMlModel.getOptional("usesMlModel") + + /** + * Whether the test uses production data (monitoring mode only). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun usesProductionData(): Optional = + usesProductionData.getOptional("usesProductionData") + + /** + * Whether the test uses a reference dataset (monitoring mode only). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun usesReferenceDataset(): Optional = + usesReferenceDataset.getOptional("usesReferenceDataset") + + /** + * Whether the test uses a training dataset. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun usesTrainingDataset(): Optional = + usesTrainingDataset.getOptional("usesTrainingDataset") + + /** + * Whether the test uses a validation dataset. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun usesValidationDataset(): Optional = + usesValidationDataset.getOptional("usesValidationDataset") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [commentCount]. + * + * Unlike [commentCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("commentCount") + @ExcludeMissing + fun _commentCount(): JsonField = commentCount + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [dateArchived]. + * + * Unlike [dateArchived], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateArchived") + @ExcludeMissing + fun _dateArchived(): JsonField = dateArchived + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [number]. + * + * Unlike [number], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("number") @ExcludeMissing fun _number(): JsonField = number + + /** + * Returns the raw JSON value of [originProjectVersionId]. + * + * Unlike [originProjectVersionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("originProjectVersionId") + @ExcludeMissing + fun _originProjectVersionId(): JsonField = originProjectVersionId + + /** + * Returns the raw JSON value of [subtype]. + * + * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype + + /** + * Returns the raw JSON value of [suggested]. + * + * Unlike [suggested], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("suggested") @ExcludeMissing fun _suggested(): JsonField = suggested + + /** + * Returns the raw JSON value of [thresholds]. + * + * Unlike [thresholds], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("thresholds") + @ExcludeMissing + fun _thresholds(): JsonField> = thresholds + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [archived]. + * + * Unlike [archived], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived + + /** + * Returns the raw JSON value of [delayWindow]. + * + * Unlike [delayWindow], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("delayWindow") + @ExcludeMissing + fun _delayWindow(): JsonField = delayWindow + + /** + * Returns the raw JSON value of [evaluationWindow]. + * + * Unlike [evaluationWindow], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("evaluationWindow") + @ExcludeMissing + fun _evaluationWindow(): JsonField = evaluationWindow + + /** + * Returns the raw JSON value of [usesMlModel]. + * + * Unlike [usesMlModel], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("usesMlModel") + @ExcludeMissing + fun _usesMlModel(): JsonField = usesMlModel + + /** + * Returns the raw JSON value of [usesProductionData]. + * + * Unlike [usesProductionData], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("usesProductionData") + @ExcludeMissing + fun _usesProductionData(): JsonField = usesProductionData + + /** + * Returns the raw JSON value of [usesReferenceDataset]. + * + * Unlike [usesReferenceDataset], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("usesReferenceDataset") + @ExcludeMissing + fun _usesReferenceDataset(): JsonField = usesReferenceDataset + + /** + * Returns the raw JSON value of [usesTrainingDataset]. + * + * Unlike [usesTrainingDataset], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + fun _usesTrainingDataset(): JsonField = usesTrainingDataset + + /** + * Returns the raw JSON value of [usesValidationDataset]. + * + * Unlike [usesValidationDataset], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("usesValidationDataset") + @ExcludeMissing + fun _usesValidationDataset(): JsonField = usesValidationDataset + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .id() + * .commentCount() + * .creatorId() + * .dateArchived() + * .dateCreated() + * .dateUpdated() + * .description() + * .name() + * .number() + * .originProjectVersionId() + * .subtype() + * .suggested() + * .thresholds() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var commentCount: JsonField? = null + private var creatorId: JsonField? = null + private var dateArchived: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var description: JsonValue? = null + private var name: JsonField? = null + private var number: JsonField? = null + private var originProjectVersionId: JsonField? = null + private var subtype: JsonField? = null + private var suggested: JsonField? = null + private var thresholds: JsonField>? = null + private var type: JsonField? = null + private var archived: JsonField = JsonMissing.of() + private var delayWindow: JsonField = JsonMissing.of() + private var evaluationWindow: JsonField = JsonMissing.of() + private var usesMlModel: JsonField = JsonMissing.of() + private var usesProductionData: JsonField = JsonMissing.of() + private var usesReferenceDataset: JsonField = JsonMissing.of() + private var usesTrainingDataset: JsonField = JsonMissing.of() + private var usesValidationDataset: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + id = body.id + commentCount = body.commentCount + creatorId = body.creatorId + dateArchived = body.dateArchived + dateCreated = body.dateCreated + dateUpdated = body.dateUpdated + description = body.description + name = body.name + number = body.number + originProjectVersionId = body.originProjectVersionId + subtype = body.subtype + suggested = body.suggested + thresholds = body.thresholds.map { it.toMutableList() } + type = body.type + archived = body.archived + delayWindow = body.delayWindow + evaluationWindow = body.evaluationWindow + usesMlModel = body.usesMlModel + usesProductionData = body.usesProductionData + usesReferenceDataset = body.usesReferenceDataset + usesTrainingDataset = body.usesTrainingDataset + usesValidationDataset = body.usesValidationDataset + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The test id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The number of comments on the test. */ + fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) + + /** + * Sets [Builder.commentCount] to an arbitrary JSON value. + * + * You should usually call [Builder.commentCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun commentCount(commentCount: JsonField) = apply { + this.commentCount = commentCount + } + + /** The test creator id. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The date the test was archived. */ + fun dateArchived(dateArchived: OffsetDateTime?) = + dateArchived(JsonField.ofNullable(dateArchived)) + + /** Alias for calling [Builder.dateArchived] with `dateArchived.orElse(null)`. */ + fun dateArchived(dateArchived: Optional) = + dateArchived(dateArchived.getOrNull()) + + /** + * Sets [Builder.dateArchived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateArchived] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateArchived(dateArchived: JsonField) = apply { + this.dateArchived = dateArchived + } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The test description. */ + fun description(description: JsonValue) = apply { this.description = description } + + /** The test name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** The test number. */ + fun number(number: Long) = number(JsonField.of(number)) + + /** + * Sets [Builder.number] to an arbitrary JSON value. + * + * You should usually call [Builder.number] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun number(number: JsonField) = apply { this.number = number } + + /** The project version (commit) id where the test was created. */ + fun originProjectVersionId(originProjectVersionId: String?) = + originProjectVersionId(JsonField.ofNullable(originProjectVersionId)) + + /** + * Alias for calling [Builder.originProjectVersionId] with + * `originProjectVersionId.orElse(null)`. + */ + fun originProjectVersionId(originProjectVersionId: Optional) = + originProjectVersionId(originProjectVersionId.getOrNull()) + + /** + * Sets [Builder.originProjectVersionId] to an arbitrary JSON value. + * + * You should usually call [Builder.originProjectVersionId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun originProjectVersionId(originProjectVersionId: JsonField) = apply { + this.originProjectVersionId = originProjectVersionId + } + + /** The test subtype. */ + fun subtype(subtype: String) = subtype(JsonField.of(subtype)) + + /** + * Sets [Builder.subtype] to an arbitrary JSON value. + * + * You should usually call [Builder.subtype] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun subtype(subtype: JsonField) = apply { this.subtype = subtype } + + /** Whether the test is suggested or user-created. */ + fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) + + /** + * Sets [Builder.suggested] to an arbitrary JSON value. + * + * You should usually call [Builder.suggested] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun suggested(suggested: JsonField) = apply { this.suggested = suggested } + + fun thresholds(thresholds: List) = thresholds(JsonField.of(thresholds)) + + /** + * Sets [Builder.thresholds] to an arbitrary JSON value. + * + * You should usually call [Builder.thresholds] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun thresholds(thresholds: JsonField>) = apply { + this.thresholds = thresholds.map { it.toMutableList() } + } + + /** + * Adds a single [Threshold] to [thresholds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addThreshold(threshold: Threshold) = apply { + thresholds = + (thresholds ?: JsonField.of(mutableListOf())).also { + checkKnown("thresholds", it).add(threshold) + } + } + + /** The test type. */ + fun type(type: String) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** Whether the test is archived. */ + fun archived(archived: Boolean) = archived(JsonField.of(archived)) + + /** + * Sets [Builder.archived] to an arbitrary JSON value. + * + * You should usually call [Builder.archived] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun archived(archived: JsonField) = apply { this.archived = archived } + + /** The delay window in seconds. Only applies to tests that use production data. */ + fun delayWindow(delayWindow: Double?) = delayWindow(JsonField.ofNullable(delayWindow)) + + /** + * Alias for [Builder.delayWindow]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun delayWindow(delayWindow: Double) = delayWindow(delayWindow as Double?) + + /** Alias for calling [Builder.delayWindow] with `delayWindow.orElse(null)`. */ + fun delayWindow(delayWindow: Optional) = delayWindow(delayWindow.getOrNull()) + + /** + * Sets [Builder.delayWindow] to an arbitrary JSON value. + * + * You should usually call [Builder.delayWindow] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun delayWindow(delayWindow: JsonField) = apply { + this.delayWindow = delayWindow + } + + /** The evaluation window in seconds. Only applies to tests that use production data. */ + fun evaluationWindow(evaluationWindow: Double?) = + evaluationWindow(JsonField.ofNullable(evaluationWindow)) + + /** + * Alias for [Builder.evaluationWindow]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun evaluationWindow(evaluationWindow: Double) = + evaluationWindow(evaluationWindow as Double?) + + /** + * Alias for calling [Builder.evaluationWindow] with `evaluationWindow.orElse(null)`. + */ + fun evaluationWindow(evaluationWindow: Optional) = + evaluationWindow(evaluationWindow.getOrNull()) + + /** + * Sets [Builder.evaluationWindow] to an arbitrary JSON value. + * + * You should usually call [Builder.evaluationWindow] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun evaluationWindow(evaluationWindow: JsonField) = apply { + this.evaluationWindow = evaluationWindow + } + + /** Whether the test uses an ML model. */ + fun usesMlModel(usesMlModel: Boolean) = usesMlModel(JsonField.of(usesMlModel)) + + /** + * Sets [Builder.usesMlModel] to an arbitrary JSON value. + * + * You should usually call [Builder.usesMlModel] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun usesMlModel(usesMlModel: JsonField) = apply { + this.usesMlModel = usesMlModel + } + + /** Whether the test uses production data (monitoring mode only). */ + fun usesProductionData(usesProductionData: Boolean) = + usesProductionData(JsonField.of(usesProductionData)) + + /** + * Sets [Builder.usesProductionData] to an arbitrary JSON value. + * + * You should usually call [Builder.usesProductionData] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun usesProductionData(usesProductionData: JsonField) = apply { + this.usesProductionData = usesProductionData + } + + /** Whether the test uses a reference dataset (monitoring mode only). */ + fun usesReferenceDataset(usesReferenceDataset: Boolean) = + usesReferenceDataset(JsonField.of(usesReferenceDataset)) + + /** + * Sets [Builder.usesReferenceDataset] to an arbitrary JSON value. + * + * You should usually call [Builder.usesReferenceDataset] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun usesReferenceDataset(usesReferenceDataset: JsonField) = apply { + this.usesReferenceDataset = usesReferenceDataset + } + + /** Whether the test uses a training dataset. */ + fun usesTrainingDataset(usesTrainingDataset: Boolean) = + usesTrainingDataset(JsonField.of(usesTrainingDataset)) + + /** + * Sets [Builder.usesTrainingDataset] to an arbitrary JSON value. + * + * You should usually call [Builder.usesTrainingDataset] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun usesTrainingDataset(usesTrainingDataset: JsonField) = apply { + this.usesTrainingDataset = usesTrainingDataset + } + + /** Whether the test uses a validation dataset. */ + fun usesValidationDataset(usesValidationDataset: Boolean) = + usesValidationDataset(JsonField.of(usesValidationDataset)) + + /** + * Sets [Builder.usesValidationDataset] to an arbitrary JSON value. + * + * You should usually call [Builder.usesValidationDataset] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun usesValidationDataset(usesValidationDataset: JsonField) = apply { + this.usesValidationDataset = usesValidationDataset + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .commentCount() + * .creatorId() + * .dateArchived() + * .dateCreated() + * .dateUpdated() + * .description() + * .name() + * .number() + * .originProjectVersionId() + * .subtype() + * .suggested() + * .thresholds() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("id", id), + checkRequired("commentCount", commentCount), + checkRequired("creatorId", creatorId), + checkRequired("dateArchived", dateArchived), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("description", description), + checkRequired("name", name), + checkRequired("number", number), + checkRequired("originProjectVersionId", originProjectVersionId), + checkRequired("subtype", subtype), + checkRequired("suggested", suggested), + checkRequired("thresholds", thresholds).map { it.toImmutable() }, + checkRequired("type", type), + archived, + delayWindow, + evaluationWindow, + usesMlModel, + usesProductionData, + usesReferenceDataset, + usesTrainingDataset, + usesValidationDataset, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + id() + commentCount() + creatorId() + dateArchived() + dateCreated() + dateUpdated() + name() + number() + originProjectVersionId() + subtype() + suggested() + thresholds().forEach { it.validate() } + type() + archived() + delayWindow() + evaluationWindow() + usesMlModel() + usesProductionData() + usesReferenceDataset() + usesTrainingDataset() + usesValidationDataset() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (commentCount.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateArchived.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (number.asKnown().isPresent) 1 else 0) + + (if (originProjectVersionId.asKnown().isPresent) 1 else 0) + + (if (subtype.asKnown().isPresent) 1 else 0) + + (if (suggested.asKnown().isPresent) 1 else 0) + + (thresholds.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (type.asKnown().isPresent) 1 else 0) + + (if (archived.asKnown().isPresent) 1 else 0) + + (if (delayWindow.asKnown().isPresent) 1 else 0) + + (if (evaluationWindow.asKnown().isPresent) 1 else 0) + + (if (usesMlModel.asKnown().isPresent) 1 else 0) + + (if (usesProductionData.asKnown().isPresent) 1 else 0) + + (if (usesReferenceDataset.asKnown().isPresent) 1 else 0) + + (if (usesTrainingDataset.asKnown().isPresent) 1 else 0) + + (if (usesValidationDataset.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Body && id == other.id && commentCount == other.commentCount && creatorId == other.creatorId && dateArchived == other.dateArchived && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && description == other.description && name == other.name && number == other.number && originProjectVersionId == other.originProjectVersionId && subtype == other.subtype && suggested == other.suggested && thresholds == other.thresholds && type == other.type && archived == other.archived && delayWindow == other.delayWindow && evaluationWindow == other.evaluationWindow && usesMlModel == other.usesMlModel && usesProductionData == other.usesProductionData && usesReferenceDataset == other.usesReferenceDataset && usesTrainingDataset == other.usesTrainingDataset && usesValidationDataset == other.usesValidationDataset && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, commentCount, creatorId, dateArchived, dateCreated, dateUpdated, description, name, number, originProjectVersionId, subtype, suggested, thresholds, type, archived, delayWindow, evaluationWindow, usesMlModel, usesProductionData, usesReferenceDataset, usesTrainingDataset, usesValidationDataset, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{id=$id, commentCount=$commentCount, creatorId=$creatorId, dateArchived=$dateArchived, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, name=$name, number=$number, originProjectVersionId=$originProjectVersionId, subtype=$subtype, suggested=$suggested, thresholds=$thresholds, type=$type, archived=$archived, delayWindow=$delayWindow, evaluationWindow=$evaluationWindow, usesMlModel=$usesMlModel, usesProductionData=$usesProductionData, usesReferenceDataset=$usesReferenceDataset, usesTrainingDataset=$usesTrainingDataset, usesValidationDataset=$usesValidationDataset, additionalProperties=$additionalProperties}" + } + + class Threshold + private constructor( + private val insightName: JsonField, + private val insightParameters: JsonField>, + private val measurement: JsonField, + private val operator: JsonField, + private val thresholdMode: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("insightName") + @ExcludeMissing + insightName: JsonField = JsonMissing.of(), + @JsonProperty("insightParameters") + @ExcludeMissing + insightParameters: JsonField> = JsonMissing.of(), + @JsonProperty("measurement") + @ExcludeMissing + measurement: JsonField = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + operator: JsonField = JsonMissing.of(), + @JsonProperty("thresholdMode") + @ExcludeMissing + thresholdMode: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + ) : this( + insightName, + insightParameters, + measurement, + operator, + thresholdMode, + value, + mutableMapOf(), + ) + + /** + * The insight name to be evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun insightName(): Optional = insightName.getOptional("insightName") + + /** + * The insight parameters. Required only for some test subtypes. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun insightParameters(): Optional> = + insightParameters.getOptional("insightParameters") + + /** + * The measurement to be evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun measurement(): Optional = measurement.getOptional("measurement") + + /** + * The operator to be used for the evaluation. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun operator(): Optional = operator.getOptional("operator") + + /** + * Whether to use automatic anomaly detection or manual thresholds + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun thresholdMode(): Optional = thresholdMode.getOptional("thresholdMode") + + /** + * The value to be compared. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun value(): Optional = value.getOptional("value") + + /** + * Returns the raw JSON value of [insightName]. + * + * Unlike [insightName], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("insightName") + @ExcludeMissing + fun _insightName(): JsonField = insightName + + /** + * Returns the raw JSON value of [insightParameters]. + * + * Unlike [insightParameters], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("insightParameters") + @ExcludeMissing + fun _insightParameters(): JsonField> = insightParameters + + /** + * Returns the raw JSON value of [measurement]. + * + * Unlike [measurement], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("measurement") + @ExcludeMissing + fun _measurement(): JsonField = measurement + + /** + * Returns the raw JSON value of [operator]. + * + * Unlike [operator], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("operator") @ExcludeMissing fun _operator(): JsonField = operator + + /** + * Returns the raw JSON value of [thresholdMode]. + * + * Unlike [thresholdMode], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("thresholdMode") + @ExcludeMissing + fun _thresholdMode(): JsonField = thresholdMode + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Threshold]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Threshold]. */ + class Builder internal constructor() { + + private var insightName: JsonField = JsonMissing.of() + private var insightParameters: JsonField>? = null + private var measurement: JsonField = JsonMissing.of() + private var operator: JsonField = JsonMissing.of() + private var thresholdMode: JsonField = JsonMissing.of() + private var value: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(threshold: Threshold) = apply { + insightName = threshold.insightName + insightParameters = threshold.insightParameters.map { it.toMutableList() } + measurement = threshold.measurement + operator = threshold.operator + thresholdMode = threshold.thresholdMode + value = threshold.value + additionalProperties = threshold.additionalProperties.toMutableMap() + } + + /** The insight name to be evaluated. */ + fun insightName(insightName: String) = insightName(JsonField.of(insightName)) + + /** + * Sets [Builder.insightName] to an arbitrary JSON value. + * + * You should usually call [Builder.insightName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun insightName(insightName: JsonField) = apply { + this.insightName = insightName + } + + /** The insight parameters. Required only for some test subtypes. */ + fun insightParameters(insightParameters: List?) = + insightParameters(JsonField.ofNullable(insightParameters)) + + /** + * Alias for calling [Builder.insightParameters] with `insightParameters.orElse(null)`. + */ + fun insightParameters(insightParameters: Optional>) = + insightParameters(insightParameters.getOrNull()) + + /** + * Sets [Builder.insightParameters] to an arbitrary JSON value. + * + * You should usually call [Builder.insightParameters] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun insightParameters(insightParameters: JsonField>) = apply { + this.insightParameters = insightParameters.map { it.toMutableList() } + } + + /** + * Adds a single [InsightParameter] to [insightParameters]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addInsightParameter(insightParameter: InsightParameter) = apply { + insightParameters = + (insightParameters ?: JsonField.of(mutableListOf())).also { + checkKnown("insightParameters", it).add(insightParameter) + } + } + + /** The measurement to be evaluated. */ + fun measurement(measurement: String) = measurement(JsonField.of(measurement)) + + /** + * Sets [Builder.measurement] to an arbitrary JSON value. + * + * You should usually call [Builder.measurement] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun measurement(measurement: JsonField) = apply { + this.measurement = measurement + } + + /** The operator to be used for the evaluation. */ + fun operator(operator: Operator) = operator(JsonField.of(operator)) + + /** + * Sets [Builder.operator] to an arbitrary JSON value. + * + * You should usually call [Builder.operator] with a well-typed [Operator] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun operator(operator: JsonField) = apply { this.operator = operator } + + /** Whether to use automatic anomaly detection or manual thresholds */ + fun thresholdMode(thresholdMode: ThresholdMode) = + thresholdMode(JsonField.of(thresholdMode)) + + /** + * Sets [Builder.thresholdMode] to an arbitrary JSON value. + * + * You should usually call [Builder.thresholdMode] with a well-typed [ThresholdMode] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun thresholdMode(thresholdMode: JsonField) = apply { + this.thresholdMode = thresholdMode + } + + /** The value to be compared. */ + fun value(value: Value) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [Value] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun value(value: JsonField) = apply { this.value = value } + + /** Alias for calling [value] with `Value.ofNumber(number)`. */ + fun value(number: Double) = value(Value.ofNumber(number)) + + /** Alias for calling [value] with `Value.ofBool(bool)`. */ + fun value(bool: Boolean) = value(Value.ofBool(bool)) + + /** Alias for calling [value] with `Value.ofString(string)`. */ + fun value(string: String) = value(Value.ofString(string)) + + /** Alias for calling [value] with `Value.ofStrings(strings)`. */ + fun valueOfStrings(strings: List) = value(Value.ofStrings(strings)) + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Threshold]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Threshold = + Threshold( + insightName, + (insightParameters ?: JsonMissing.of()).map { it.toImmutable() }, + measurement, + operator, + thresholdMode, + value, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Threshold = apply { + if (validated) { + return@apply + } + + insightName() + insightParameters().ifPresent { it.forEach { it.validate() } } + measurement() + operator().ifPresent { it.validate() } + thresholdMode().ifPresent { it.validate() } + value().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (insightName.asKnown().isPresent) 1 else 0) + + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (measurement.asKnown().isPresent) 1 else 0) + + (operator.asKnown().getOrNull()?.validity() ?: 0) + + (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + + (value.asKnown().getOrNull()?.validity() ?: 0) + + class InsightParameter + private constructor( + private val name: JsonField, + private val value: JsonValue, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonValue = JsonMissing.of(), + ) : this(name, value, mutableMapOf()) + + /** + * The name of the insight filter. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun name(): String = name.getRequired("name") + + @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [InsightParameter]. + * + * The following fields are required: + * ```java + * .name() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InsightParameter]. */ + class Builder internal constructor() { + + private var name: JsonField? = null + private var value: JsonValue? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(insightParameter: InsightParameter) = apply { + name = insightParameter.name + value = insightParameter.value + additionalProperties = insightParameter.additionalProperties.toMutableMap() + } + + /** The name of the insight filter. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun value(value: JsonValue) = apply { this.value = value } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [InsightParameter]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .name() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): InsightParameter = + InsightParameter( + checkRequired("name", name), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): InsightParameter = apply { + if (validated) { + return@apply + } + + name() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (name.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InsightParameter && name == other.name && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(name, value, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InsightParameter{name=$name, value=$value, additionalProperties=$additionalProperties}" + } + + /** The operator to be used for the evaluation. */ + class Operator @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val IS = of("is") + + @JvmField val GREATER = of(">") + + @JvmField val GREATER_OR_EQUALS = of(">=") + + @JvmField val LESS = of("<") + + @JvmField val LESS_OR_EQUALS = of("<=") + + @JvmField val NOT_EQUALS = of("!=") + + @JvmStatic fun of(value: String) = Operator(JsonField.of(value)) + } + + /** An enum containing [Operator]'s known values. */ + enum class Known { + IS, + GREATER, + GREATER_OR_EQUALS, + LESS, + LESS_OR_EQUALS, + NOT_EQUALS, + } + + /** + * An enum containing [Operator]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Operator] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + IS, + GREATER, + GREATER_OR_EQUALS, + LESS, + LESS_OR_EQUALS, + NOT_EQUALS, + /** + * An enum member indicating that [Operator] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + IS -> Value.IS + GREATER -> Value.GREATER + GREATER_OR_EQUALS -> Value.GREATER_OR_EQUALS + LESS -> Value.LESS + LESS_OR_EQUALS -> Value.LESS_OR_EQUALS + NOT_EQUALS -> Value.NOT_EQUALS + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + IS -> Known.IS + GREATER -> Known.GREATER + GREATER_OR_EQUALS -> Known.GREATER_OR_EQUALS + LESS -> Known.LESS + LESS_OR_EQUALS -> Known.LESS_OR_EQUALS + NOT_EQUALS -> Known.NOT_EQUALS + else -> throw OpenlayerInvalidDataException("Unknown Operator: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Operator = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Operator && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Whether to use automatic anomaly detection or manual thresholds */ + class ThresholdMode @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val AUTOMATIC = of("automatic") + + @JvmField val MANUAL = of("manual") + + @JvmStatic fun of(value: String) = ThresholdMode(JsonField.of(value)) + } + + /** An enum containing [ThresholdMode]'s known values. */ + enum class Known { + AUTOMATIC, + MANUAL, + } + + /** + * An enum containing [ThresholdMode]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [ThresholdMode] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + AUTOMATIC, + MANUAL, + /** + * An enum member indicating that [ThresholdMode] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + AUTOMATIC -> Value.AUTOMATIC + MANUAL -> Value.MANUAL + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + AUTOMATIC -> Known.AUTOMATIC + MANUAL -> Known.MANUAL + else -> throw OpenlayerInvalidDataException("Unknown ThresholdMode: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): ThresholdMode = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ThresholdMode && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The value to be compared. */ + @JsonDeserialize(using = Value.Deserializer::class) + @JsonSerialize(using = Value.Serializer::class) + class Value + private constructor( + private val number: Double? = null, + private val bool: Boolean? = null, + private val string: String? = null, + private val strings: List? = null, + private val _json: JsonValue? = null, + ) { + + fun number(): Optional = Optional.ofNullable(number) + + fun bool(): Optional = Optional.ofNullable(bool) + + fun string(): Optional = Optional.ofNullable(string) + + fun strings(): Optional> = Optional.ofNullable(strings) + + fun isNumber(): Boolean = number != null + + fun isBool(): Boolean = bool != null + + fun isString(): Boolean = string != null + + fun isStrings(): Boolean = strings != null + + fun asNumber(): Double = number.getOrThrow("number") + + fun asBool(): Boolean = bool.getOrThrow("bool") + + fun asString(): String = string.getOrThrow("string") + + fun asStrings(): List = strings.getOrThrow("strings") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T = + when { + number != null -> visitor.visitNumber(number) + bool != null -> visitor.visitBool(bool) + string != null -> visitor.visitString(string) + strings != null -> visitor.visitStrings(strings) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + fun validate(): Value = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitNumber(number: Double) {} + + override fun visitBool(bool: Boolean) {} + + override fun visitString(string: String) {} + + override fun visitStrings(strings: List) {} + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitNumber(number: Double) = 1 + + override fun visitBool(bool: Boolean) = 1 + + override fun visitString(string: String) = 1 + + override fun visitStrings(strings: List) = strings.size + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Value && number == other.number && bool == other.bool && string == other.string && strings == other.strings /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(number, bool, string, strings) /* spotless:on */ + + override fun toString(): String = + when { + number != null -> "Value{number=$number}" + bool != null -> "Value{bool=$bool}" + string != null -> "Value{string=$string}" + strings != null -> "Value{strings=$strings}" + _json != null -> "Value{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Value") + } + + companion object { + + @JvmStatic fun ofNumber(number: Double) = Value(number = number) + + @JvmStatic fun ofBool(bool: Boolean) = Value(bool = bool) + + @JvmStatic fun ofString(string: String) = Value(string = string) + + @JvmStatic fun ofStrings(strings: List) = Value(strings = strings) + } + + /** + * An interface that defines how to map each variant of [Value] to a value of type [T]. + */ + interface Visitor { + + fun visitNumber(number: Double): T + + fun visitBool(bool: Boolean): T + + fun visitString(string: String): T + + fun visitStrings(strings: List): T + + /** + * Maps an unknown variant of [Value] to a value of type [T]. + * + * An instance of [Value] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws OpenlayerInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw OpenlayerInvalidDataException("Unknown Value: $json") + } + } + + internal class Deserializer : BaseDeserializer(Value::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Value { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef())?.let { + Value(number = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Value(bool = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Value(string = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef>())?.let { + Value(strings = it, _json = json) + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely incompatible + // with all the possible variants (e.g. deserializing from object). + 0 -> Value(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then use the + // first completely valid match, or simply the first match if none are + // completely valid. + else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + } + } + } + + internal class Serializer : BaseSerializer(Value::class) { + + override fun serialize( + value: Value, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.number != null -> generator.writeObject(value.number) + value.bool != null -> generator.writeObject(value.bool) + value.string != null -> generator.writeObject(value.string) + value.strings != null -> generator.writeObject(value.strings) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Value") + } + } + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Threshold && insightName == other.insightName && insightParameters == other.insightParameters && measurement == other.measurement && operator == other.operator && thresholdMode == other.thresholdMode && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(insightName, insightParameters, measurement, operator, thresholdMode, value, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Threshold{insightName=$insightName, insightParameters=$insightParameters, measurement=$measurement, operator=$operator, thresholdMode=$thresholdMode, value=$value, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TestCreateParams && projectId == other.projectId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(projectId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ + + override fun toString() = + "TestCreateParams{projectId=$projectId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt new file mode 100644 index 00000000..d9207b9e --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt @@ -0,0 +1,2118 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.projects.tests + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.allMaxBy +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.getOrThrow +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class TestCreateResponse +private constructor( + private val id: JsonField, + private val commentCount: JsonField, + private val creatorId: JsonField, + private val dateArchived: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val description: JsonValue, + private val name: JsonField, + private val number: JsonField, + private val originProjectVersionId: JsonField, + private val subtype: JsonField, + private val suggested: JsonField, + private val thresholds: JsonField>, + private val type: JsonField, + private val archived: JsonField, + private val delayWindow: JsonField, + private val evaluationWindow: JsonField, + private val usesMlModel: JsonField, + private val usesProductionData: JsonField, + private val usesReferenceDataset: JsonField, + private val usesTrainingDataset: JsonField, + private val usesValidationDataset: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("commentCount") + @ExcludeMissing + commentCount: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") @ExcludeMissing creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateArchived") + @ExcludeMissing + dateArchived: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("description") @ExcludeMissing description: JsonValue = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("number") @ExcludeMissing number: JsonField = JsonMissing.of(), + @JsonProperty("originProjectVersionId") + @ExcludeMissing + originProjectVersionId: JsonField = JsonMissing.of(), + @JsonProperty("subtype") @ExcludeMissing subtype: JsonField = JsonMissing.of(), + @JsonProperty("suggested") @ExcludeMissing suggested: JsonField = JsonMissing.of(), + @JsonProperty("thresholds") + @ExcludeMissing + thresholds: JsonField> = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("archived") @ExcludeMissing archived: JsonField = JsonMissing.of(), + @JsonProperty("delayWindow") + @ExcludeMissing + delayWindow: JsonField = JsonMissing.of(), + @JsonProperty("evaluationWindow") + @ExcludeMissing + evaluationWindow: JsonField = JsonMissing.of(), + @JsonProperty("usesMlModel") + @ExcludeMissing + usesMlModel: JsonField = JsonMissing.of(), + @JsonProperty("usesProductionData") + @ExcludeMissing + usesProductionData: JsonField = JsonMissing.of(), + @JsonProperty("usesReferenceDataset") + @ExcludeMissing + usesReferenceDataset: JsonField = JsonMissing.of(), + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + usesTrainingDataset: JsonField = JsonMissing.of(), + @JsonProperty("usesValidationDataset") + @ExcludeMissing + usesValidationDataset: JsonField = JsonMissing.of(), + ) : this( + id, + commentCount, + creatorId, + dateArchived, + dateCreated, + dateUpdated, + description, + name, + number, + originProjectVersionId, + subtype, + suggested, + thresholds, + type, + archived, + delayWindow, + evaluationWindow, + usesMlModel, + usesProductionData, + usesReferenceDataset, + usesTrainingDataset, + usesValidationDataset, + mutableMapOf(), + ) + + /** + * The test id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The number of comments on the test. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun commentCount(): Long = commentCount.getRequired("commentCount") + + /** + * The test creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun creatorId(): Optional = creatorId.getOptional("creatorId") + + /** + * The date the test was archived. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun dateArchived(): Optional = dateArchived.getOptional("dateArchived") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** The test description. */ + @JsonProperty("description") @ExcludeMissing fun _description(): JsonValue = description + + /** + * The test name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * The test number. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun number(): Long = number.getRequired("number") + + /** + * The project version (commit) id where the test was created. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun originProjectVersionId(): Optional = + originProjectVersionId.getOptional("originProjectVersionId") + + /** + * The test subtype. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun subtype(): String = subtype.getRequired("subtype") + + /** + * Whether the test is suggested or user-created. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun suggested(): Boolean = suggested.getRequired("suggested") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun thresholds(): List = thresholds.getRequired("thresholds") + + /** + * The test type. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): String = type.getRequired("type") + + /** + * Whether the test is archived. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun archived(): Optional = archived.getOptional("archived") + + /** + * The delay window in seconds. Only applies to tests that use production data. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun delayWindow(): Optional = delayWindow.getOptional("delayWindow") + + /** + * The evaluation window in seconds. Only applies to tests that use production data. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun evaluationWindow(): Optional = evaluationWindow.getOptional("evaluationWindow") + + /** + * Whether the test uses an ML model. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun usesMlModel(): Optional = usesMlModel.getOptional("usesMlModel") + + /** + * Whether the test uses production data (monitoring mode only). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun usesProductionData(): Optional = + usesProductionData.getOptional("usesProductionData") + + /** + * Whether the test uses a reference dataset (monitoring mode only). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun usesReferenceDataset(): Optional = + usesReferenceDataset.getOptional("usesReferenceDataset") + + /** + * Whether the test uses a training dataset. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun usesTrainingDataset(): Optional = + usesTrainingDataset.getOptional("usesTrainingDataset") + + /** + * Whether the test uses a validation dataset. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun usesValidationDataset(): Optional = + usesValidationDataset.getOptional("usesValidationDataset") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [commentCount]. + * + * Unlike [commentCount], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("commentCount") + @ExcludeMissing + fun _commentCount(): JsonField = commentCount + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [dateArchived]. + * + * Unlike [dateArchived], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateArchived") + @ExcludeMissing + fun _dateArchived(): JsonField = dateArchived + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [number]. + * + * Unlike [number], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("number") @ExcludeMissing fun _number(): JsonField = number + + /** + * Returns the raw JSON value of [originProjectVersionId]. + * + * Unlike [originProjectVersionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("originProjectVersionId") + @ExcludeMissing + fun _originProjectVersionId(): JsonField = originProjectVersionId + + /** + * Returns the raw JSON value of [subtype]. + * + * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype + + /** + * Returns the raw JSON value of [suggested]. + * + * Unlike [suggested], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("suggested") @ExcludeMissing fun _suggested(): JsonField = suggested + + /** + * Returns the raw JSON value of [thresholds]. + * + * Unlike [thresholds], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("thresholds") + @ExcludeMissing + fun _thresholds(): JsonField> = thresholds + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [archived]. + * + * Unlike [archived], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived + + /** + * Returns the raw JSON value of [delayWindow]. + * + * Unlike [delayWindow], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("delayWindow") @ExcludeMissing fun _delayWindow(): JsonField = delayWindow + + /** + * Returns the raw JSON value of [evaluationWindow]. + * + * Unlike [evaluationWindow], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("evaluationWindow") + @ExcludeMissing + fun _evaluationWindow(): JsonField = evaluationWindow + + /** + * Returns the raw JSON value of [usesMlModel]. + * + * Unlike [usesMlModel], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("usesMlModel") + @ExcludeMissing + fun _usesMlModel(): JsonField = usesMlModel + + /** + * Returns the raw JSON value of [usesProductionData]. + * + * Unlike [usesProductionData], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("usesProductionData") + @ExcludeMissing + fun _usesProductionData(): JsonField = usesProductionData + + /** + * Returns the raw JSON value of [usesReferenceDataset]. + * + * Unlike [usesReferenceDataset], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("usesReferenceDataset") + @ExcludeMissing + fun _usesReferenceDataset(): JsonField = usesReferenceDataset + + /** + * Returns the raw JSON value of [usesTrainingDataset]. + * + * Unlike [usesTrainingDataset], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + fun _usesTrainingDataset(): JsonField = usesTrainingDataset + + /** + * Returns the raw JSON value of [usesValidationDataset]. + * + * Unlike [usesValidationDataset], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("usesValidationDataset") + @ExcludeMissing + fun _usesValidationDataset(): JsonField = usesValidationDataset + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [TestCreateResponse]. + * + * The following fields are required: + * ```java + * .id() + * .commentCount() + * .creatorId() + * .dateArchived() + * .dateCreated() + * .dateUpdated() + * .description() + * .name() + * .number() + * .originProjectVersionId() + * .subtype() + * .suggested() + * .thresholds() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TestCreateResponse]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var commentCount: JsonField? = null + private var creatorId: JsonField? = null + private var dateArchived: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var description: JsonValue? = null + private var name: JsonField? = null + private var number: JsonField? = null + private var originProjectVersionId: JsonField? = null + private var subtype: JsonField? = null + private var suggested: JsonField? = null + private var thresholds: JsonField>? = null + private var type: JsonField? = null + private var archived: JsonField = JsonMissing.of() + private var delayWindow: JsonField = JsonMissing.of() + private var evaluationWindow: JsonField = JsonMissing.of() + private var usesMlModel: JsonField = JsonMissing.of() + private var usesProductionData: JsonField = JsonMissing.of() + private var usesReferenceDataset: JsonField = JsonMissing.of() + private var usesTrainingDataset: JsonField = JsonMissing.of() + private var usesValidationDataset: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(testCreateResponse: TestCreateResponse) = apply { + id = testCreateResponse.id + commentCount = testCreateResponse.commentCount + creatorId = testCreateResponse.creatorId + dateArchived = testCreateResponse.dateArchived + dateCreated = testCreateResponse.dateCreated + dateUpdated = testCreateResponse.dateUpdated + description = testCreateResponse.description + name = testCreateResponse.name + number = testCreateResponse.number + originProjectVersionId = testCreateResponse.originProjectVersionId + subtype = testCreateResponse.subtype + suggested = testCreateResponse.suggested + thresholds = testCreateResponse.thresholds.map { it.toMutableList() } + type = testCreateResponse.type + archived = testCreateResponse.archived + delayWindow = testCreateResponse.delayWindow + evaluationWindow = testCreateResponse.evaluationWindow + usesMlModel = testCreateResponse.usesMlModel + usesProductionData = testCreateResponse.usesProductionData + usesReferenceDataset = testCreateResponse.usesReferenceDataset + usesTrainingDataset = testCreateResponse.usesTrainingDataset + usesValidationDataset = testCreateResponse.usesValidationDataset + additionalProperties = testCreateResponse.additionalProperties.toMutableMap() + } + + /** The test id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The number of comments on the test. */ + fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) + + /** + * Sets [Builder.commentCount] to an arbitrary JSON value. + * + * You should usually call [Builder.commentCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun commentCount(commentCount: JsonField) = apply { this.commentCount = commentCount } + + /** The test creator id. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The date the test was archived. */ + fun dateArchived(dateArchived: OffsetDateTime?) = + dateArchived(JsonField.ofNullable(dateArchived)) + + /** Alias for calling [Builder.dateArchived] with `dateArchived.orElse(null)`. */ + fun dateArchived(dateArchived: Optional) = + dateArchived(dateArchived.getOrNull()) + + /** + * Sets [Builder.dateArchived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateArchived] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateArchived(dateArchived: JsonField) = apply { + this.dateArchived = dateArchived + } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The test description. */ + fun description(description: JsonValue) = apply { this.description = description } + + /** The test name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** The test number. */ + fun number(number: Long) = number(JsonField.of(number)) + + /** + * Sets [Builder.number] to an arbitrary JSON value. + * + * You should usually call [Builder.number] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun number(number: JsonField) = apply { this.number = number } + + /** The project version (commit) id where the test was created. */ + fun originProjectVersionId(originProjectVersionId: String?) = + originProjectVersionId(JsonField.ofNullable(originProjectVersionId)) + + /** + * Alias for calling [Builder.originProjectVersionId] with + * `originProjectVersionId.orElse(null)`. + */ + fun originProjectVersionId(originProjectVersionId: Optional) = + originProjectVersionId(originProjectVersionId.getOrNull()) + + /** + * Sets [Builder.originProjectVersionId] to an arbitrary JSON value. + * + * You should usually call [Builder.originProjectVersionId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun originProjectVersionId(originProjectVersionId: JsonField) = apply { + this.originProjectVersionId = originProjectVersionId + } + + /** The test subtype. */ + fun subtype(subtype: String) = subtype(JsonField.of(subtype)) + + /** + * Sets [Builder.subtype] to an arbitrary JSON value. + * + * You should usually call [Builder.subtype] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun subtype(subtype: JsonField) = apply { this.subtype = subtype } + + /** Whether the test is suggested or user-created. */ + fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) + + /** + * Sets [Builder.suggested] to an arbitrary JSON value. + * + * You should usually call [Builder.suggested] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun suggested(suggested: JsonField) = apply { this.suggested = suggested } + + fun thresholds(thresholds: List) = thresholds(JsonField.of(thresholds)) + + /** + * Sets [Builder.thresholds] to an arbitrary JSON value. + * + * You should usually call [Builder.thresholds] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun thresholds(thresholds: JsonField>) = apply { + this.thresholds = thresholds.map { it.toMutableList() } + } + + /** + * Adds a single [Threshold] to [thresholds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addThreshold(threshold: Threshold) = apply { + thresholds = + (thresholds ?: JsonField.of(mutableListOf())).also { + checkKnown("thresholds", it).add(threshold) + } + } + + /** The test type. */ + fun type(type: String) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** Whether the test is archived. */ + fun archived(archived: Boolean) = archived(JsonField.of(archived)) + + /** + * Sets [Builder.archived] to an arbitrary JSON value. + * + * You should usually call [Builder.archived] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun archived(archived: JsonField) = apply { this.archived = archived } + + /** The delay window in seconds. Only applies to tests that use production data. */ + fun delayWindow(delayWindow: Double?) = delayWindow(JsonField.ofNullable(delayWindow)) + + /** + * Alias for [Builder.delayWindow]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun delayWindow(delayWindow: Double) = delayWindow(delayWindow as Double?) + + /** Alias for calling [Builder.delayWindow] with `delayWindow.orElse(null)`. */ + fun delayWindow(delayWindow: Optional) = delayWindow(delayWindow.getOrNull()) + + /** + * Sets [Builder.delayWindow] to an arbitrary JSON value. + * + * You should usually call [Builder.delayWindow] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun delayWindow(delayWindow: JsonField) = apply { this.delayWindow = delayWindow } + + /** The evaluation window in seconds. Only applies to tests that use production data. */ + fun evaluationWindow(evaluationWindow: Double?) = + evaluationWindow(JsonField.ofNullable(evaluationWindow)) + + /** + * Alias for [Builder.evaluationWindow]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun evaluationWindow(evaluationWindow: Double) = + evaluationWindow(evaluationWindow as Double?) + + /** Alias for calling [Builder.evaluationWindow] with `evaluationWindow.orElse(null)`. */ + fun evaluationWindow(evaluationWindow: Optional) = + evaluationWindow(evaluationWindow.getOrNull()) + + /** + * Sets [Builder.evaluationWindow] to an arbitrary JSON value. + * + * You should usually call [Builder.evaluationWindow] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun evaluationWindow(evaluationWindow: JsonField) = apply { + this.evaluationWindow = evaluationWindow + } + + /** Whether the test uses an ML model. */ + fun usesMlModel(usesMlModel: Boolean) = usesMlModel(JsonField.of(usesMlModel)) + + /** + * Sets [Builder.usesMlModel] to an arbitrary JSON value. + * + * You should usually call [Builder.usesMlModel] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun usesMlModel(usesMlModel: JsonField) = apply { this.usesMlModel = usesMlModel } + + /** Whether the test uses production data (monitoring mode only). */ + fun usesProductionData(usesProductionData: Boolean) = + usesProductionData(JsonField.of(usesProductionData)) + + /** + * Sets [Builder.usesProductionData] to an arbitrary JSON value. + * + * You should usually call [Builder.usesProductionData] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun usesProductionData(usesProductionData: JsonField) = apply { + this.usesProductionData = usesProductionData + } + + /** Whether the test uses a reference dataset (monitoring mode only). */ + fun usesReferenceDataset(usesReferenceDataset: Boolean) = + usesReferenceDataset(JsonField.of(usesReferenceDataset)) + + /** + * Sets [Builder.usesReferenceDataset] to an arbitrary JSON value. + * + * You should usually call [Builder.usesReferenceDataset] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun usesReferenceDataset(usesReferenceDataset: JsonField) = apply { + this.usesReferenceDataset = usesReferenceDataset + } + + /** Whether the test uses a training dataset. */ + fun usesTrainingDataset(usesTrainingDataset: Boolean) = + usesTrainingDataset(JsonField.of(usesTrainingDataset)) + + /** + * Sets [Builder.usesTrainingDataset] to an arbitrary JSON value. + * + * You should usually call [Builder.usesTrainingDataset] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun usesTrainingDataset(usesTrainingDataset: JsonField) = apply { + this.usesTrainingDataset = usesTrainingDataset + } + + /** Whether the test uses a validation dataset. */ + fun usesValidationDataset(usesValidationDataset: Boolean) = + usesValidationDataset(JsonField.of(usesValidationDataset)) + + /** + * Sets [Builder.usesValidationDataset] to an arbitrary JSON value. + * + * You should usually call [Builder.usesValidationDataset] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun usesValidationDataset(usesValidationDataset: JsonField) = apply { + this.usesValidationDataset = usesValidationDataset + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [TestCreateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .commentCount() + * .creatorId() + * .dateArchived() + * .dateCreated() + * .dateUpdated() + * .description() + * .name() + * .number() + * .originProjectVersionId() + * .subtype() + * .suggested() + * .thresholds() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TestCreateResponse = + TestCreateResponse( + checkRequired("id", id), + checkRequired("commentCount", commentCount), + checkRequired("creatorId", creatorId), + checkRequired("dateArchived", dateArchived), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("description", description), + checkRequired("name", name), + checkRequired("number", number), + checkRequired("originProjectVersionId", originProjectVersionId), + checkRequired("subtype", subtype), + checkRequired("suggested", suggested), + checkRequired("thresholds", thresholds).map { it.toImmutable() }, + checkRequired("type", type), + archived, + delayWindow, + evaluationWindow, + usesMlModel, + usesProductionData, + usesReferenceDataset, + usesTrainingDataset, + usesValidationDataset, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): TestCreateResponse = apply { + if (validated) { + return@apply + } + + id() + commentCount() + creatorId() + dateArchived() + dateCreated() + dateUpdated() + name() + number() + originProjectVersionId() + subtype() + suggested() + thresholds().forEach { it.validate() } + type() + archived() + delayWindow() + evaluationWindow() + usesMlModel() + usesProductionData() + usesReferenceDataset() + usesTrainingDataset() + usesValidationDataset() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (commentCount.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateArchived.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (number.asKnown().isPresent) 1 else 0) + + (if (originProjectVersionId.asKnown().isPresent) 1 else 0) + + (if (subtype.asKnown().isPresent) 1 else 0) + + (if (suggested.asKnown().isPresent) 1 else 0) + + (thresholds.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (type.asKnown().isPresent) 1 else 0) + + (if (archived.asKnown().isPresent) 1 else 0) + + (if (delayWindow.asKnown().isPresent) 1 else 0) + + (if (evaluationWindow.asKnown().isPresent) 1 else 0) + + (if (usesMlModel.asKnown().isPresent) 1 else 0) + + (if (usesProductionData.asKnown().isPresent) 1 else 0) + + (if (usesReferenceDataset.asKnown().isPresent) 1 else 0) + + (if (usesTrainingDataset.asKnown().isPresent) 1 else 0) + + (if (usesValidationDataset.asKnown().isPresent) 1 else 0) + + class Threshold + private constructor( + private val insightName: JsonField, + private val insightParameters: JsonField>, + private val measurement: JsonField, + private val operator: JsonField, + private val thresholdMode: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("insightName") + @ExcludeMissing + insightName: JsonField = JsonMissing.of(), + @JsonProperty("insightParameters") + @ExcludeMissing + insightParameters: JsonField> = JsonMissing.of(), + @JsonProperty("measurement") + @ExcludeMissing + measurement: JsonField = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + operator: JsonField = JsonMissing.of(), + @JsonProperty("thresholdMode") + @ExcludeMissing + thresholdMode: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + ) : this( + insightName, + insightParameters, + measurement, + operator, + thresholdMode, + value, + mutableMapOf(), + ) + + /** + * The insight name to be evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun insightName(): Optional = insightName.getOptional("insightName") + + /** + * The insight parameters. Required only for some test subtypes. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun insightParameters(): Optional> = + insightParameters.getOptional("insightParameters") + + /** + * The measurement to be evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun measurement(): Optional = measurement.getOptional("measurement") + + /** + * The operator to be used for the evaluation. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun operator(): Optional = operator.getOptional("operator") + + /** + * Whether to use automatic anomaly detection or manual thresholds + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun thresholdMode(): Optional = thresholdMode.getOptional("thresholdMode") + + /** + * The value to be compared. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun value(): Optional = value.getOptional("value") + + /** + * Returns the raw JSON value of [insightName]. + * + * Unlike [insightName], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("insightName") + @ExcludeMissing + fun _insightName(): JsonField = insightName + + /** + * Returns the raw JSON value of [insightParameters]. + * + * Unlike [insightParameters], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("insightParameters") + @ExcludeMissing + fun _insightParameters(): JsonField> = insightParameters + + /** + * Returns the raw JSON value of [measurement]. + * + * Unlike [measurement], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("measurement") + @ExcludeMissing + fun _measurement(): JsonField = measurement + + /** + * Returns the raw JSON value of [operator]. + * + * Unlike [operator], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("operator") @ExcludeMissing fun _operator(): JsonField = operator + + /** + * Returns the raw JSON value of [thresholdMode]. + * + * Unlike [thresholdMode], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("thresholdMode") + @ExcludeMissing + fun _thresholdMode(): JsonField = thresholdMode + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Threshold]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Threshold]. */ + class Builder internal constructor() { + + private var insightName: JsonField = JsonMissing.of() + private var insightParameters: JsonField>? = null + private var measurement: JsonField = JsonMissing.of() + private var operator: JsonField = JsonMissing.of() + private var thresholdMode: JsonField = JsonMissing.of() + private var value: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(threshold: Threshold) = apply { + insightName = threshold.insightName + insightParameters = threshold.insightParameters.map { it.toMutableList() } + measurement = threshold.measurement + operator = threshold.operator + thresholdMode = threshold.thresholdMode + value = threshold.value + additionalProperties = threshold.additionalProperties.toMutableMap() + } + + /** The insight name to be evaluated. */ + fun insightName(insightName: String) = insightName(JsonField.of(insightName)) + + /** + * Sets [Builder.insightName] to an arbitrary JSON value. + * + * You should usually call [Builder.insightName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun insightName(insightName: JsonField) = apply { + this.insightName = insightName + } + + /** The insight parameters. Required only for some test subtypes. */ + fun insightParameters(insightParameters: List?) = + insightParameters(JsonField.ofNullable(insightParameters)) + + /** + * Alias for calling [Builder.insightParameters] with `insightParameters.orElse(null)`. + */ + fun insightParameters(insightParameters: Optional>) = + insightParameters(insightParameters.getOrNull()) + + /** + * Sets [Builder.insightParameters] to an arbitrary JSON value. + * + * You should usually call [Builder.insightParameters] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun insightParameters(insightParameters: JsonField>) = apply { + this.insightParameters = insightParameters.map { it.toMutableList() } + } + + /** + * Adds a single [InsightParameter] to [insightParameters]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addInsightParameter(insightParameter: InsightParameter) = apply { + insightParameters = + (insightParameters ?: JsonField.of(mutableListOf())).also { + checkKnown("insightParameters", it).add(insightParameter) + } + } + + /** The measurement to be evaluated. */ + fun measurement(measurement: String) = measurement(JsonField.of(measurement)) + + /** + * Sets [Builder.measurement] to an arbitrary JSON value. + * + * You should usually call [Builder.measurement] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun measurement(measurement: JsonField) = apply { + this.measurement = measurement + } + + /** The operator to be used for the evaluation. */ + fun operator(operator: Operator) = operator(JsonField.of(operator)) + + /** + * Sets [Builder.operator] to an arbitrary JSON value. + * + * You should usually call [Builder.operator] with a well-typed [Operator] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun operator(operator: JsonField) = apply { this.operator = operator } + + /** Whether to use automatic anomaly detection or manual thresholds */ + fun thresholdMode(thresholdMode: ThresholdMode) = + thresholdMode(JsonField.of(thresholdMode)) + + /** + * Sets [Builder.thresholdMode] to an arbitrary JSON value. + * + * You should usually call [Builder.thresholdMode] with a well-typed [ThresholdMode] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun thresholdMode(thresholdMode: JsonField) = apply { + this.thresholdMode = thresholdMode + } + + /** The value to be compared. */ + fun value(value: Value) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [Value] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun value(value: JsonField) = apply { this.value = value } + + /** Alias for calling [value] with `Value.ofNumber(number)`. */ + fun value(number: Double) = value(Value.ofNumber(number)) + + /** Alias for calling [value] with `Value.ofBool(bool)`. */ + fun value(bool: Boolean) = value(Value.ofBool(bool)) + + /** Alias for calling [value] with `Value.ofString(string)`. */ + fun value(string: String) = value(Value.ofString(string)) + + /** Alias for calling [value] with `Value.ofStrings(strings)`. */ + fun valueOfStrings(strings: List) = value(Value.ofStrings(strings)) + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Threshold]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Threshold = + Threshold( + insightName, + (insightParameters ?: JsonMissing.of()).map { it.toImmutable() }, + measurement, + operator, + thresholdMode, + value, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Threshold = apply { + if (validated) { + return@apply + } + + insightName() + insightParameters().ifPresent { it.forEach { it.validate() } } + measurement() + operator().ifPresent { it.validate() } + thresholdMode().ifPresent { it.validate() } + value().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (insightName.asKnown().isPresent) 1 else 0) + + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (measurement.asKnown().isPresent) 1 else 0) + + (operator.asKnown().getOrNull()?.validity() ?: 0) + + (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + + (value.asKnown().getOrNull()?.validity() ?: 0) + + class InsightParameter + private constructor( + private val name: JsonField, + private val value: JsonValue, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonValue = JsonMissing.of(), + ) : this(name, value, mutableMapOf()) + + /** + * The name of the insight filter. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun name(): String = name.getRequired("name") + + @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [InsightParameter]. + * + * The following fields are required: + * ```java + * .name() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InsightParameter]. */ + class Builder internal constructor() { + + private var name: JsonField? = null + private var value: JsonValue? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(insightParameter: InsightParameter) = apply { + name = insightParameter.name + value = insightParameter.value + additionalProperties = insightParameter.additionalProperties.toMutableMap() + } + + /** The name of the insight filter. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun value(value: JsonValue) = apply { this.value = value } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [InsightParameter]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .name() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): InsightParameter = + InsightParameter( + checkRequired("name", name), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): InsightParameter = apply { + if (validated) { + return@apply + } + + name() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (name.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InsightParameter && name == other.name && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(name, value, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InsightParameter{name=$name, value=$value, additionalProperties=$additionalProperties}" + } + + /** The operator to be used for the evaluation. */ + class Operator @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val IS = of("is") + + @JvmField val GREATER = of(">") + + @JvmField val GREATER_OR_EQUALS = of(">=") + + @JvmField val LESS = of("<") + + @JvmField val LESS_OR_EQUALS = of("<=") + + @JvmField val NOT_EQUALS = of("!=") + + @JvmStatic fun of(value: String) = Operator(JsonField.of(value)) + } + + /** An enum containing [Operator]'s known values. */ + enum class Known { + IS, + GREATER, + GREATER_OR_EQUALS, + LESS, + LESS_OR_EQUALS, + NOT_EQUALS, + } + + /** + * An enum containing [Operator]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Operator] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + IS, + GREATER, + GREATER_OR_EQUALS, + LESS, + LESS_OR_EQUALS, + NOT_EQUALS, + /** + * An enum member indicating that [Operator] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + IS -> Value.IS + GREATER -> Value.GREATER + GREATER_OR_EQUALS -> Value.GREATER_OR_EQUALS + LESS -> Value.LESS + LESS_OR_EQUALS -> Value.LESS_OR_EQUALS + NOT_EQUALS -> Value.NOT_EQUALS + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + IS -> Known.IS + GREATER -> Known.GREATER + GREATER_OR_EQUALS -> Known.GREATER_OR_EQUALS + LESS -> Known.LESS + LESS_OR_EQUALS -> Known.LESS_OR_EQUALS + NOT_EQUALS -> Known.NOT_EQUALS + else -> throw OpenlayerInvalidDataException("Unknown Operator: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Operator = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Operator && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Whether to use automatic anomaly detection or manual thresholds */ + class ThresholdMode @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val AUTOMATIC = of("automatic") + + @JvmField val MANUAL = of("manual") + + @JvmStatic fun of(value: String) = ThresholdMode(JsonField.of(value)) + } + + /** An enum containing [ThresholdMode]'s known values. */ + enum class Known { + AUTOMATIC, + MANUAL, + } + + /** + * An enum containing [ThresholdMode]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [ThresholdMode] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + AUTOMATIC, + MANUAL, + /** + * An enum member indicating that [ThresholdMode] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + AUTOMATIC -> Value.AUTOMATIC + MANUAL -> Value.MANUAL + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + AUTOMATIC -> Known.AUTOMATIC + MANUAL -> Known.MANUAL + else -> throw OpenlayerInvalidDataException("Unknown ThresholdMode: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): ThresholdMode = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ThresholdMode && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The value to be compared. */ + @JsonDeserialize(using = Value.Deserializer::class) + @JsonSerialize(using = Value.Serializer::class) + class Value + private constructor( + private val number: Double? = null, + private val bool: Boolean? = null, + private val string: String? = null, + private val strings: List? = null, + private val _json: JsonValue? = null, + ) { + + fun number(): Optional = Optional.ofNullable(number) + + fun bool(): Optional = Optional.ofNullable(bool) + + fun string(): Optional = Optional.ofNullable(string) + + fun strings(): Optional> = Optional.ofNullable(strings) + + fun isNumber(): Boolean = number != null + + fun isBool(): Boolean = bool != null + + fun isString(): Boolean = string != null + + fun isStrings(): Boolean = strings != null + + fun asNumber(): Double = number.getOrThrow("number") + + fun asBool(): Boolean = bool.getOrThrow("bool") + + fun asString(): String = string.getOrThrow("string") + + fun asStrings(): List = strings.getOrThrow("strings") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T = + when { + number != null -> visitor.visitNumber(number) + bool != null -> visitor.visitBool(bool) + string != null -> visitor.visitString(string) + strings != null -> visitor.visitStrings(strings) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + fun validate(): Value = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitNumber(number: Double) {} + + override fun visitBool(bool: Boolean) {} + + override fun visitString(string: String) {} + + override fun visitStrings(strings: List) {} + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitNumber(number: Double) = 1 + + override fun visitBool(bool: Boolean) = 1 + + override fun visitString(string: String) = 1 + + override fun visitStrings(strings: List) = strings.size + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Value && number == other.number && bool == other.bool && string == other.string && strings == other.strings /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(number, bool, string, strings) /* spotless:on */ + + override fun toString(): String = + when { + number != null -> "Value{number=$number}" + bool != null -> "Value{bool=$bool}" + string != null -> "Value{string=$string}" + strings != null -> "Value{strings=$strings}" + _json != null -> "Value{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Value") + } + + companion object { + + @JvmStatic fun ofNumber(number: Double) = Value(number = number) + + @JvmStatic fun ofBool(bool: Boolean) = Value(bool = bool) + + @JvmStatic fun ofString(string: String) = Value(string = string) + + @JvmStatic fun ofStrings(strings: List) = Value(strings = strings) + } + + /** + * An interface that defines how to map each variant of [Value] to a value of type [T]. + */ + interface Visitor { + + fun visitNumber(number: Double): T + + fun visitBool(bool: Boolean): T + + fun visitString(string: String): T + + fun visitStrings(strings: List): T + + /** + * Maps an unknown variant of [Value] to a value of type [T]. + * + * An instance of [Value] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws OpenlayerInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw OpenlayerInvalidDataException("Unknown Value: $json") + } + } + + internal class Deserializer : BaseDeserializer(Value::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Value { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef())?.let { + Value(number = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Value(bool = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Value(string = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef>())?.let { + Value(strings = it, _json = json) + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely incompatible + // with all the possible variants (e.g. deserializing from object). + 0 -> Value(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then use the + // first completely valid match, or simply the first match if none are + // completely valid. + else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + } + } + } + + internal class Serializer : BaseSerializer(Value::class) { + + override fun serialize( + value: Value, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.number != null -> generator.writeObject(value.number) + value.bool != null -> generator.writeObject(value.bool) + value.string != null -> generator.writeObject(value.string) + value.strings != null -> generator.writeObject(value.strings) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Value") + } + } + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Threshold && insightName == other.insightName && insightParameters == other.insightParameters && measurement == other.measurement && operator == other.operator && thresholdMode == other.thresholdMode && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(insightName, insightParameters, measurement, operator, thresholdMode, value, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Threshold{insightName=$insightName, insightParameters=$insightParameters, measurement=$measurement, operator=$operator, thresholdMode=$thresholdMode, value=$value, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TestCreateResponse && id == other.id && commentCount == other.commentCount && creatorId == other.creatorId && dateArchived == other.dateArchived && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && description == other.description && name == other.name && number == other.number && originProjectVersionId == other.originProjectVersionId && subtype == other.subtype && suggested == other.suggested && thresholds == other.thresholds && type == other.type && archived == other.archived && delayWindow == other.delayWindow && evaluationWindow == other.evaluationWindow && usesMlModel == other.usesMlModel && usesProductionData == other.usesProductionData && usesReferenceDataset == other.usesReferenceDataset && usesTrainingDataset == other.usesTrainingDataset && usesValidationDataset == other.usesValidationDataset && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, commentCount, creatorId, dateArchived, dateCreated, dateUpdated, description, name, number, originProjectVersionId, subtype, suggested, thresholds, type, archived, delayWindow, evaluationWindow, usesMlModel, usesProductionData, usesReferenceDataset, usesTrainingDataset, usesValidationDataset, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TestCreateResponse{id=$id, commentCount=$commentCount, creatorId=$creatorId, dateArchived=$dateArchived, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, name=$name, number=$number, originProjectVersionId=$originProjectVersionId, subtype=$subtype, suggested=$suggested, thresholds=$thresholds, type=$type, archived=$archived, delayWindow=$delayWindow, evaluationWindow=$evaluationWindow, usesMlModel=$usesMlModel, usesProductionData=$usesProductionData, usesReferenceDataset=$usesReferenceDataset, usesTrainingDataset=$usesTrainingDataset, usesValidationDataset=$usesValidationDataset, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt index 8c47db0d..f2f4ccc9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt @@ -11,6 +11,7 @@ import com.openlayer.api.models.projects.ProjectListParams import com.openlayer.api.models.projects.ProjectListResponse import com.openlayer.api.services.async.projects.CommitServiceAsync import com.openlayer.api.services.async.projects.InferencePipelineServiceAsync +import com.openlayer.api.services.async.projects.TestServiceAsync import java.util.concurrent.CompletableFuture interface ProjectServiceAsync { @@ -24,6 +25,8 @@ interface ProjectServiceAsync { fun inferencePipelines(): InferencePipelineServiceAsync + fun tests(): TestServiceAsync + /** Create a project in your workspace. */ fun create(params: ProjectCreateParams): CompletableFuture = create(params, RequestOptions.none()) @@ -61,6 +64,8 @@ interface ProjectServiceAsync { fun inferencePipelines(): InferencePipelineServiceAsync.WithRawResponse + fun tests(): TestServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `post /projects`, but is otherwise the same as * [ProjectServiceAsync.create]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt index 33b9d711..61423d06 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt @@ -23,6 +23,8 @@ import com.openlayer.api.services.async.projects.CommitServiceAsync import com.openlayer.api.services.async.projects.CommitServiceAsyncImpl import com.openlayer.api.services.async.projects.InferencePipelineServiceAsync import com.openlayer.api.services.async.projects.InferencePipelineServiceAsyncImpl +import com.openlayer.api.services.async.projects.TestServiceAsync +import com.openlayer.api.services.async.projects.TestServiceAsyncImpl import java.util.concurrent.CompletableFuture class ProjectServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -38,12 +40,16 @@ class ProjectServiceAsyncImpl internal constructor(private val clientOptions: Cl InferencePipelineServiceAsyncImpl(clientOptions) } + private val tests: TestServiceAsync by lazy { TestServiceAsyncImpl(clientOptions) } + override fun withRawResponse(): ProjectServiceAsync.WithRawResponse = withRawResponse override fun commits(): CommitServiceAsync = commits override fun inferencePipelines(): InferencePipelineServiceAsync = inferencePipelines + override fun tests(): TestServiceAsync = tests + override fun create( params: ProjectCreateParams, requestOptions: RequestOptions, @@ -71,11 +77,17 @@ class ProjectServiceAsyncImpl internal constructor(private val clientOptions: Cl InferencePipelineServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + private val tests: TestServiceAsync.WithRawResponse by lazy { + TestServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + override fun commits(): CommitServiceAsync.WithRawResponse = commits override fun inferencePipelines(): InferencePipelineServiceAsync.WithRawResponse = inferencePipelines + override fun tests(): TestServiceAsync.WithRawResponse = tests + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsync.kt new file mode 100644 index 00000000..7a18e5bd --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsync.kt @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.projects + +import com.google.errorprone.annotations.MustBeClosed +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.projects.tests.TestCreateParams +import com.openlayer.api.models.projects.tests.TestCreateResponse +import java.util.concurrent.CompletableFuture + +interface TestServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** Create a test. */ + fun create(params: TestCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** @see [create] */ + fun create( + params: TestCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** A view of [TestServiceAsync] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /projects/{projectId}/tests`, but is otherwise the + * same as [TestServiceAsync.create]. + */ + @MustBeClosed + fun create( + params: TestCreateParams + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see [create] */ + @MustBeClosed + fun create( + params: TestCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncImpl.kt new file mode 100644 index 00000000..c1203bfb --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncImpl.kt @@ -0,0 +1,73 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.projects + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepareAsync +import com.openlayer.api.models.projects.tests.TestCreateParams +import com.openlayer.api.models.projects.tests.TestCreateResponse +import java.util.concurrent.CompletableFuture + +class TestServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + TestServiceAsync { + + private val withRawResponse: TestServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): TestServiceAsync.WithRawResponse = withRawResponse + + override fun create( + params: TestCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /projects/{projectId}/tests + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + TestServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun create( + params: TestCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects", params._pathParam(0), "tests") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt index e88bd15b..bf76d3b3 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt @@ -11,6 +11,7 @@ import com.openlayer.api.models.projects.ProjectListParams import com.openlayer.api.models.projects.ProjectListResponse import com.openlayer.api.services.blocking.projects.CommitService import com.openlayer.api.services.blocking.projects.InferencePipelineService +import com.openlayer.api.services.blocking.projects.TestService interface ProjectService { @@ -23,6 +24,8 @@ interface ProjectService { fun inferencePipelines(): InferencePipelineService + fun tests(): TestService + /** Create a project in your workspace. */ fun create(params: ProjectCreateParams): ProjectCreateResponse = create(params, RequestOptions.none()) @@ -57,6 +60,8 @@ interface ProjectService { fun inferencePipelines(): InferencePipelineService.WithRawResponse + fun tests(): TestService.WithRawResponse + /** * Returns a raw HTTP response for `post /projects`, but is otherwise the same as * [ProjectService.create]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt index 354e63f8..870c6c0c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt @@ -23,6 +23,8 @@ import com.openlayer.api.services.blocking.projects.CommitService import com.openlayer.api.services.blocking.projects.CommitServiceImpl import com.openlayer.api.services.blocking.projects.InferencePipelineService import com.openlayer.api.services.blocking.projects.InferencePipelineServiceImpl +import com.openlayer.api.services.blocking.projects.TestService +import com.openlayer.api.services.blocking.projects.TestServiceImpl class ProjectServiceImpl internal constructor(private val clientOptions: ClientOptions) : ProjectService { @@ -37,12 +39,16 @@ class ProjectServiceImpl internal constructor(private val clientOptions: ClientO InferencePipelineServiceImpl(clientOptions) } + private val tests: TestService by lazy { TestServiceImpl(clientOptions) } + override fun withRawResponse(): ProjectService.WithRawResponse = withRawResponse override fun commits(): CommitService = commits override fun inferencePipelines(): InferencePipelineService = inferencePipelines + override fun tests(): TestService = tests + override fun create( params: ProjectCreateParams, requestOptions: RequestOptions, @@ -70,11 +76,17 @@ class ProjectServiceImpl internal constructor(private val clientOptions: ClientO InferencePipelineServiceImpl.WithRawResponseImpl(clientOptions) } + private val tests: TestService.WithRawResponse by lazy { + TestServiceImpl.WithRawResponseImpl(clientOptions) + } + override fun commits(): CommitService.WithRawResponse = commits override fun inferencePipelines(): InferencePipelineService.WithRawResponse = inferencePipelines + override fun tests(): TestService.WithRawResponse = tests + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestService.kt new file mode 100644 index 00000000..2b1c881c --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestService.kt @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.projects + +import com.google.errorprone.annotations.MustBeClosed +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.projects.tests.TestCreateParams +import com.openlayer.api.models.projects.tests.TestCreateResponse + +interface TestService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** Create a test. */ + fun create(params: TestCreateParams): TestCreateResponse = create(params, RequestOptions.none()) + + /** @see [create] */ + fun create( + params: TestCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): TestCreateResponse + + /** A view of [TestService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /projects/{projectId}/tests`, but is otherwise the + * same as [TestService.create]. + */ + @MustBeClosed + fun create(params: TestCreateParams): HttpResponseFor = + create(params, RequestOptions.none()) + + /** @see [create] */ + @MustBeClosed + fun create( + params: TestCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestServiceImpl.kt new file mode 100644 index 00000000..16b09e4c --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestServiceImpl.kt @@ -0,0 +1,68 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.projects + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepare +import com.openlayer.api.models.projects.tests.TestCreateParams +import com.openlayer.api.models.projects.tests.TestCreateResponse + +class TestServiceImpl internal constructor(private val clientOptions: ClientOptions) : TestService { + + private val withRawResponse: TestService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): TestService.WithRawResponse = withRawResponse + + override fun create( + params: TestCreateParams, + requestOptions: RequestOptions, + ): TestCreateResponse = + // post /projects/{projectId}/tests + withRawResponse().create(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + TestService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun create( + params: TestCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects", params._pathParam(0), "tests") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt new file mode 100644 index 00000000..5d9bb00c --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt @@ -0,0 +1,205 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.projects.tests + +import com.openlayer.api.core.JsonValue +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class TestCreateParamsTest { + + @Test + fun create() { + TestCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(0L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description(JsonValue.from("This test checks for duplicate rows in the dataset.")) + .name("No duplicate rows") + .number(1L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(false) + .addThreshold( + TestCreateParams.Threshold.builder() + .insightName("duplicateRowCount") + .addInsightParameter( + TestCreateParams.Threshold.InsightParameter.builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) + .measurement("duplicateRowCount") + .operator(TestCreateParams.Threshold.Operator.LESS_OR_EQUALS) + .thresholdMode(TestCreateParams.Threshold.ThresholdMode.AUTOMATIC) + .value(0.0) + .build() + ) + .type("integrity") + .archived(false) + .delayWindow(0.0) + .evaluationWindow(3600.0) + .usesMlModel(false) + .usesProductionData(false) + .usesReferenceDataset(false) + .usesTrainingDataset(false) + .usesValidationDataset(true) + .build() + } + + @Test + fun pathParams() { + val params = + TestCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(0L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description(JsonValue.from("This test checks for duplicate rows in the dataset.")) + .name("No duplicate rows") + .number(1L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(false) + .addThreshold(TestCreateParams.Threshold.builder().build()) + .type("integrity") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun body() { + val params = + TestCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(0L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description(JsonValue.from("This test checks for duplicate rows in the dataset.")) + .name("No duplicate rows") + .number(1L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(false) + .addThreshold( + TestCreateParams.Threshold.builder() + .insightName("duplicateRowCount") + .addInsightParameter( + TestCreateParams.Threshold.InsightParameter.builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) + .measurement("duplicateRowCount") + .operator(TestCreateParams.Threshold.Operator.LESS_OR_EQUALS) + .thresholdMode(TestCreateParams.Threshold.ThresholdMode.AUTOMATIC) + .value(0.0) + .build() + ) + .type("integrity") + .archived(false) + .delayWindow(0.0) + .evaluationWindow(3600.0) + .usesMlModel(false) + .usesProductionData(false) + .usesReferenceDataset(false) + .usesTrainingDataset(false) + .usesValidationDataset(true) + .build() + + val body = params._body() + + assertThat(body.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.commentCount()).isEqualTo(0L) + assertThat(body.creatorId()).contains("589ece63-49a2-41b4-98e1-10547761d4b0") + assertThat(body.dateArchived()).contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.dateCreated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.dateUpdated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body._description()) + .isEqualTo(JsonValue.from("This test checks for duplicate rows in the dataset.")) + assertThat(body.name()).isEqualTo("No duplicate rows") + assertThat(body.number()).isEqualTo(1L) + assertThat(body.originProjectVersionId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.subtype()).isEqualTo("duplicateRowCount") + assertThat(body.suggested()).isEqualTo(false) + assertThat(body.thresholds()) + .containsExactly( + TestCreateParams.Threshold.builder() + .insightName("duplicateRowCount") + .addInsightParameter( + TestCreateParams.Threshold.InsightParameter.builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) + .measurement("duplicateRowCount") + .operator(TestCreateParams.Threshold.Operator.LESS_OR_EQUALS) + .thresholdMode(TestCreateParams.Threshold.ThresholdMode.AUTOMATIC) + .value(0.0) + .build() + ) + assertThat(body.type()).isEqualTo("integrity") + assertThat(body.archived()).contains(false) + assertThat(body.delayWindow()).contains(0.0) + assertThat(body.evaluationWindow()).contains(3600.0) + assertThat(body.usesMlModel()).contains(false) + assertThat(body.usesProductionData()).contains(false) + assertThat(body.usesReferenceDataset()).contains(false) + assertThat(body.usesTrainingDataset()).contains(false) + assertThat(body.usesValidationDataset()).contains(true) + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + TestCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(0L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description(JsonValue.from("This test checks for duplicate rows in the dataset.")) + .name("No duplicate rows") + .number(1L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(false) + .addThreshold(TestCreateParams.Threshold.builder().build()) + .type("integrity") + .build() + + val body = params._body() + + assertThat(body.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.commentCount()).isEqualTo(0L) + assertThat(body.creatorId()).contains("589ece63-49a2-41b4-98e1-10547761d4b0") + assertThat(body.dateArchived()).contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.dateCreated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body.dateUpdated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(body._description()) + .isEqualTo(JsonValue.from("This test checks for duplicate rows in the dataset.")) + assertThat(body.name()).isEqualTo("No duplicate rows") + assertThat(body.number()).isEqualTo(1L) + assertThat(body.originProjectVersionId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(body.subtype()).isEqualTo("duplicateRowCount") + assertThat(body.suggested()).isEqualTo(false) + assertThat(body.thresholds()).containsExactly(TestCreateParams.Threshold.builder().build()) + assertThat(body.type()).isEqualTo("integrity") + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt new file mode 100644 index 00000000..9e855f75 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt @@ -0,0 +1,151 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.projects.tests + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class TestCreateResponseTest { + + @Test + fun create() { + val testCreateResponse = + TestCreateResponse.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(0L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description(JsonValue.from("This test checks for duplicate rows in the dataset.")) + .name("No duplicate rows") + .number(1L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(false) + .addThreshold( + TestCreateResponse.Threshold.builder() + .insightName("duplicateRowCount") + .addInsightParameter( + TestCreateResponse.Threshold.InsightParameter.builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) + .measurement("duplicateRowCount") + .operator(TestCreateResponse.Threshold.Operator.LESS_OR_EQUALS) + .thresholdMode(TestCreateResponse.Threshold.ThresholdMode.AUTOMATIC) + .value(0.0) + .build() + ) + .type("integrity") + .archived(false) + .delayWindow(0.0) + .evaluationWindow(3600.0) + .usesMlModel(false) + .usesProductionData(false) + .usesReferenceDataset(false) + .usesTrainingDataset(false) + .usesValidationDataset(true) + .build() + + assertThat(testCreateResponse.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(testCreateResponse.commentCount()).isEqualTo(0L) + assertThat(testCreateResponse.creatorId()).contains("589ece63-49a2-41b4-98e1-10547761d4b0") + assertThat(testCreateResponse.dateArchived()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(testCreateResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(testCreateResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(testCreateResponse._description()) + .isEqualTo(JsonValue.from("This test checks for duplicate rows in the dataset.")) + assertThat(testCreateResponse.name()).isEqualTo("No duplicate rows") + assertThat(testCreateResponse.number()).isEqualTo(1L) + assertThat(testCreateResponse.originProjectVersionId()) + .contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(testCreateResponse.subtype()).isEqualTo("duplicateRowCount") + assertThat(testCreateResponse.suggested()).isEqualTo(false) + assertThat(testCreateResponse.thresholds()) + .containsExactly( + TestCreateResponse.Threshold.builder() + .insightName("duplicateRowCount") + .addInsightParameter( + TestCreateResponse.Threshold.InsightParameter.builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) + .measurement("duplicateRowCount") + .operator(TestCreateResponse.Threshold.Operator.LESS_OR_EQUALS) + .thresholdMode(TestCreateResponse.Threshold.ThresholdMode.AUTOMATIC) + .value(0.0) + .build() + ) + assertThat(testCreateResponse.type()).isEqualTo("integrity") + assertThat(testCreateResponse.archived()).contains(false) + assertThat(testCreateResponse.delayWindow()).contains(0.0) + assertThat(testCreateResponse.evaluationWindow()).contains(3600.0) + assertThat(testCreateResponse.usesMlModel()).contains(false) + assertThat(testCreateResponse.usesProductionData()).contains(false) + assertThat(testCreateResponse.usesReferenceDataset()).contains(false) + assertThat(testCreateResponse.usesTrainingDataset()).contains(false) + assertThat(testCreateResponse.usesValidationDataset()).contains(true) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val testCreateResponse = + TestCreateResponse.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(0L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description(JsonValue.from("This test checks for duplicate rows in the dataset.")) + .name("No duplicate rows") + .number(1L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(false) + .addThreshold( + TestCreateResponse.Threshold.builder() + .insightName("duplicateRowCount") + .addInsightParameter( + TestCreateResponse.Threshold.InsightParameter.builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) + .measurement("duplicateRowCount") + .operator(TestCreateResponse.Threshold.Operator.LESS_OR_EQUALS) + .thresholdMode(TestCreateResponse.Threshold.ThresholdMode.AUTOMATIC) + .value(0.0) + .build() + ) + .type("integrity") + .archived(false) + .delayWindow(0.0) + .evaluationWindow(3600.0) + .usesMlModel(false) + .usesProductionData(false) + .usesReferenceDataset(false) + .usesTrainingDataset(false) + .usesValidationDataset(true) + .build() + + val roundtrippedTestCreateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(testCreateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedTestCreateResponse).isEqualTo(testCreateResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt new file mode 100644 index 00000000..8ff6a6bb --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt @@ -0,0 +1,73 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.projects + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.projects.tests.TestCreateParams +import java.time.OffsetDateTime +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class TestServiceAsyncTest { + + @Test + fun create() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val testServiceAsync = client.projects().tests() + + val testFuture = + testServiceAsync.create( + TestCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(0L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description( + JsonValue.from("This test checks for duplicate rows in the dataset.") + ) + .name("No duplicate rows") + .number(1L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(false) + .addThreshold( + TestCreateParams.Threshold.builder() + .insightName("duplicateRowCount") + .addInsightParameter( + TestCreateParams.Threshold.InsightParameter.builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) + .measurement("duplicateRowCount") + .operator(TestCreateParams.Threshold.Operator.LESS_OR_EQUALS) + .thresholdMode(TestCreateParams.Threshold.ThresholdMode.AUTOMATIC) + .value(0.0) + .build() + ) + .type("integrity") + .archived(false) + .delayWindow(0.0) + .evaluationWindow(3600.0) + .usesMlModel(false) + .usesProductionData(false) + .usesReferenceDataset(false) + .usesTrainingDataset(false) + .usesValidationDataset(true) + .build() + ) + + val test = testFuture.get() + test.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt new file mode 100644 index 00000000..611b9c27 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.projects + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.projects.tests.TestCreateParams +import java.time.OffsetDateTime +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class TestServiceTest { + + @Test + fun create() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val testService = client.projects().tests() + + val test = + testService.create( + TestCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(0L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description( + JsonValue.from("This test checks for duplicate rows in the dataset.") + ) + .name("No duplicate rows") + .number(1L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(false) + .addThreshold( + TestCreateParams.Threshold.builder() + .insightName("duplicateRowCount") + .addInsightParameter( + TestCreateParams.Threshold.InsightParameter.builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) + .measurement("duplicateRowCount") + .operator(TestCreateParams.Threshold.Operator.LESS_OR_EQUALS) + .thresholdMode(TestCreateParams.Threshold.ThresholdMode.AUTOMATIC) + .value(0.0) + .build() + ) + .type("integrity") + .archived(false) + .delayWindow(0.0) + .evaluationWindow(3600.0) + .usesMlModel(false) + .usesProductionData(false) + .usesReferenceDataset(false) + .usesTrainingDataset(false) + .usesValidationDataset(true) + .build() + ) + + test.validate() + } +} From cdf29389f0d198ea0dca008e0f235bfbeec1327b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 03:21:22 +0000 Subject: [PATCH 59/74] chore(ci): add timeout thresholds for CI jobs --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f72394e3..56095a97 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,7 @@ on: jobs: lint: + timeout-minutes: 10 name: lint runs-on: ubuntu-latest steps: From caff21a6eabf0cc2386ebb707023a0bcbac0fd35 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 02:19:53 +0000 Subject: [PATCH 60/74] chore(internal): codegen related update --- .github/workflows/ci.yml | 15 ++++++++------- .github/workflows/publish-sonatype.yml | 2 +- .github/workflows/release-doctor.yml | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 56095a97..37976df6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,19 @@ name: CI on: push: - branches: - - main - pull_request: - branches: - - main - - next + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'stl-preview-head/**' + - 'stl-preview-base/**' jobs: lint: timeout-minutes: 10 name: lint - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 + steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index 1953ebeb..13a5f946 100644 --- a/.github/workflows/publish-sonatype.yml +++ b/.github/workflows/publish-sonatype.yml @@ -11,7 +11,7 @@ on: jobs: publish: name: publish - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index b4ed7fd0..4bc47c64 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -8,7 +8,7 @@ on: jobs: release_doctor: name: release doctor - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 if: github.repository == 'openlayer-ai/openlayer-java' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: From 2cb59ec3924c68c6d7faa97fbbbccd6d3489f3fd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 02:22:24 +0000 Subject: [PATCH 61/74] chore(ci): only use depot for staging repos --- .github/workflows/ci.yml | 2 +- .github/workflows/publish-sonatype.yml | 2 +- .github/workflows/release-doctor.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37976df6..3c70fa58 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: lint: timeout-minutes: 10 name: lint - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/openlayer-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index 13a5f946..1953ebeb 100644 --- a/.github/workflows/publish-sonatype.yml +++ b/.github/workflows/publish-sonatype.yml @@ -11,7 +11,7 @@ on: jobs: publish: name: publish - runs-on: depot-ubuntu-24.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 4bc47c64..b4ed7fd0 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -8,7 +8,7 @@ on: jobs: release_doctor: name: release doctor - runs-on: depot-ubuntu-24.04 + runs-on: ubuntu-latest if: github.repository == 'openlayer-ai/openlayer-java' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: From 7bcb837a326dc585fae7b88c8f104243d936b20a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 02:27:14 +0000 Subject: [PATCH 62/74] chore(internal): java 17 -> 21 on ci --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c70fa58..05a6cd25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: distribution: temurin java-version: | 8 - 17 + 21 cache: gradle - name: Set up Gradle From 15ccde0e54bfb2e0d0814e49112c11631f3a6a62 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 12:42:28 +0000 Subject: [PATCH 63/74] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 81ceaeb5..a9edd5d6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 16 -openapi_spec_hash: 7dd38774b534c352620bca63efa85b19 +openapi_spec_hash: a3b4490f36a68f474989d080a436fe81 config_hash: 0383360784fc87d799bad2be203142b5 From 7520d5383620fe785032f2e256a1ab6cd3b1a74c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 12:47:11 +0000 Subject: [PATCH 64/74] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index a9edd5d6..94b4f837 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 16 -openapi_spec_hash: a3b4490f36a68f474989d080a436fe81 +openapi_spec_hash: 7c835c55ec387350b647a302c48edb9d config_hash: 0383360784fc87d799bad2be203142b5 From 420f95c52275d20441bce4bca05420b4dfd9e4ad Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 21:07:28 +0000 Subject: [PATCH 65/74] feat(api): api update --- .stats.yml | 2 +- .../testresults/TestResultListParams.kt | 4 +- .../testresults/TestResultListResponse.kt | 544 ++++++++++++++++- .../testresults/TestResultListResponse.kt | 544 ++++++++++++++++- .../models/projects/tests/TestCreateParams.kt | 556 +++++++++++++++++- .../projects/tests/TestCreateResponse.kt | 536 ++++++++++++++++- .../testresults/TestResultListResponseTest.kt | 16 +- .../testresults/TestResultListResponseTest.kt | 16 +- .../projects/tests/TestCreateParamsTest.kt | 24 +- .../projects/tests/TestCreateResponseTest.kt | 13 +- .../async/projects/TestServiceAsyncTest.kt | 4 +- .../blocking/projects/TestServiceTest.kt | 4 +- 12 files changed, 2136 insertions(+), 127 deletions(-) diff --git a/.stats.yml b/.stats.yml index 94b4f837..00b73d5d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 16 -openapi_spec_hash: 7c835c55ec387350b647a302c48edb9d +openapi_spec_hash: 8827ead72aa0c635ccafac5e008fe247 config_hash: 0383360784fc87d799bad2be203142b5 diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt index e46cfa17..0d7a335c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt @@ -29,7 +29,7 @@ private constructor( fun projectVersionId(): String = projectVersionId - /** Include archived goals. */ + /** Filter for archived tests. */ fun includeArchived(): Optional = Optional.ofNullable(includeArchived) /** The page to return in a paginated query. */ @@ -97,7 +97,7 @@ private constructor( this.projectVersionId = projectVersionId } - /** Include archived goals. */ + /** Filter for archived tests. */ fun includeArchived(includeArchived: Boolean?) = apply { this.includeArchived = includeArchived } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt index aa76f97a..da5447fc 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt @@ -932,10 +932,10 @@ private constructor( private val name: JsonField, private val number: JsonField, private val originProjectVersionId: JsonField, - private val subtype: JsonField, + private val subtype: JsonField, private val suggested: JsonField, private val thresholds: JsonField>, - private val type: JsonField, + private val type: JsonField, private val archived: JsonField, private val delayWindow: JsonField, private val evaluationWindow: JsonField, @@ -975,14 +975,14 @@ private constructor( originProjectVersionId: JsonField = JsonMissing.of(), @JsonProperty("subtype") @ExcludeMissing - subtype: JsonField = JsonMissing.of(), + subtype: JsonField = JsonMissing.of(), @JsonProperty("suggested") @ExcludeMissing suggested: JsonField = JsonMissing.of(), @JsonProperty("thresholds") @ExcludeMissing thresholds: JsonField> = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), @JsonProperty("archived") @ExcludeMissing archived: JsonField = JsonMissing.of(), @@ -1122,7 +1122,7 @@ private constructor( * unexpectedly missing or null (e.g. if the server responded with an unexpected * value). */ - fun subtype(): String = subtype.getRequired("subtype") + fun subtype(): Subtype = subtype.getRequired("subtype") /** * Whether the test is suggested or user-created. @@ -1147,7 +1147,7 @@ private constructor( * unexpectedly missing or null (e.g. if the server responded with an unexpected * value). */ - fun type(): String = type.getRequired("type") + fun type(): Type = type.getRequired("type") /** * Whether the test is archived. @@ -1304,7 +1304,7 @@ private constructor( * * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype + @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype /** * Returns the raw JSON value of [suggested]. @@ -1331,7 +1331,7 @@ private constructor( * * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type /** * Returns the raw JSON value of [archived]. @@ -1462,10 +1462,10 @@ private constructor( private var name: JsonField? = null private var number: JsonField? = null private var originProjectVersionId: JsonField? = null - private var subtype: JsonField? = null + private var subtype: JsonField? = null private var suggested: JsonField? = null private var thresholds: JsonField>? = null - private var type: JsonField? = null + private var type: JsonField? = null private var archived: JsonField = JsonMissing.of() private var delayWindow: JsonField = JsonMissing.of() private var evaluationWindow: JsonField = JsonMissing.of() @@ -1643,16 +1643,16 @@ private constructor( } /** The test subtype. */ - fun subtype(subtype: String) = subtype(JsonField.of(subtype)) + fun subtype(subtype: Subtype) = subtype(JsonField.of(subtype)) /** * Sets [Builder.subtype] to an arbitrary JSON value. * - * You should usually call [Builder.subtype] with a well-typed [String] value + * You should usually call [Builder.subtype] with a well-typed [Subtype] value * instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun subtype(subtype: JsonField) = apply { this.subtype = subtype } + fun subtype(subtype: JsonField) = apply { this.subtype = subtype } /** Whether the test is suggested or user-created. */ fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) @@ -1692,16 +1692,16 @@ private constructor( } /** The test type. */ - fun type(type: String) = type(JsonField.of(type)) + fun type(type: Type) = type(JsonField.of(type)) /** * Sets [Builder.type] to an arbitrary JSON value. * - * You should usually call [Builder.type] with a well-typed [String] value instead. + * You should usually call [Builder.type] with a well-typed [Type] value instead. * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun type(type: JsonField) = apply { this.type = type } + fun type(type: JsonField) = apply { this.type = type } /** Whether the test is archived. */ fun archived(archived: Boolean) = archived(JsonField.of(archived)) @@ -1938,10 +1938,10 @@ private constructor( name() number() originProjectVersionId() - subtype() + subtype().validate() suggested() thresholds().forEach { it.validate() } - type() + type().validate() archived() delayWindow() evaluationWindow() @@ -1978,10 +1978,10 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (number.asKnown().isPresent) 1 else 0) + (if (originProjectVersionId.asKnown().isPresent) 1 else 0) + - (if (subtype.asKnown().isPresent) 1 else 0) + + (subtype.asKnown().getOrNull()?.validity() ?: 0) + (if (suggested.asKnown().isPresent) 1 else 0) + (thresholds.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (type.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + (if (archived.asKnown().isPresent) 1 else 0) + (if (delayWindow.asKnown().isPresent) 1 else 0) + (if (evaluationWindow.asKnown().isPresent) 1 else 0) + @@ -1991,6 +1991,373 @@ private constructor( (if (usesTrainingDataset.asKnown().isPresent) 1 else 0) + (if (usesValidationDataset.asKnown().isPresent) 1 else 0) + /** The test subtype. */ + class Subtype @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val ANOMALOUS_COLUMN_COUNT = of("anomalousColumnCount") + + @JvmField val CHARACTER_LENGTH = of("characterLength") + + @JvmField val CLASS_IMBALANCE_RATIO = of("classImbalanceRatio") + + @JvmField + val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") + + @JvmField val COLUMN_AVERAGE = of("columnAverage") + + @JvmField val COLUMN_DRIFT = of("columnDrift") + + @JvmField val COLUMN_STATISTIC = of("columnStatistic") + + @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") + + @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") + + @JvmField val CONTAINS_PII = of("containsPii") + + @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") + + @JvmField val CORRELATED_FEATURE_COUNT = of("correlatedFeatureCount") + + @JvmField val CUSTOM_METRIC_THRESHOLD = of("customMetricThreshold") + + @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") + + @JvmField val EMPTY_FEATURE = of("emptyFeature") + + @JvmField val EMPTY_FEATURE_COUNT = of("emptyFeatureCount") + + @JvmField val DRIFTED_FEATURE_COUNT = of("driftedFeatureCount") + + @JvmField val FEATURE_MISSING_VALUES = of("featureMissingValues") + + @JvmField val FEATURE_VALUE_VALIDATION = of("featureValueValidation") + + @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") + + @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") + + @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") + + @JvmField val IS_CODE = of("isCode") + + @JvmField val IS_JSON = of("isJson") + + @JvmField val LLM_RUBRIC_THRESHOLD_V2 = of("llmRubricThresholdV2") + + @JvmField val LABEL_DRIFT = of("labelDrift") + + @JvmField val METRIC_THRESHOLD = of("metricThreshold") + + @JvmField val NEW_CATEGORY_COUNT = of("newCategoryCount") + + @JvmField val NEW_LABEL_COUNT = of("newLabelCount") + + @JvmField val NULL_ROW_COUNT = of("nullRowCount") + + @JvmField val ROW_COUNT = of("rowCount") + + @JvmField val PP_SCORE_VALUE_VALIDATION = of("ppScoreValueValidation") + + @JvmField val QUASI_CONSTANT_FEATURE = of("quasiConstantFeature") + + @JvmField val QUASI_CONSTANT_FEATURE_COUNT = of("quasiConstantFeatureCount") + + @JvmField val SQL_QUERY = of("sqlQuery") + + @JvmField val DTYPE_VALIDATION = of("dtypeValidation") + + @JvmField val SENTENCE_LENGTH = of("sentenceLength") + + @JvmField val SIZE_RATIO = of("sizeRatio") + + @JvmField val SPECIAL_CHARACTERS_RATIO = of("specialCharactersRatio") + + @JvmField val STRING_VALIDATION = of("stringValidation") + + @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") + + @JvmStatic fun of(value: String) = Subtype(JsonField.of(value)) + } + + /** An enum containing [Subtype]'s known values. */ + enum class Known { + ANOMALOUS_COLUMN_COUNT, + CHARACTER_LENGTH, + CLASS_IMBALANCE_RATIO, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_STATISTIC, + COLUMN_VALUES_MATCH, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURE_COUNT, + CUSTOM_METRIC_THRESHOLD, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURE, + EMPTY_FEATURE_COUNT, + DRIFTED_FEATURE_COUNT, + FEATURE_MISSING_VALUES, + FEATURE_VALUE_VALIDATION, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_THRESHOLD_V2, + LABEL_DRIFT, + METRIC_THRESHOLD, + NEW_CATEGORY_COUNT, + NEW_LABEL_COUNT, + NULL_ROW_COUNT, + ROW_COUNT, + PP_SCORE_VALUE_VALIDATION, + QUASI_CONSTANT_FEATURE, + QUASI_CONSTANT_FEATURE_COUNT, + SQL_QUERY, + DTYPE_VALIDATION, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS_RATIO, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + } + + /** + * An enum containing [Subtype]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Subtype] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANOMALOUS_COLUMN_COUNT, + CHARACTER_LENGTH, + CLASS_IMBALANCE_RATIO, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_STATISTIC, + COLUMN_VALUES_MATCH, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURE_COUNT, + CUSTOM_METRIC_THRESHOLD, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURE, + EMPTY_FEATURE_COUNT, + DRIFTED_FEATURE_COUNT, + FEATURE_MISSING_VALUES, + FEATURE_VALUE_VALIDATION, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_THRESHOLD_V2, + LABEL_DRIFT, + METRIC_THRESHOLD, + NEW_CATEGORY_COUNT, + NEW_LABEL_COUNT, + NULL_ROW_COUNT, + ROW_COUNT, + PP_SCORE_VALUE_VALIDATION, + QUASI_CONSTANT_FEATURE, + QUASI_CONSTANT_FEATURE_COUNT, + SQL_QUERY, + DTYPE_VALIDATION, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS_RATIO, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + /** + * An enum member indicating that [Subtype] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANOMALOUS_COLUMN_COUNT -> Value.ANOMALOUS_COLUMN_COUNT + CHARACTER_LENGTH -> Value.CHARACTER_LENGTH + CLASS_IMBALANCE_RATIO -> Value.CLASS_IMBALANCE_RATIO + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Value.COLUMN_AVERAGE + COLUMN_DRIFT -> Value.COLUMN_DRIFT + COLUMN_STATISTIC -> Value.COLUMN_STATISTIC + COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH + CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Value.CONTAINS_PII + CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL + CORRELATED_FEATURE_COUNT -> Value.CORRELATED_FEATURE_COUNT + CUSTOM_METRIC_THRESHOLD -> Value.CUSTOM_METRIC_THRESHOLD + DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT + EMPTY_FEATURE -> Value.EMPTY_FEATURE + EMPTY_FEATURE_COUNT -> Value.EMPTY_FEATURE_COUNT + DRIFTED_FEATURE_COUNT -> Value.DRIFTED_FEATURE_COUNT + FEATURE_MISSING_VALUES -> Value.FEATURE_MISSING_VALUES + FEATURE_VALUE_VALIDATION -> Value.FEATURE_VALUE_VALIDATION + GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT + IS_CODE -> Value.IS_CODE + IS_JSON -> Value.IS_JSON + LLM_RUBRIC_THRESHOLD_V2 -> Value.LLM_RUBRIC_THRESHOLD_V2 + LABEL_DRIFT -> Value.LABEL_DRIFT + METRIC_THRESHOLD -> Value.METRIC_THRESHOLD + NEW_CATEGORY_COUNT -> Value.NEW_CATEGORY_COUNT + NEW_LABEL_COUNT -> Value.NEW_LABEL_COUNT + NULL_ROW_COUNT -> Value.NULL_ROW_COUNT + ROW_COUNT -> Value.ROW_COUNT + PP_SCORE_VALUE_VALIDATION -> Value.PP_SCORE_VALUE_VALIDATION + QUASI_CONSTANT_FEATURE -> Value.QUASI_CONSTANT_FEATURE + QUASI_CONSTANT_FEATURE_COUNT -> Value.QUASI_CONSTANT_FEATURE_COUNT + SQL_QUERY -> Value.SQL_QUERY + DTYPE_VALIDATION -> Value.DTYPE_VALIDATION + SENTENCE_LENGTH -> Value.SENTENCE_LENGTH + SIZE_RATIO -> Value.SIZE_RATIO + SPECIAL_CHARACTERS_RATIO -> Value.SPECIAL_CHARACTERS_RATIO + STRING_VALIDATION -> Value.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + ANOMALOUS_COLUMN_COUNT -> Known.ANOMALOUS_COLUMN_COUNT + CHARACTER_LENGTH -> Known.CHARACTER_LENGTH + CLASS_IMBALANCE_RATIO -> Known.CLASS_IMBALANCE_RATIO + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Known.COLUMN_AVERAGE + COLUMN_DRIFT -> Known.COLUMN_DRIFT + COLUMN_STATISTIC -> Known.COLUMN_STATISTIC + COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH + CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Known.CONTAINS_PII + CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL + CORRELATED_FEATURE_COUNT -> Known.CORRELATED_FEATURE_COUNT + CUSTOM_METRIC_THRESHOLD -> Known.CUSTOM_METRIC_THRESHOLD + DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT + EMPTY_FEATURE -> Known.EMPTY_FEATURE + EMPTY_FEATURE_COUNT -> Known.EMPTY_FEATURE_COUNT + DRIFTED_FEATURE_COUNT -> Known.DRIFTED_FEATURE_COUNT + FEATURE_MISSING_VALUES -> Known.FEATURE_MISSING_VALUES + FEATURE_VALUE_VALIDATION -> Known.FEATURE_VALUE_VALIDATION + GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT + IS_CODE -> Known.IS_CODE + IS_JSON -> Known.IS_JSON + LLM_RUBRIC_THRESHOLD_V2 -> Known.LLM_RUBRIC_THRESHOLD_V2 + LABEL_DRIFT -> Known.LABEL_DRIFT + METRIC_THRESHOLD -> Known.METRIC_THRESHOLD + NEW_CATEGORY_COUNT -> Known.NEW_CATEGORY_COUNT + NEW_LABEL_COUNT -> Known.NEW_LABEL_COUNT + NULL_ROW_COUNT -> Known.NULL_ROW_COUNT + ROW_COUNT -> Known.ROW_COUNT + PP_SCORE_VALUE_VALIDATION -> Known.PP_SCORE_VALUE_VALIDATION + QUASI_CONSTANT_FEATURE -> Known.QUASI_CONSTANT_FEATURE + QUASI_CONSTANT_FEATURE_COUNT -> Known.QUASI_CONSTANT_FEATURE_COUNT + SQL_QUERY -> Known.SQL_QUERY + DTYPE_VALIDATION -> Known.DTYPE_VALIDATION + SENTENCE_LENGTH -> Known.SENTENCE_LENGTH + SIZE_RATIO -> Known.SIZE_RATIO + SPECIAL_CHARACTERS_RATIO -> Known.SPECIAL_CHARACTERS_RATIO + STRING_VALIDATION -> Known.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> throw OpenlayerInvalidDataException("Unknown Subtype: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Subtype = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Subtype && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + class Threshold private constructor( private val insightName: JsonField, @@ -3084,6 +3451,143 @@ private constructor( "Threshold{insightName=$insightName, insightParameters=$insightParameters, measurement=$measurement, operator=$operator, thresholdMode=$thresholdMode, value=$value, additionalProperties=$additionalProperties}" } + /** The test type. */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val INTEGRITY = of("integrity") + + @JvmField val CONSISTENCY = of("consistency") + + @JvmField val PERFORMANCE = of("performance") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + INTEGRITY -> Value.INTEGRITY + CONSISTENCY -> Value.CONSISTENCY + PERFORMANCE -> Value.PERFORMANCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + INTEGRITY -> Known.INTEGRITY + CONSISTENCY -> Known.CONSISTENCY + PERFORMANCE -> Known.PERFORMANCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt index 6ffce66e..4008e972 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt @@ -932,10 +932,10 @@ private constructor( private val name: JsonField, private val number: JsonField, private val originProjectVersionId: JsonField, - private val subtype: JsonField, + private val subtype: JsonField, private val suggested: JsonField, private val thresholds: JsonField>, - private val type: JsonField, + private val type: JsonField, private val archived: JsonField, private val delayWindow: JsonField, private val evaluationWindow: JsonField, @@ -975,14 +975,14 @@ private constructor( originProjectVersionId: JsonField = JsonMissing.of(), @JsonProperty("subtype") @ExcludeMissing - subtype: JsonField = JsonMissing.of(), + subtype: JsonField = JsonMissing.of(), @JsonProperty("suggested") @ExcludeMissing suggested: JsonField = JsonMissing.of(), @JsonProperty("thresholds") @ExcludeMissing thresholds: JsonField> = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), @JsonProperty("archived") @ExcludeMissing archived: JsonField = JsonMissing.of(), @@ -1122,7 +1122,7 @@ private constructor( * unexpectedly missing or null (e.g. if the server responded with an unexpected * value). */ - fun subtype(): String = subtype.getRequired("subtype") + fun subtype(): Subtype = subtype.getRequired("subtype") /** * Whether the test is suggested or user-created. @@ -1147,7 +1147,7 @@ private constructor( * unexpectedly missing or null (e.g. if the server responded with an unexpected * value). */ - fun type(): String = type.getRequired("type") + fun type(): Type = type.getRequired("type") /** * Whether the test is archived. @@ -1304,7 +1304,7 @@ private constructor( * * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype + @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype /** * Returns the raw JSON value of [suggested]. @@ -1331,7 +1331,7 @@ private constructor( * * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type /** * Returns the raw JSON value of [archived]. @@ -1462,10 +1462,10 @@ private constructor( private var name: JsonField? = null private var number: JsonField? = null private var originProjectVersionId: JsonField? = null - private var subtype: JsonField? = null + private var subtype: JsonField? = null private var suggested: JsonField? = null private var thresholds: JsonField>? = null - private var type: JsonField? = null + private var type: JsonField? = null private var archived: JsonField = JsonMissing.of() private var delayWindow: JsonField = JsonMissing.of() private var evaluationWindow: JsonField = JsonMissing.of() @@ -1643,16 +1643,16 @@ private constructor( } /** The test subtype. */ - fun subtype(subtype: String) = subtype(JsonField.of(subtype)) + fun subtype(subtype: Subtype) = subtype(JsonField.of(subtype)) /** * Sets [Builder.subtype] to an arbitrary JSON value. * - * You should usually call [Builder.subtype] with a well-typed [String] value + * You should usually call [Builder.subtype] with a well-typed [Subtype] value * instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun subtype(subtype: JsonField) = apply { this.subtype = subtype } + fun subtype(subtype: JsonField) = apply { this.subtype = subtype } /** Whether the test is suggested or user-created. */ fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) @@ -1692,16 +1692,16 @@ private constructor( } /** The test type. */ - fun type(type: String) = type(JsonField.of(type)) + fun type(type: Type) = type(JsonField.of(type)) /** * Sets [Builder.type] to an arbitrary JSON value. * - * You should usually call [Builder.type] with a well-typed [String] value instead. + * You should usually call [Builder.type] with a well-typed [Type] value instead. * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun type(type: JsonField) = apply { this.type = type } + fun type(type: JsonField) = apply { this.type = type } /** Whether the test is archived. */ fun archived(archived: Boolean) = archived(JsonField.of(archived)) @@ -1938,10 +1938,10 @@ private constructor( name() number() originProjectVersionId() - subtype() + subtype().validate() suggested() thresholds().forEach { it.validate() } - type() + type().validate() archived() delayWindow() evaluationWindow() @@ -1978,10 +1978,10 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (number.asKnown().isPresent) 1 else 0) + (if (originProjectVersionId.asKnown().isPresent) 1 else 0) + - (if (subtype.asKnown().isPresent) 1 else 0) + + (subtype.asKnown().getOrNull()?.validity() ?: 0) + (if (suggested.asKnown().isPresent) 1 else 0) + (thresholds.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (type.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + (if (archived.asKnown().isPresent) 1 else 0) + (if (delayWindow.asKnown().isPresent) 1 else 0) + (if (evaluationWindow.asKnown().isPresent) 1 else 0) + @@ -1991,6 +1991,373 @@ private constructor( (if (usesTrainingDataset.asKnown().isPresent) 1 else 0) + (if (usesValidationDataset.asKnown().isPresent) 1 else 0) + /** The test subtype. */ + class Subtype @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val ANOMALOUS_COLUMN_COUNT = of("anomalousColumnCount") + + @JvmField val CHARACTER_LENGTH = of("characterLength") + + @JvmField val CLASS_IMBALANCE_RATIO = of("classImbalanceRatio") + + @JvmField + val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") + + @JvmField val COLUMN_AVERAGE = of("columnAverage") + + @JvmField val COLUMN_DRIFT = of("columnDrift") + + @JvmField val COLUMN_STATISTIC = of("columnStatistic") + + @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") + + @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") + + @JvmField val CONTAINS_PII = of("containsPii") + + @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") + + @JvmField val CORRELATED_FEATURE_COUNT = of("correlatedFeatureCount") + + @JvmField val CUSTOM_METRIC_THRESHOLD = of("customMetricThreshold") + + @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") + + @JvmField val EMPTY_FEATURE = of("emptyFeature") + + @JvmField val EMPTY_FEATURE_COUNT = of("emptyFeatureCount") + + @JvmField val DRIFTED_FEATURE_COUNT = of("driftedFeatureCount") + + @JvmField val FEATURE_MISSING_VALUES = of("featureMissingValues") + + @JvmField val FEATURE_VALUE_VALIDATION = of("featureValueValidation") + + @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") + + @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") + + @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") + + @JvmField val IS_CODE = of("isCode") + + @JvmField val IS_JSON = of("isJson") + + @JvmField val LLM_RUBRIC_THRESHOLD_V2 = of("llmRubricThresholdV2") + + @JvmField val LABEL_DRIFT = of("labelDrift") + + @JvmField val METRIC_THRESHOLD = of("metricThreshold") + + @JvmField val NEW_CATEGORY_COUNT = of("newCategoryCount") + + @JvmField val NEW_LABEL_COUNT = of("newLabelCount") + + @JvmField val NULL_ROW_COUNT = of("nullRowCount") + + @JvmField val ROW_COUNT = of("rowCount") + + @JvmField val PP_SCORE_VALUE_VALIDATION = of("ppScoreValueValidation") + + @JvmField val QUASI_CONSTANT_FEATURE = of("quasiConstantFeature") + + @JvmField val QUASI_CONSTANT_FEATURE_COUNT = of("quasiConstantFeatureCount") + + @JvmField val SQL_QUERY = of("sqlQuery") + + @JvmField val DTYPE_VALIDATION = of("dtypeValidation") + + @JvmField val SENTENCE_LENGTH = of("sentenceLength") + + @JvmField val SIZE_RATIO = of("sizeRatio") + + @JvmField val SPECIAL_CHARACTERS_RATIO = of("specialCharactersRatio") + + @JvmField val STRING_VALIDATION = of("stringValidation") + + @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") + + @JvmStatic fun of(value: String) = Subtype(JsonField.of(value)) + } + + /** An enum containing [Subtype]'s known values. */ + enum class Known { + ANOMALOUS_COLUMN_COUNT, + CHARACTER_LENGTH, + CLASS_IMBALANCE_RATIO, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_STATISTIC, + COLUMN_VALUES_MATCH, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURE_COUNT, + CUSTOM_METRIC_THRESHOLD, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURE, + EMPTY_FEATURE_COUNT, + DRIFTED_FEATURE_COUNT, + FEATURE_MISSING_VALUES, + FEATURE_VALUE_VALIDATION, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_THRESHOLD_V2, + LABEL_DRIFT, + METRIC_THRESHOLD, + NEW_CATEGORY_COUNT, + NEW_LABEL_COUNT, + NULL_ROW_COUNT, + ROW_COUNT, + PP_SCORE_VALUE_VALIDATION, + QUASI_CONSTANT_FEATURE, + QUASI_CONSTANT_FEATURE_COUNT, + SQL_QUERY, + DTYPE_VALIDATION, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS_RATIO, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + } + + /** + * An enum containing [Subtype]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Subtype] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANOMALOUS_COLUMN_COUNT, + CHARACTER_LENGTH, + CLASS_IMBALANCE_RATIO, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_STATISTIC, + COLUMN_VALUES_MATCH, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURE_COUNT, + CUSTOM_METRIC_THRESHOLD, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURE, + EMPTY_FEATURE_COUNT, + DRIFTED_FEATURE_COUNT, + FEATURE_MISSING_VALUES, + FEATURE_VALUE_VALIDATION, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_THRESHOLD_V2, + LABEL_DRIFT, + METRIC_THRESHOLD, + NEW_CATEGORY_COUNT, + NEW_LABEL_COUNT, + NULL_ROW_COUNT, + ROW_COUNT, + PP_SCORE_VALUE_VALIDATION, + QUASI_CONSTANT_FEATURE, + QUASI_CONSTANT_FEATURE_COUNT, + SQL_QUERY, + DTYPE_VALIDATION, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS_RATIO, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + /** + * An enum member indicating that [Subtype] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANOMALOUS_COLUMN_COUNT -> Value.ANOMALOUS_COLUMN_COUNT + CHARACTER_LENGTH -> Value.CHARACTER_LENGTH + CLASS_IMBALANCE_RATIO -> Value.CLASS_IMBALANCE_RATIO + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Value.COLUMN_AVERAGE + COLUMN_DRIFT -> Value.COLUMN_DRIFT + COLUMN_STATISTIC -> Value.COLUMN_STATISTIC + COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH + CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Value.CONTAINS_PII + CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL + CORRELATED_FEATURE_COUNT -> Value.CORRELATED_FEATURE_COUNT + CUSTOM_METRIC_THRESHOLD -> Value.CUSTOM_METRIC_THRESHOLD + DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT + EMPTY_FEATURE -> Value.EMPTY_FEATURE + EMPTY_FEATURE_COUNT -> Value.EMPTY_FEATURE_COUNT + DRIFTED_FEATURE_COUNT -> Value.DRIFTED_FEATURE_COUNT + FEATURE_MISSING_VALUES -> Value.FEATURE_MISSING_VALUES + FEATURE_VALUE_VALIDATION -> Value.FEATURE_VALUE_VALIDATION + GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT + IS_CODE -> Value.IS_CODE + IS_JSON -> Value.IS_JSON + LLM_RUBRIC_THRESHOLD_V2 -> Value.LLM_RUBRIC_THRESHOLD_V2 + LABEL_DRIFT -> Value.LABEL_DRIFT + METRIC_THRESHOLD -> Value.METRIC_THRESHOLD + NEW_CATEGORY_COUNT -> Value.NEW_CATEGORY_COUNT + NEW_LABEL_COUNT -> Value.NEW_LABEL_COUNT + NULL_ROW_COUNT -> Value.NULL_ROW_COUNT + ROW_COUNT -> Value.ROW_COUNT + PP_SCORE_VALUE_VALIDATION -> Value.PP_SCORE_VALUE_VALIDATION + QUASI_CONSTANT_FEATURE -> Value.QUASI_CONSTANT_FEATURE + QUASI_CONSTANT_FEATURE_COUNT -> Value.QUASI_CONSTANT_FEATURE_COUNT + SQL_QUERY -> Value.SQL_QUERY + DTYPE_VALIDATION -> Value.DTYPE_VALIDATION + SENTENCE_LENGTH -> Value.SENTENCE_LENGTH + SIZE_RATIO -> Value.SIZE_RATIO + SPECIAL_CHARACTERS_RATIO -> Value.SPECIAL_CHARACTERS_RATIO + STRING_VALIDATION -> Value.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + ANOMALOUS_COLUMN_COUNT -> Known.ANOMALOUS_COLUMN_COUNT + CHARACTER_LENGTH -> Known.CHARACTER_LENGTH + CLASS_IMBALANCE_RATIO -> Known.CLASS_IMBALANCE_RATIO + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Known.COLUMN_AVERAGE + COLUMN_DRIFT -> Known.COLUMN_DRIFT + COLUMN_STATISTIC -> Known.COLUMN_STATISTIC + COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH + CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Known.CONTAINS_PII + CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL + CORRELATED_FEATURE_COUNT -> Known.CORRELATED_FEATURE_COUNT + CUSTOM_METRIC_THRESHOLD -> Known.CUSTOM_METRIC_THRESHOLD + DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT + EMPTY_FEATURE -> Known.EMPTY_FEATURE + EMPTY_FEATURE_COUNT -> Known.EMPTY_FEATURE_COUNT + DRIFTED_FEATURE_COUNT -> Known.DRIFTED_FEATURE_COUNT + FEATURE_MISSING_VALUES -> Known.FEATURE_MISSING_VALUES + FEATURE_VALUE_VALIDATION -> Known.FEATURE_VALUE_VALIDATION + GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT + IS_CODE -> Known.IS_CODE + IS_JSON -> Known.IS_JSON + LLM_RUBRIC_THRESHOLD_V2 -> Known.LLM_RUBRIC_THRESHOLD_V2 + LABEL_DRIFT -> Known.LABEL_DRIFT + METRIC_THRESHOLD -> Known.METRIC_THRESHOLD + NEW_CATEGORY_COUNT -> Known.NEW_CATEGORY_COUNT + NEW_LABEL_COUNT -> Known.NEW_LABEL_COUNT + NULL_ROW_COUNT -> Known.NULL_ROW_COUNT + ROW_COUNT -> Known.ROW_COUNT + PP_SCORE_VALUE_VALIDATION -> Known.PP_SCORE_VALUE_VALIDATION + QUASI_CONSTANT_FEATURE -> Known.QUASI_CONSTANT_FEATURE + QUASI_CONSTANT_FEATURE_COUNT -> Known.QUASI_CONSTANT_FEATURE_COUNT + SQL_QUERY -> Known.SQL_QUERY + DTYPE_VALIDATION -> Known.DTYPE_VALIDATION + SENTENCE_LENGTH -> Known.SENTENCE_LENGTH + SIZE_RATIO -> Known.SIZE_RATIO + SPECIAL_CHARACTERS_RATIO -> Known.SPECIAL_CHARACTERS_RATIO + STRING_VALIDATION -> Known.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> throw OpenlayerInvalidDataException("Unknown Subtype: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Subtype = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Subtype && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + class Threshold private constructor( private val insightName: JsonField, @@ -3084,6 +3451,143 @@ private constructor( "Threshold{insightName=$insightName, insightParameters=$insightParameters, measurement=$measurement, operator=$operator, thresholdMode=$thresholdMode, value=$value, additionalProperties=$additionalProperties}" } + /** The test type. */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val INTEGRITY = of("integrity") + + @JvmField val CONSISTENCY = of("consistency") + + @JvmField val PERFORMANCE = of("performance") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + INTEGRITY -> Value.INTEGRITY + CONSISTENCY -> Value.CONSISTENCY + PERFORMANCE -> Value.PERFORMANCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + INTEGRITY -> Known.INTEGRITY + CONSISTENCY -> Known.CONSISTENCY + PERFORMANCE -> Known.PERFORMANCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt index 70519a40..fee3025e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt @@ -127,7 +127,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun subtype(): String = body.subtype() + fun subtype(): Subtype = body.subtype() /** * Whether the test is suggested or user-created. @@ -149,7 +149,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun type(): String = body.type() + fun type(): Type = body.type() /** * Whether the test is archived. @@ -284,7 +284,7 @@ private constructor( * * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. */ - fun _subtype(): JsonField = body._subtype() + fun _subtype(): JsonField = body._subtype() /** * Returns the raw JSON value of [suggested]. @@ -305,7 +305,7 @@ private constructor( * * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. */ - fun _type(): JsonField = body._type() + fun _type(): JsonField = body._type() /** * Returns the raw JSON value of [archived]. @@ -568,15 +568,15 @@ private constructor( } /** The test subtype. */ - fun subtype(subtype: String) = apply { body.subtype(subtype) } + fun subtype(subtype: Subtype) = apply { body.subtype(subtype) } /** * Sets [Builder.subtype] to an arbitrary JSON value. * - * You should usually call [Builder.subtype] with a well-typed [String] value instead. This + * You should usually call [Builder.subtype] with a well-typed [Subtype] value instead. This * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun subtype(subtype: JsonField) = apply { body.subtype(subtype) } + fun subtype(subtype: JsonField) = apply { body.subtype(subtype) } /** Whether the test is suggested or user-created. */ fun suggested(suggested: Boolean) = apply { body.suggested(suggested) } @@ -611,15 +611,15 @@ private constructor( fun addThreshold(threshold: Threshold) = apply { body.addThreshold(threshold) } /** The test type. */ - fun type(type: String) = apply { body.type(type) } + fun type(type: Type) = apply { body.type(type) } /** * Sets [Builder.type] to an arbitrary JSON value. * - * You should usually call [Builder.type] with a well-typed [String] value instead. This + * You should usually call [Builder.type] with a well-typed [Type] value instead. This * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun type(type: JsonField) = apply { body.type(type) } + fun type(type: JsonField) = apply { body.type(type) } /** Whether the test is archived. */ fun archived(archived: Boolean) = apply { body.archived(archived) } @@ -935,10 +935,10 @@ private constructor( private val name: JsonField, private val number: JsonField, private val originProjectVersionId: JsonField, - private val subtype: JsonField, + private val subtype: JsonField, private val suggested: JsonField, private val thresholds: JsonField>, - private val type: JsonField, + private val type: JsonField, private val archived: JsonField, private val delayWindow: JsonField, private val evaluationWindow: JsonField, @@ -974,14 +974,14 @@ private constructor( @JsonProperty("originProjectVersionId") @ExcludeMissing originProjectVersionId: JsonField = JsonMissing.of(), - @JsonProperty("subtype") @ExcludeMissing subtype: JsonField = JsonMissing.of(), + @JsonProperty("subtype") @ExcludeMissing subtype: JsonField = JsonMissing.of(), @JsonProperty("suggested") @ExcludeMissing suggested: JsonField = JsonMissing.of(), @JsonProperty("thresholds") @ExcludeMissing thresholds: JsonField> = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), @JsonProperty("archived") @ExcludeMissing archived: JsonField = JsonMissing.of(), @@ -1114,7 +1114,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun subtype(): String = subtype.getRequired("subtype") + fun subtype(): Subtype = subtype.getRequired("subtype") /** * Whether the test is suggested or user-created. @@ -1136,7 +1136,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun type(): String = type.getRequired("type") + fun type(): Type = type.getRequired("type") /** * Whether the test is archived. @@ -1287,7 +1287,7 @@ private constructor( * * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype + @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype /** * Returns the raw JSON value of [suggested]. @@ -1310,7 +1310,7 @@ private constructor( * * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type /** * Returns the raw JSON value of [archived]. @@ -1438,10 +1438,10 @@ private constructor( private var name: JsonField? = null private var number: JsonField? = null private var originProjectVersionId: JsonField? = null - private var subtype: JsonField? = null + private var subtype: JsonField? = null private var suggested: JsonField? = null private var thresholds: JsonField>? = null - private var type: JsonField? = null + private var type: JsonField? = null private var archived: JsonField = JsonMissing.of() private var delayWindow: JsonField = JsonMissing.of() private var evaluationWindow: JsonField = JsonMissing.of() @@ -1617,16 +1617,16 @@ private constructor( } /** The test subtype. */ - fun subtype(subtype: String) = subtype(JsonField.of(subtype)) + fun subtype(subtype: Subtype) = subtype(JsonField.of(subtype)) /** * Sets [Builder.subtype] to an arbitrary JSON value. * - * You should usually call [Builder.subtype] with a well-typed [String] value instead. + * You should usually call [Builder.subtype] with a well-typed [Subtype] value instead. * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun subtype(subtype: JsonField) = apply { this.subtype = subtype } + fun subtype(subtype: JsonField) = apply { this.subtype = subtype } /** Whether the test is suggested or user-created. */ fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) @@ -1666,16 +1666,16 @@ private constructor( } /** The test type. */ - fun type(type: String) = type(JsonField.of(type)) + fun type(type: Type) = type(JsonField.of(type)) /** * Sets [Builder.type] to an arbitrary JSON value. * - * You should usually call [Builder.type] with a well-typed [String] value instead. This + * You should usually call [Builder.type] with a well-typed [Type] value instead. This * method is primarily for setting the field to an undocumented or not yet supported * value. */ - fun type(type: JsonField) = apply { this.type = type } + fun type(type: JsonField) = apply { this.type = type } /** Whether the test is archived. */ fun archived(archived: Boolean) = archived(JsonField.of(archived)) @@ -1904,10 +1904,10 @@ private constructor( name() number() originProjectVersionId() - subtype() + subtype().validate() suggested() thresholds().forEach { it.validate() } - type() + type().validate() archived() delayWindow() evaluationWindow() @@ -1944,10 +1944,10 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (number.asKnown().isPresent) 1 else 0) + (if (originProjectVersionId.asKnown().isPresent) 1 else 0) + - (if (subtype.asKnown().isPresent) 1 else 0) + + (subtype.asKnown().getOrNull()?.validity() ?: 0) + (if (suggested.asKnown().isPresent) 1 else 0) + (thresholds.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (type.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + (if (archived.asKnown().isPresent) 1 else 0) + (if (delayWindow.asKnown().isPresent) 1 else 0) + (if (evaluationWindow.asKnown().isPresent) 1 else 0) + @@ -1975,6 +1975,368 @@ private constructor( "Body{id=$id, commentCount=$commentCount, creatorId=$creatorId, dateArchived=$dateArchived, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, name=$name, number=$number, originProjectVersionId=$originProjectVersionId, subtype=$subtype, suggested=$suggested, thresholds=$thresholds, type=$type, archived=$archived, delayWindow=$delayWindow, evaluationWindow=$evaluationWindow, usesMlModel=$usesMlModel, usesProductionData=$usesProductionData, usesReferenceDataset=$usesReferenceDataset, usesTrainingDataset=$usesTrainingDataset, usesValidationDataset=$usesValidationDataset, additionalProperties=$additionalProperties}" } + /** The test subtype. */ + class Subtype @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val ANOMALOUS_COLUMN_COUNT = of("anomalousColumnCount") + + @JvmField val CHARACTER_LENGTH = of("characterLength") + + @JvmField val CLASS_IMBALANCE_RATIO = of("classImbalanceRatio") + + @JvmField val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") + + @JvmField val COLUMN_AVERAGE = of("columnAverage") + + @JvmField val COLUMN_DRIFT = of("columnDrift") + + @JvmField val COLUMN_STATISTIC = of("columnStatistic") + + @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") + + @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") + + @JvmField val CONTAINS_PII = of("containsPii") + + @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") + + @JvmField val CORRELATED_FEATURE_COUNT = of("correlatedFeatureCount") + + @JvmField val CUSTOM_METRIC_THRESHOLD = of("customMetricThreshold") + + @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") + + @JvmField val EMPTY_FEATURE = of("emptyFeature") + + @JvmField val EMPTY_FEATURE_COUNT = of("emptyFeatureCount") + + @JvmField val DRIFTED_FEATURE_COUNT = of("driftedFeatureCount") + + @JvmField val FEATURE_MISSING_VALUES = of("featureMissingValues") + + @JvmField val FEATURE_VALUE_VALIDATION = of("featureValueValidation") + + @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") + + @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") + + @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") + + @JvmField val IS_CODE = of("isCode") + + @JvmField val IS_JSON = of("isJson") + + @JvmField val LLM_RUBRIC_THRESHOLD_V2 = of("llmRubricThresholdV2") + + @JvmField val LABEL_DRIFT = of("labelDrift") + + @JvmField val METRIC_THRESHOLD = of("metricThreshold") + + @JvmField val NEW_CATEGORY_COUNT = of("newCategoryCount") + + @JvmField val NEW_LABEL_COUNT = of("newLabelCount") + + @JvmField val NULL_ROW_COUNT = of("nullRowCount") + + @JvmField val ROW_COUNT = of("rowCount") + + @JvmField val PP_SCORE_VALUE_VALIDATION = of("ppScoreValueValidation") + + @JvmField val QUASI_CONSTANT_FEATURE = of("quasiConstantFeature") + + @JvmField val QUASI_CONSTANT_FEATURE_COUNT = of("quasiConstantFeatureCount") + + @JvmField val SQL_QUERY = of("sqlQuery") + + @JvmField val DTYPE_VALIDATION = of("dtypeValidation") + + @JvmField val SENTENCE_LENGTH = of("sentenceLength") + + @JvmField val SIZE_RATIO = of("sizeRatio") + + @JvmField val SPECIAL_CHARACTERS_RATIO = of("specialCharactersRatio") + + @JvmField val STRING_VALIDATION = of("stringValidation") + + @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") + + @JvmStatic fun of(value: String) = Subtype(JsonField.of(value)) + } + + /** An enum containing [Subtype]'s known values. */ + enum class Known { + ANOMALOUS_COLUMN_COUNT, + CHARACTER_LENGTH, + CLASS_IMBALANCE_RATIO, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_STATISTIC, + COLUMN_VALUES_MATCH, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURE_COUNT, + CUSTOM_METRIC_THRESHOLD, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURE, + EMPTY_FEATURE_COUNT, + DRIFTED_FEATURE_COUNT, + FEATURE_MISSING_VALUES, + FEATURE_VALUE_VALIDATION, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_THRESHOLD_V2, + LABEL_DRIFT, + METRIC_THRESHOLD, + NEW_CATEGORY_COUNT, + NEW_LABEL_COUNT, + NULL_ROW_COUNT, + ROW_COUNT, + PP_SCORE_VALUE_VALIDATION, + QUASI_CONSTANT_FEATURE, + QUASI_CONSTANT_FEATURE_COUNT, + SQL_QUERY, + DTYPE_VALIDATION, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS_RATIO, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + } + + /** + * An enum containing [Subtype]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Subtype] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANOMALOUS_COLUMN_COUNT, + CHARACTER_LENGTH, + CLASS_IMBALANCE_RATIO, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_STATISTIC, + COLUMN_VALUES_MATCH, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURE_COUNT, + CUSTOM_METRIC_THRESHOLD, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURE, + EMPTY_FEATURE_COUNT, + DRIFTED_FEATURE_COUNT, + FEATURE_MISSING_VALUES, + FEATURE_VALUE_VALIDATION, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_THRESHOLD_V2, + LABEL_DRIFT, + METRIC_THRESHOLD, + NEW_CATEGORY_COUNT, + NEW_LABEL_COUNT, + NULL_ROW_COUNT, + ROW_COUNT, + PP_SCORE_VALUE_VALIDATION, + QUASI_CONSTANT_FEATURE, + QUASI_CONSTANT_FEATURE_COUNT, + SQL_QUERY, + DTYPE_VALIDATION, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS_RATIO, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + /** An enum member indicating that [Subtype] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANOMALOUS_COLUMN_COUNT -> Value.ANOMALOUS_COLUMN_COUNT + CHARACTER_LENGTH -> Value.CHARACTER_LENGTH + CLASS_IMBALANCE_RATIO -> Value.CLASS_IMBALANCE_RATIO + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Value.COLUMN_AVERAGE + COLUMN_DRIFT -> Value.COLUMN_DRIFT + COLUMN_STATISTIC -> Value.COLUMN_STATISTIC + COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH + CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Value.CONTAINS_PII + CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL + CORRELATED_FEATURE_COUNT -> Value.CORRELATED_FEATURE_COUNT + CUSTOM_METRIC_THRESHOLD -> Value.CUSTOM_METRIC_THRESHOLD + DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT + EMPTY_FEATURE -> Value.EMPTY_FEATURE + EMPTY_FEATURE_COUNT -> Value.EMPTY_FEATURE_COUNT + DRIFTED_FEATURE_COUNT -> Value.DRIFTED_FEATURE_COUNT + FEATURE_MISSING_VALUES -> Value.FEATURE_MISSING_VALUES + FEATURE_VALUE_VALIDATION -> Value.FEATURE_VALUE_VALIDATION + GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT + IS_CODE -> Value.IS_CODE + IS_JSON -> Value.IS_JSON + LLM_RUBRIC_THRESHOLD_V2 -> Value.LLM_RUBRIC_THRESHOLD_V2 + LABEL_DRIFT -> Value.LABEL_DRIFT + METRIC_THRESHOLD -> Value.METRIC_THRESHOLD + NEW_CATEGORY_COUNT -> Value.NEW_CATEGORY_COUNT + NEW_LABEL_COUNT -> Value.NEW_LABEL_COUNT + NULL_ROW_COUNT -> Value.NULL_ROW_COUNT + ROW_COUNT -> Value.ROW_COUNT + PP_SCORE_VALUE_VALIDATION -> Value.PP_SCORE_VALUE_VALIDATION + QUASI_CONSTANT_FEATURE -> Value.QUASI_CONSTANT_FEATURE + QUASI_CONSTANT_FEATURE_COUNT -> Value.QUASI_CONSTANT_FEATURE_COUNT + SQL_QUERY -> Value.SQL_QUERY + DTYPE_VALIDATION -> Value.DTYPE_VALIDATION + SENTENCE_LENGTH -> Value.SENTENCE_LENGTH + SIZE_RATIO -> Value.SIZE_RATIO + SPECIAL_CHARACTERS_RATIO -> Value.SPECIAL_CHARACTERS_RATIO + STRING_VALIDATION -> Value.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ANOMALOUS_COLUMN_COUNT -> Known.ANOMALOUS_COLUMN_COUNT + CHARACTER_LENGTH -> Known.CHARACTER_LENGTH + CLASS_IMBALANCE_RATIO -> Known.CLASS_IMBALANCE_RATIO + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Known.COLUMN_AVERAGE + COLUMN_DRIFT -> Known.COLUMN_DRIFT + COLUMN_STATISTIC -> Known.COLUMN_STATISTIC + COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH + CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Known.CONTAINS_PII + CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL + CORRELATED_FEATURE_COUNT -> Known.CORRELATED_FEATURE_COUNT + CUSTOM_METRIC_THRESHOLD -> Known.CUSTOM_METRIC_THRESHOLD + DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT + EMPTY_FEATURE -> Known.EMPTY_FEATURE + EMPTY_FEATURE_COUNT -> Known.EMPTY_FEATURE_COUNT + DRIFTED_FEATURE_COUNT -> Known.DRIFTED_FEATURE_COUNT + FEATURE_MISSING_VALUES -> Known.FEATURE_MISSING_VALUES + FEATURE_VALUE_VALIDATION -> Known.FEATURE_VALUE_VALIDATION + GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT + IS_CODE -> Known.IS_CODE + IS_JSON -> Known.IS_JSON + LLM_RUBRIC_THRESHOLD_V2 -> Known.LLM_RUBRIC_THRESHOLD_V2 + LABEL_DRIFT -> Known.LABEL_DRIFT + METRIC_THRESHOLD -> Known.METRIC_THRESHOLD + NEW_CATEGORY_COUNT -> Known.NEW_CATEGORY_COUNT + NEW_LABEL_COUNT -> Known.NEW_LABEL_COUNT + NULL_ROW_COUNT -> Known.NULL_ROW_COUNT + ROW_COUNT -> Known.ROW_COUNT + PP_SCORE_VALUE_VALIDATION -> Known.PP_SCORE_VALUE_VALIDATION + QUASI_CONSTANT_FEATURE -> Known.QUASI_CONSTANT_FEATURE + QUASI_CONSTANT_FEATURE_COUNT -> Known.QUASI_CONSTANT_FEATURE_COUNT + SQL_QUERY -> Known.SQL_QUERY + DTYPE_VALIDATION -> Known.DTYPE_VALIDATION + SENTENCE_LENGTH -> Known.SENTENCE_LENGTH + SIZE_RATIO -> Known.SIZE_RATIO + SPECIAL_CHARACTERS_RATIO -> Known.SPECIAL_CHARACTERS_RATIO + STRING_VALIDATION -> Known.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> throw OpenlayerInvalidDataException("Unknown Subtype: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Subtype = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Subtype && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + class Threshold private constructor( private val insightName: JsonField, @@ -3032,6 +3394,140 @@ private constructor( "Threshold{insightName=$insightName, insightParameters=$insightParameters, measurement=$measurement, operator=$operator, thresholdMode=$thresholdMode, value=$value, additionalProperties=$additionalProperties}" } + /** The test type. */ + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val INTEGRITY = of("integrity") + + @JvmField val CONSISTENCY = of("consistency") + + @JvmField val PERFORMANCE = of("performance") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + INTEGRITY -> Value.INTEGRITY + CONSISTENCY -> Value.CONSISTENCY + PERFORMANCE -> Value.PERFORMANCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + INTEGRITY -> Known.INTEGRITY + CONSISTENCY -> Known.CONSISTENCY + PERFORMANCE -> Known.PERFORMANCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt index d9207b9e..804667da 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt @@ -44,10 +44,10 @@ private constructor( private val name: JsonField, private val number: JsonField, private val originProjectVersionId: JsonField, - private val subtype: JsonField, + private val subtype: JsonField, private val suggested: JsonField, private val thresholds: JsonField>, - private val type: JsonField, + private val type: JsonField, private val archived: JsonField, private val delayWindow: JsonField, private val evaluationWindow: JsonField, @@ -81,12 +81,12 @@ private constructor( @JsonProperty("originProjectVersionId") @ExcludeMissing originProjectVersionId: JsonField = JsonMissing.of(), - @JsonProperty("subtype") @ExcludeMissing subtype: JsonField = JsonMissing.of(), + @JsonProperty("subtype") @ExcludeMissing subtype: JsonField = JsonMissing.of(), @JsonProperty("suggested") @ExcludeMissing suggested: JsonField = JsonMissing.of(), @JsonProperty("thresholds") @ExcludeMissing thresholds: JsonField> = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), @JsonProperty("archived") @ExcludeMissing archived: JsonField = JsonMissing.of(), @JsonProperty("delayWindow") @ExcludeMissing @@ -217,7 +217,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun subtype(): String = subtype.getRequired("subtype") + fun subtype(): Subtype = subtype.getRequired("subtype") /** * Whether the test is suggested or user-created. @@ -239,7 +239,7 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun type(): String = type.getRequired("type") + fun type(): Type = type.getRequired("type") /** * Whether the test is archived. @@ -388,7 +388,7 @@ private constructor( * * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype + @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype /** * Returns the raw JSON value of [suggested]. @@ -411,7 +411,7 @@ private constructor( * * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type /** * Returns the raw JSON value of [archived]. @@ -537,10 +537,10 @@ private constructor( private var name: JsonField? = null private var number: JsonField? = null private var originProjectVersionId: JsonField? = null - private var subtype: JsonField? = null + private var subtype: JsonField? = null private var suggested: JsonField? = null private var thresholds: JsonField>? = null - private var type: JsonField? = null + private var type: JsonField? = null private var archived: JsonField = JsonMissing.of() private var delayWindow: JsonField = JsonMissing.of() private var evaluationWindow: JsonField = JsonMissing.of() @@ -711,15 +711,15 @@ private constructor( } /** The test subtype. */ - fun subtype(subtype: String) = subtype(JsonField.of(subtype)) + fun subtype(subtype: Subtype) = subtype(JsonField.of(subtype)) /** * Sets [Builder.subtype] to an arbitrary JSON value. * - * You should usually call [Builder.subtype] with a well-typed [String] value instead. This + * You should usually call [Builder.subtype] with a well-typed [Subtype] value instead. This * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun subtype(subtype: JsonField) = apply { this.subtype = subtype } + fun subtype(subtype: JsonField) = apply { this.subtype = subtype } /** Whether the test is suggested or user-created. */ fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) @@ -759,15 +759,15 @@ private constructor( } /** The test type. */ - fun type(type: String) = type(JsonField.of(type)) + fun type(type: Type) = type(JsonField.of(type)) /** * Sets [Builder.type] to an arbitrary JSON value. * - * You should usually call [Builder.type] with a well-typed [String] value instead. This + * You should usually call [Builder.type] with a well-typed [Type] value instead. This * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun type(type: JsonField) = apply { this.type = type } + fun type(type: JsonField) = apply { this.type = type } /** Whether the test is archived. */ fun archived(archived: Boolean) = archived(JsonField.of(archived)) @@ -990,10 +990,10 @@ private constructor( name() number() originProjectVersionId() - subtype() + subtype().validate() suggested() thresholds().forEach { it.validate() } - type() + type().validate() archived() delayWindow() evaluationWindow() @@ -1029,10 +1029,10 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (number.asKnown().isPresent) 1 else 0) + (if (originProjectVersionId.asKnown().isPresent) 1 else 0) + - (if (subtype.asKnown().isPresent) 1 else 0) + + (subtype.asKnown().getOrNull()?.validity() ?: 0) + (if (suggested.asKnown().isPresent) 1 else 0) + (thresholds.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (type.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + (if (archived.asKnown().isPresent) 1 else 0) + (if (delayWindow.asKnown().isPresent) 1 else 0) + (if (evaluationWindow.asKnown().isPresent) 1 else 0) + @@ -1042,6 +1042,368 @@ private constructor( (if (usesTrainingDataset.asKnown().isPresent) 1 else 0) + (if (usesValidationDataset.asKnown().isPresent) 1 else 0) + /** The test subtype. */ + class Subtype @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val ANOMALOUS_COLUMN_COUNT = of("anomalousColumnCount") + + @JvmField val CHARACTER_LENGTH = of("characterLength") + + @JvmField val CLASS_IMBALANCE_RATIO = of("classImbalanceRatio") + + @JvmField val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") + + @JvmField val COLUMN_AVERAGE = of("columnAverage") + + @JvmField val COLUMN_DRIFT = of("columnDrift") + + @JvmField val COLUMN_STATISTIC = of("columnStatistic") + + @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") + + @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") + + @JvmField val CONTAINS_PII = of("containsPii") + + @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") + + @JvmField val CORRELATED_FEATURE_COUNT = of("correlatedFeatureCount") + + @JvmField val CUSTOM_METRIC_THRESHOLD = of("customMetricThreshold") + + @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") + + @JvmField val EMPTY_FEATURE = of("emptyFeature") + + @JvmField val EMPTY_FEATURE_COUNT = of("emptyFeatureCount") + + @JvmField val DRIFTED_FEATURE_COUNT = of("driftedFeatureCount") + + @JvmField val FEATURE_MISSING_VALUES = of("featureMissingValues") + + @JvmField val FEATURE_VALUE_VALIDATION = of("featureValueValidation") + + @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") + + @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") + + @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") + + @JvmField val IS_CODE = of("isCode") + + @JvmField val IS_JSON = of("isJson") + + @JvmField val LLM_RUBRIC_THRESHOLD_V2 = of("llmRubricThresholdV2") + + @JvmField val LABEL_DRIFT = of("labelDrift") + + @JvmField val METRIC_THRESHOLD = of("metricThreshold") + + @JvmField val NEW_CATEGORY_COUNT = of("newCategoryCount") + + @JvmField val NEW_LABEL_COUNT = of("newLabelCount") + + @JvmField val NULL_ROW_COUNT = of("nullRowCount") + + @JvmField val ROW_COUNT = of("rowCount") + + @JvmField val PP_SCORE_VALUE_VALIDATION = of("ppScoreValueValidation") + + @JvmField val QUASI_CONSTANT_FEATURE = of("quasiConstantFeature") + + @JvmField val QUASI_CONSTANT_FEATURE_COUNT = of("quasiConstantFeatureCount") + + @JvmField val SQL_QUERY = of("sqlQuery") + + @JvmField val DTYPE_VALIDATION = of("dtypeValidation") + + @JvmField val SENTENCE_LENGTH = of("sentenceLength") + + @JvmField val SIZE_RATIO = of("sizeRatio") + + @JvmField val SPECIAL_CHARACTERS_RATIO = of("specialCharactersRatio") + + @JvmField val STRING_VALIDATION = of("stringValidation") + + @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") + + @JvmStatic fun of(value: String) = Subtype(JsonField.of(value)) + } + + /** An enum containing [Subtype]'s known values. */ + enum class Known { + ANOMALOUS_COLUMN_COUNT, + CHARACTER_LENGTH, + CLASS_IMBALANCE_RATIO, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_STATISTIC, + COLUMN_VALUES_MATCH, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURE_COUNT, + CUSTOM_METRIC_THRESHOLD, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURE, + EMPTY_FEATURE_COUNT, + DRIFTED_FEATURE_COUNT, + FEATURE_MISSING_VALUES, + FEATURE_VALUE_VALIDATION, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_THRESHOLD_V2, + LABEL_DRIFT, + METRIC_THRESHOLD, + NEW_CATEGORY_COUNT, + NEW_LABEL_COUNT, + NULL_ROW_COUNT, + ROW_COUNT, + PP_SCORE_VALUE_VALIDATION, + QUASI_CONSTANT_FEATURE, + QUASI_CONSTANT_FEATURE_COUNT, + SQL_QUERY, + DTYPE_VALIDATION, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS_RATIO, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + } + + /** + * An enum containing [Subtype]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Subtype] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANOMALOUS_COLUMN_COUNT, + CHARACTER_LENGTH, + CLASS_IMBALANCE_RATIO, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_STATISTIC, + COLUMN_VALUES_MATCH, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURE_COUNT, + CUSTOM_METRIC_THRESHOLD, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURE, + EMPTY_FEATURE_COUNT, + DRIFTED_FEATURE_COUNT, + FEATURE_MISSING_VALUES, + FEATURE_VALUE_VALIDATION, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_THRESHOLD_V2, + LABEL_DRIFT, + METRIC_THRESHOLD, + NEW_CATEGORY_COUNT, + NEW_LABEL_COUNT, + NULL_ROW_COUNT, + ROW_COUNT, + PP_SCORE_VALUE_VALIDATION, + QUASI_CONSTANT_FEATURE, + QUASI_CONSTANT_FEATURE_COUNT, + SQL_QUERY, + DTYPE_VALIDATION, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS_RATIO, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + /** An enum member indicating that [Subtype] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANOMALOUS_COLUMN_COUNT -> Value.ANOMALOUS_COLUMN_COUNT + CHARACTER_LENGTH -> Value.CHARACTER_LENGTH + CLASS_IMBALANCE_RATIO -> Value.CLASS_IMBALANCE_RATIO + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Value.COLUMN_AVERAGE + COLUMN_DRIFT -> Value.COLUMN_DRIFT + COLUMN_STATISTIC -> Value.COLUMN_STATISTIC + COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH + CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Value.CONTAINS_PII + CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL + CORRELATED_FEATURE_COUNT -> Value.CORRELATED_FEATURE_COUNT + CUSTOM_METRIC_THRESHOLD -> Value.CUSTOM_METRIC_THRESHOLD + DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT + EMPTY_FEATURE -> Value.EMPTY_FEATURE + EMPTY_FEATURE_COUNT -> Value.EMPTY_FEATURE_COUNT + DRIFTED_FEATURE_COUNT -> Value.DRIFTED_FEATURE_COUNT + FEATURE_MISSING_VALUES -> Value.FEATURE_MISSING_VALUES + FEATURE_VALUE_VALIDATION -> Value.FEATURE_VALUE_VALIDATION + GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT + IS_CODE -> Value.IS_CODE + IS_JSON -> Value.IS_JSON + LLM_RUBRIC_THRESHOLD_V2 -> Value.LLM_RUBRIC_THRESHOLD_V2 + LABEL_DRIFT -> Value.LABEL_DRIFT + METRIC_THRESHOLD -> Value.METRIC_THRESHOLD + NEW_CATEGORY_COUNT -> Value.NEW_CATEGORY_COUNT + NEW_LABEL_COUNT -> Value.NEW_LABEL_COUNT + NULL_ROW_COUNT -> Value.NULL_ROW_COUNT + ROW_COUNT -> Value.ROW_COUNT + PP_SCORE_VALUE_VALIDATION -> Value.PP_SCORE_VALUE_VALIDATION + QUASI_CONSTANT_FEATURE -> Value.QUASI_CONSTANT_FEATURE + QUASI_CONSTANT_FEATURE_COUNT -> Value.QUASI_CONSTANT_FEATURE_COUNT + SQL_QUERY -> Value.SQL_QUERY + DTYPE_VALIDATION -> Value.DTYPE_VALIDATION + SENTENCE_LENGTH -> Value.SENTENCE_LENGTH + SIZE_RATIO -> Value.SIZE_RATIO + SPECIAL_CHARACTERS_RATIO -> Value.SPECIAL_CHARACTERS_RATIO + STRING_VALIDATION -> Value.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ANOMALOUS_COLUMN_COUNT -> Known.ANOMALOUS_COLUMN_COUNT + CHARACTER_LENGTH -> Known.CHARACTER_LENGTH + CLASS_IMBALANCE_RATIO -> Known.CLASS_IMBALANCE_RATIO + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Known.COLUMN_AVERAGE + COLUMN_DRIFT -> Known.COLUMN_DRIFT + COLUMN_STATISTIC -> Known.COLUMN_STATISTIC + COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH + CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Known.CONTAINS_PII + CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL + CORRELATED_FEATURE_COUNT -> Known.CORRELATED_FEATURE_COUNT + CUSTOM_METRIC_THRESHOLD -> Known.CUSTOM_METRIC_THRESHOLD + DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT + EMPTY_FEATURE -> Known.EMPTY_FEATURE + EMPTY_FEATURE_COUNT -> Known.EMPTY_FEATURE_COUNT + DRIFTED_FEATURE_COUNT -> Known.DRIFTED_FEATURE_COUNT + FEATURE_MISSING_VALUES -> Known.FEATURE_MISSING_VALUES + FEATURE_VALUE_VALIDATION -> Known.FEATURE_VALUE_VALIDATION + GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT + IS_CODE -> Known.IS_CODE + IS_JSON -> Known.IS_JSON + LLM_RUBRIC_THRESHOLD_V2 -> Known.LLM_RUBRIC_THRESHOLD_V2 + LABEL_DRIFT -> Known.LABEL_DRIFT + METRIC_THRESHOLD -> Known.METRIC_THRESHOLD + NEW_CATEGORY_COUNT -> Known.NEW_CATEGORY_COUNT + NEW_LABEL_COUNT -> Known.NEW_LABEL_COUNT + NULL_ROW_COUNT -> Known.NULL_ROW_COUNT + ROW_COUNT -> Known.ROW_COUNT + PP_SCORE_VALUE_VALIDATION -> Known.PP_SCORE_VALUE_VALIDATION + QUASI_CONSTANT_FEATURE -> Known.QUASI_CONSTANT_FEATURE + QUASI_CONSTANT_FEATURE_COUNT -> Known.QUASI_CONSTANT_FEATURE_COUNT + SQL_QUERY -> Known.SQL_QUERY + DTYPE_VALIDATION -> Known.DTYPE_VALIDATION + SENTENCE_LENGTH -> Known.SENTENCE_LENGTH + SIZE_RATIO -> Known.SIZE_RATIO + SPECIAL_CHARACTERS_RATIO -> Known.SPECIAL_CHARACTERS_RATIO + STRING_VALIDATION -> Known.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> throw OpenlayerInvalidDataException("Unknown Subtype: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Subtype = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Subtype && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + class Threshold private constructor( private val insightName: JsonField, @@ -2099,6 +2461,140 @@ private constructor( "Threshold{insightName=$insightName, insightParameters=$insightParameters, measurement=$measurement, operator=$operator, thresholdMode=$thresholdMode, value=$value, additionalProperties=$additionalProperties}" } + /** The test type. */ + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val INTEGRITY = of("integrity") + + @JvmField val CONSISTENCY = of("consistency") + + @JvmField val PERFORMANCE = of("performance") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + INTEGRITY -> Value.INTEGRITY + CONSISTENCY -> Value.CONSISTENCY + PERFORMANCE -> Value.PERFORMANCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + INTEGRITY -> Known.INTEGRITY + CONSISTENCY -> Known.CONSISTENCY + PERFORMANCE -> Known.PERFORMANCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt index 5003ff60..f9ecbcb1 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt @@ -42,7 +42,9 @@ internal class TestResultListResponseTest { .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") + .subtype( + TestResultListResponse.Item.Goal.Subtype.DUPLICATE_ROW_COUNT + ) .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() @@ -67,7 +69,7 @@ internal class TestResultListResponseTest { .value(0.0) .build() ) - .type("integrity") + .type(TestResultListResponse.Item.Goal.Type.INTEGRITY) .archived(false) .delayWindow(0.0) .evaluationWindow(3600.0) @@ -111,7 +113,7 @@ internal class TestResultListResponseTest { .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") + .subtype(TestResultListResponse.Item.Goal.Subtype.DUPLICATE_ROW_COUNT) .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() @@ -135,7 +137,7 @@ internal class TestResultListResponseTest { .value(0.0) .build() ) - .type("integrity") + .type(TestResultListResponse.Item.Goal.Type.INTEGRITY) .archived(false) .delayWindow(0.0) .evaluationWindow(3600.0) @@ -183,7 +185,9 @@ internal class TestResultListResponseTest { .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") + .subtype( + TestResultListResponse.Item.Goal.Subtype.DUPLICATE_ROW_COUNT + ) .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() @@ -208,7 +212,7 @@ internal class TestResultListResponseTest { .value(0.0) .build() ) - .type("integrity") + .type(TestResultListResponse.Item.Goal.Type.INTEGRITY) .archived(false) .delayWindow(0.0) .evaluationWindow(3600.0) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt index a58d76f7..53cca3af 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt @@ -42,7 +42,9 @@ internal class TestResultListResponseTest { .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") + .subtype( + TestResultListResponse.Item.Goal.Subtype.DUPLICATE_ROW_COUNT + ) .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() @@ -67,7 +69,7 @@ internal class TestResultListResponseTest { .value(0.0) .build() ) - .type("integrity") + .type(TestResultListResponse.Item.Goal.Type.INTEGRITY) .archived(false) .delayWindow(0.0) .evaluationWindow(3600.0) @@ -111,7 +113,7 @@ internal class TestResultListResponseTest { .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") + .subtype(TestResultListResponse.Item.Goal.Subtype.DUPLICATE_ROW_COUNT) .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() @@ -135,7 +137,7 @@ internal class TestResultListResponseTest { .value(0.0) .build() ) - .type("integrity") + .type(TestResultListResponse.Item.Goal.Type.INTEGRITY) .archived(false) .delayWindow(0.0) .evaluationWindow(3600.0) @@ -183,7 +185,9 @@ internal class TestResultListResponseTest { .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") + .subtype( + TestResultListResponse.Item.Goal.Subtype.DUPLICATE_ROW_COUNT + ) .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() @@ -208,7 +212,7 @@ internal class TestResultListResponseTest { .value(0.0) .build() ) - .type("integrity") + .type(TestResultListResponse.Item.Goal.Type.INTEGRITY) .archived(false) .delayWindow(0.0) .evaluationWindow(3600.0) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt index 5d9bb00c..e113b43c 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt @@ -23,7 +23,7 @@ internal class TestCreateParamsTest { .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") + .subtype(TestCreateParams.Subtype.DUPLICATE_ROW_COUNT) .suggested(false) .addThreshold( TestCreateParams.Threshold.builder() @@ -40,7 +40,7 @@ internal class TestCreateParamsTest { .value(0.0) .build() ) - .type("integrity") + .type(TestCreateParams.Type.INTEGRITY) .archived(false) .delayWindow(0.0) .evaluationWindow(3600.0) @@ -67,10 +67,10 @@ internal class TestCreateParamsTest { .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") + .subtype(TestCreateParams.Subtype.DUPLICATE_ROW_COUNT) .suggested(false) .addThreshold(TestCreateParams.Threshold.builder().build()) - .type("integrity") + .type(TestCreateParams.Type.INTEGRITY) .build() assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -93,7 +93,7 @@ internal class TestCreateParamsTest { .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") + .subtype(TestCreateParams.Subtype.DUPLICATE_ROW_COUNT) .suggested(false) .addThreshold( TestCreateParams.Threshold.builder() @@ -110,7 +110,7 @@ internal class TestCreateParamsTest { .value(0.0) .build() ) - .type("integrity") + .type(TestCreateParams.Type.INTEGRITY) .archived(false) .delayWindow(0.0) .evaluationWindow(3600.0) @@ -134,7 +134,7 @@ internal class TestCreateParamsTest { assertThat(body.name()).isEqualTo("No duplicate rows") assertThat(body.number()).isEqualTo(1L) assertThat(body.originProjectVersionId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(body.subtype()).isEqualTo("duplicateRowCount") + assertThat(body.subtype()).isEqualTo(TestCreateParams.Subtype.DUPLICATE_ROW_COUNT) assertThat(body.suggested()).isEqualTo(false) assertThat(body.thresholds()) .containsExactly( @@ -152,7 +152,7 @@ internal class TestCreateParamsTest { .value(0.0) .build() ) - assertThat(body.type()).isEqualTo("integrity") + assertThat(body.type()).isEqualTo(TestCreateParams.Type.INTEGRITY) assertThat(body.archived()).contains(false) assertThat(body.delayWindow()).contains(0.0) assertThat(body.evaluationWindow()).contains(3600.0) @@ -178,10 +178,10 @@ internal class TestCreateParamsTest { .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") + .subtype(TestCreateParams.Subtype.DUPLICATE_ROW_COUNT) .suggested(false) .addThreshold(TestCreateParams.Threshold.builder().build()) - .type("integrity") + .type(TestCreateParams.Type.INTEGRITY) .build() val body = params._body() @@ -197,9 +197,9 @@ internal class TestCreateParamsTest { assertThat(body.name()).isEqualTo("No duplicate rows") assertThat(body.number()).isEqualTo(1L) assertThat(body.originProjectVersionId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(body.subtype()).isEqualTo("duplicateRowCount") + assertThat(body.subtype()).isEqualTo(TestCreateParams.Subtype.DUPLICATE_ROW_COUNT) assertThat(body.suggested()).isEqualTo(false) assertThat(body.thresholds()).containsExactly(TestCreateParams.Threshold.builder().build()) - assertThat(body.type()).isEqualTo("integrity") + assertThat(body.type()).isEqualTo(TestCreateParams.Type.INTEGRITY) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt index 9e855f75..f4e284f2 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt @@ -25,7 +25,7 @@ internal class TestCreateResponseTest { .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") + .subtype(TestCreateResponse.Subtype.DUPLICATE_ROW_COUNT) .suggested(false) .addThreshold( TestCreateResponse.Threshold.builder() @@ -42,7 +42,7 @@ internal class TestCreateResponseTest { .value(0.0) .build() ) - .type("integrity") + .type(TestCreateResponse.Type.INTEGRITY) .archived(false) .delayWindow(0.0) .evaluationWindow(3600.0) @@ -68,7 +68,8 @@ internal class TestCreateResponseTest { assertThat(testCreateResponse.number()).isEqualTo(1L) assertThat(testCreateResponse.originProjectVersionId()) .contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(testCreateResponse.subtype()).isEqualTo("duplicateRowCount") + assertThat(testCreateResponse.subtype()) + .isEqualTo(TestCreateResponse.Subtype.DUPLICATE_ROW_COUNT) assertThat(testCreateResponse.suggested()).isEqualTo(false) assertThat(testCreateResponse.thresholds()) .containsExactly( @@ -86,7 +87,7 @@ internal class TestCreateResponseTest { .value(0.0) .build() ) - assertThat(testCreateResponse.type()).isEqualTo("integrity") + assertThat(testCreateResponse.type()).isEqualTo(TestCreateResponse.Type.INTEGRITY) assertThat(testCreateResponse.archived()).contains(false) assertThat(testCreateResponse.delayWindow()).contains(0.0) assertThat(testCreateResponse.evaluationWindow()).contains(3600.0) @@ -112,7 +113,7 @@ internal class TestCreateResponseTest { .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") + .subtype(TestCreateResponse.Subtype.DUPLICATE_ROW_COUNT) .suggested(false) .addThreshold( TestCreateResponse.Threshold.builder() @@ -129,7 +130,7 @@ internal class TestCreateResponseTest { .value(0.0) .build() ) - .type("integrity") + .type(TestCreateResponse.Type.INTEGRITY) .archived(false) .delayWindow(0.0) .evaluationWindow(3600.0) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt index 8ff6a6bb..55fc392c 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt @@ -38,7 +38,7 @@ internal class TestServiceAsyncTest { .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") + .subtype(TestCreateParams.Subtype.DUPLICATE_ROW_COUNT) .suggested(false) .addThreshold( TestCreateParams.Threshold.builder() @@ -55,7 +55,7 @@ internal class TestServiceAsyncTest { .value(0.0) .build() ) - .type("integrity") + .type(TestCreateParams.Type.INTEGRITY) .archived(false) .delayWindow(0.0) .evaluationWindow(3600.0) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt index 611b9c27..c754201d 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt @@ -38,7 +38,7 @@ internal class TestServiceTest { .name("No duplicate rows") .number(1L) .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .subtype("duplicateRowCount") + .subtype(TestCreateParams.Subtype.DUPLICATE_ROW_COUNT) .suggested(false) .addThreshold( TestCreateParams.Threshold.builder() @@ -55,7 +55,7 @@ internal class TestServiceTest { .value(0.0) .build() ) - .type("integrity") + .type(TestCreateParams.Type.INTEGRITY) .archived(false) .delayWindow(0.0) .evaluationWindow(3600.0) From 6a5c14163b155b89cc3225c28ae37d5d4d594bff Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 21:12:54 +0000 Subject: [PATCH 66/74] feat(api): expose test retrieval endpoint --- .stats.yml | 4 +- .../models/projects/tests/TestListParams.kt | 507 +++ .../models/projects/tests/TestListResponse.kt | 3134 +++++++++++++++++ .../async/projects/TestServiceAsync.kt | 27 + .../async/projects/TestServiceAsyncImpl.kt | 38 + .../services/blocking/projects/TestService.kt | 26 + .../blocking/projects/TestServiceImpl.kt | 32 + .../projects/tests/TestListParamsTest.kt | 74 + .../projects/tests/TestListResponseTest.kt | 196 ++ .../async/projects/TestServiceAsyncTest.kt | 28 + .../blocking/projects/TestServiceTest.kt | 27 + 11 files changed, 4091 insertions(+), 2 deletions(-) create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt diff --git a/.stats.yml b/.stats.yml index 00b73d5d..1dee8043 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ -configured_endpoints: 16 +configured_endpoints: 17 openapi_spec_hash: 8827ead72aa0c635ccafac5e008fe247 -config_hash: 0383360784fc87d799bad2be203142b5 +config_hash: 087e6b8013c398a6d24031d24594fdec diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListParams.kt new file mode 100644 index 00000000..8f15202d --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListParams.kt @@ -0,0 +1,507 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.projects.tests + +import com.fasterxml.jackson.annotation.JsonCreator +import com.openlayer.api.core.Enum +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.Params +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** List tests under a project. */ +class TestListParams +private constructor( + private val projectId: String, + private val includeArchived: Boolean?, + private val originVersionId: String?, + private val page: Long?, + private val perPage: Long?, + private val suggested: Boolean?, + private val type: Type?, + private val usesProductionData: Boolean?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun projectId(): String = projectId + + /** Filter for archived tests. */ + fun includeArchived(): Optional = Optional.ofNullable(includeArchived) + + /** Retrive tests created by a specific project version. */ + fun originVersionId(): Optional = Optional.ofNullable(originVersionId) + + /** The page to return in a paginated query. */ + fun page(): Optional = Optional.ofNullable(page) + + /** Maximum number of items to return per page. */ + fun perPage(): Optional = Optional.ofNullable(perPage) + + /** Filter for suggested tests. */ + fun suggested(): Optional = Optional.ofNullable(suggested) + + /** + * Filter objects by test type. Available types are `integrity`, `consistency`, `performance`, + * `fairness`, and `robustness`. + */ + fun type(): Optional = Optional.ofNullable(type) + + /** Retrive tests with usesProductionData (monitoring). */ + fun usesProductionData(): Optional = Optional.ofNullable(usesProductionData) + + fun _additionalHeaders(): Headers = additionalHeaders + + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [TestListParams]. + * + * The following fields are required: + * ```java + * .projectId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TestListParams]. */ + class Builder internal constructor() { + + private var projectId: String? = null + private var includeArchived: Boolean? = null + private var originVersionId: String? = null + private var page: Long? = null + private var perPage: Long? = null + private var suggested: Boolean? = null + private var type: Type? = null + private var usesProductionData: Boolean? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(testListParams: TestListParams) = apply { + projectId = testListParams.projectId + includeArchived = testListParams.includeArchived + originVersionId = testListParams.originVersionId + page = testListParams.page + perPage = testListParams.perPage + suggested = testListParams.suggested + type = testListParams.type + usesProductionData = testListParams.usesProductionData + additionalHeaders = testListParams.additionalHeaders.toBuilder() + additionalQueryParams = testListParams.additionalQueryParams.toBuilder() + } + + fun projectId(projectId: String) = apply { this.projectId = projectId } + + /** Filter for archived tests. */ + fun includeArchived(includeArchived: Boolean?) = apply { + this.includeArchived = includeArchived + } + + /** + * Alias for [Builder.includeArchived]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun includeArchived(includeArchived: Boolean) = includeArchived(includeArchived as Boolean?) + + /** Alias for calling [Builder.includeArchived] with `includeArchived.orElse(null)`. */ + fun includeArchived(includeArchived: Optional) = + includeArchived(includeArchived.getOrNull()) + + /** Retrive tests created by a specific project version. */ + fun originVersionId(originVersionId: String?) = apply { + this.originVersionId = originVersionId + } + + /** Alias for calling [Builder.originVersionId] with `originVersionId.orElse(null)`. */ + fun originVersionId(originVersionId: Optional) = + originVersionId(originVersionId.getOrNull()) + + /** The page to return in a paginated query. */ + fun page(page: Long?) = apply { this.page = page } + + /** + * Alias for [Builder.page]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun page(page: Long) = page(page as Long?) + + /** Alias for calling [Builder.page] with `page.orElse(null)`. */ + fun page(page: Optional) = page(page.getOrNull()) + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long?) = apply { this.perPage = perPage } + + /** + * Alias for [Builder.perPage]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun perPage(perPage: Long) = perPage(perPage as Long?) + + /** Alias for calling [Builder.perPage] with `perPage.orElse(null)`. */ + fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) + + /** Filter for suggested tests. */ + fun suggested(suggested: Boolean?) = apply { this.suggested = suggested } + + /** + * Alias for [Builder.suggested]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun suggested(suggested: Boolean) = suggested(suggested as Boolean?) + + /** Alias for calling [Builder.suggested] with `suggested.orElse(null)`. */ + fun suggested(suggested: Optional) = suggested(suggested.getOrNull()) + + /** + * Filter objects by test type. Available types are `integrity`, `consistency`, + * `performance`, `fairness`, and `robustness`. + */ + fun type(type: Type?) = apply { this.type = type } + + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ + fun type(type: Optional) = type(type.getOrNull()) + + /** Retrive tests with usesProductionData (monitoring). */ + fun usesProductionData(usesProductionData: Boolean?) = apply { + this.usesProductionData = usesProductionData + } + + /** + * Alias for [Builder.usesProductionData]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun usesProductionData(usesProductionData: Boolean) = + usesProductionData(usesProductionData as Boolean?) + + /** + * Alias for calling [Builder.usesProductionData] with `usesProductionData.orElse(null)`. + */ + fun usesProductionData(usesProductionData: Optional) = + usesProductionData(usesProductionData.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [TestListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .projectId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TestListParams = + TestListParams( + checkRequired("projectId", projectId), + includeArchived, + originVersionId, + page, + perPage, + suggested, + type, + usesProductionData, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> projectId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + includeArchived?.let { put("includeArchived", it.toString()) } + originVersionId?.let { put("originVersionId", it) } + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + suggested?.let { put("suggested", it.toString()) } + type?.let { put("type", it.toString()) } + usesProductionData?.let { put("usesProductionData", it.toString()) } + putAll(additionalQueryParams) + } + .build() + + /** + * Filter objects by test type. Available types are `integrity`, `consistency`, `performance`, + * `fairness`, and `robustness`. + */ + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val INTEGRITY = of("integrity") + + @JvmField val CONSISTENCY = of("consistency") + + @JvmField val PERFORMANCE = of("performance") + + @JvmField val FAIRNESS = of("fairness") + + @JvmField val ROBUSTNESS = of("robustness") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + FAIRNESS, + ROBUSTNESS, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + FAIRNESS, + ROBUSTNESS, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + INTEGRITY -> Value.INTEGRITY + CONSISTENCY -> Value.CONSISTENCY + PERFORMANCE -> Value.PERFORMANCE + FAIRNESS -> Value.FAIRNESS + ROBUSTNESS -> Value.ROBUSTNESS + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + INTEGRITY -> Known.INTEGRITY + CONSISTENCY -> Known.CONSISTENCY + PERFORMANCE -> Known.PERFORMANCE + FAIRNESS -> Known.FAIRNESS + ROBUSTNESS -> Known.ROBUSTNESS + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TestListParams && projectId == other.projectId && includeArchived == other.includeArchived && originVersionId == other.originVersionId && page == other.page && perPage == other.perPage && suggested == other.suggested && type == other.type && usesProductionData == other.usesProductionData && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(projectId, includeArchived, originVersionId, page, perPage, suggested, type, usesProductionData, additionalHeaders, additionalQueryParams) /* spotless:on */ + + override fun toString() = + "TestListParams{projectId=$projectId, includeArchived=$includeArchived, originVersionId=$originVersionId, page=$page, perPage=$perPage, suggested=$suggested, type=$type, usesProductionData=$usesProductionData, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt new file mode 100644 index 00000000..b42c76fd --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt @@ -0,0 +1,3134 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.projects.tests + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.allMaxBy +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.getOrThrow +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class TestListResponse +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("_meta") @ExcludeMissing _meta: JsonField<_Meta> = JsonMissing.of(), + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of(), + ) : this(_meta, items, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun _meta(): _Meta = _meta.getRequired("_meta") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun items(): List = items.getRequired("items") + + /** + * Returns the raw JSON value of [_meta]. + * + * Unlike [_meta], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("_meta") @ExcludeMissing fun __meta(): JsonField<_Meta> = _meta + + /** + * Returns the raw JSON value of [items]. + * + * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [TestListResponse]. + * + * The following fields are required: + * ```java + * ._meta() + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TestListResponse]. */ + class Builder internal constructor() { + + private var _meta: JsonField<_Meta>? = null + private var items: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(testListResponse: TestListResponse) = apply { + _meta = testListResponse._meta + items = testListResponse.items.map { it.toMutableList() } + additionalProperties = testListResponse.additionalProperties.toMutableMap() + } + + fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta)) + + /** + * Sets [Builder._meta] to an arbitrary JSON value. + * + * You should usually call [Builder._meta] with a well-typed [_Meta] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } + + fun items(items: List) = items(JsonField.of(items)) + + /** + * Sets [Builder.items] to an arbitrary JSON value. + * + * You should usually call [Builder.items] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun items(items: JsonField>) = apply { + this.items = items.map { it.toMutableList() } + } + + /** + * Adds a single [Item] to [items]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addItem(item: Item) = apply { + items = + (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [TestListResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * ._meta() + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TestListResponse = + TestListResponse( + checkRequired("_meta", _meta), + checkRequired("items", items).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): TestListResponse = apply { + if (validated) { + return@apply + } + + _meta().validate() + items().forEach { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (_meta.asKnown().getOrNull()?.validity() ?: 0) + + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class _Meta + private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("page") @ExcludeMissing page: JsonField = JsonMissing.of(), + @JsonProperty("perPage") @ExcludeMissing perPage: JsonField = JsonMissing.of(), + @JsonProperty("totalItems") + @ExcludeMissing + totalItems: JsonField = JsonMissing.of(), + @JsonProperty("totalPages") + @ExcludeMissing + totalPages: JsonField = JsonMissing.of(), + ) : this(page, perPage, totalItems, totalPages, mutableMapOf()) + + /** + * The current page. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun page(): Long = page.getRequired("page") + + /** + * The number of items per page. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun perPage(): Long = perPage.getRequired("perPage") + + /** + * The total number of items. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalItems(): Long = totalItems.getRequired("totalItems") + + /** + * The total number of pages. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalPages(): Long = totalPages.getRequired("totalPages") + + /** + * Returns the raw JSON value of [page]. + * + * Unlike [page], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("page") @ExcludeMissing fun _page(): JsonField = page + + /** + * Returns the raw JSON value of [perPage]. + * + * Unlike [perPage], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("perPage") @ExcludeMissing fun _perPage(): JsonField = perPage + + /** + * Returns the raw JSON value of [totalItems]. + * + * Unlike [totalItems], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems(): JsonField = totalItems + + /** + * Returns the raw JSON value of [totalPages]. + * + * Unlike [totalPages], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages(): JsonField = totalPages + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [_Meta]. + * + * The following fields are required: + * ```java + * .page() + * .perPage() + * .totalItems() + * .totalPages() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [_Meta]. */ + class Builder internal constructor() { + + private var page: JsonField? = null + private var perPage: JsonField? = null + private var totalItems: JsonField? = null + private var totalPages: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(_meta: _Meta) = apply { + page = _meta.page + perPage = _meta.perPage + totalItems = _meta.totalItems + totalPages = _meta.totalPages + additionalProperties = _meta.additionalProperties.toMutableMap() + } + + /** The current page. */ + fun page(page: Long) = page(JsonField.of(page)) + + /** + * Sets [Builder.page] to an arbitrary JSON value. + * + * You should usually call [Builder.page] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun page(page: JsonField) = apply { this.page = page } + + /** The number of items per page. */ + fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) + + /** + * Sets [Builder.perPage] to an arbitrary JSON value. + * + * You should usually call [Builder.perPage] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } + + /** The total number of items. */ + fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) + + /** + * Sets [Builder.totalItems] to an arbitrary JSON value. + * + * You should usually call [Builder.totalItems] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } + + /** The total number of pages. */ + fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) + + /** + * Sets [Builder.totalPages] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPages] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [_Meta]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .page() + * .perPage() + * .totalItems() + * .totalPages() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): _Meta = + _Meta( + checkRequired("page", page), + checkRequired("perPage", perPage), + checkRequired("totalItems", totalItems), + checkRequired("totalPages", totalPages), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): _Meta = apply { + if (validated) { + return@apply + } + + page() + perPage() + totalItems() + totalPages() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (page.asKnown().isPresent) 1 else 0) + + (if (perPage.asKnown().isPresent) 1 else 0) + + (if (totalItems.asKnown().isPresent) 1 else 0) + + (if (totalPages.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is _Meta && page == other.page && perPage == other.perPage && totalItems == other.totalItems && totalPages == other.totalPages && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(page, perPage, totalItems, totalPages, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + } + + class Item + private constructor( + private val id: JsonField, + private val commentCount: JsonField, + private val creatorId: JsonField, + private val dateArchived: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val description: JsonValue, + private val name: JsonField, + private val number: JsonField, + private val originProjectVersionId: JsonField, + private val subtype: JsonField, + private val suggested: JsonField, + private val thresholds: JsonField>, + private val type: JsonField, + private val archived: JsonField, + private val delayWindow: JsonField, + private val evaluationWindow: JsonField, + private val usesMlModel: JsonField, + private val usesProductionData: JsonField, + private val usesReferenceDataset: JsonField, + private val usesTrainingDataset: JsonField, + private val usesValidationDataset: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("commentCount") + @ExcludeMissing + commentCount: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateArchived") + @ExcludeMissing + dateArchived: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("description") @ExcludeMissing description: JsonValue = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("number") @ExcludeMissing number: JsonField = JsonMissing.of(), + @JsonProperty("originProjectVersionId") + @ExcludeMissing + originProjectVersionId: JsonField = JsonMissing.of(), + @JsonProperty("subtype") @ExcludeMissing subtype: JsonField = JsonMissing.of(), + @JsonProperty("suggested") + @ExcludeMissing + suggested: JsonField = JsonMissing.of(), + @JsonProperty("thresholds") + @ExcludeMissing + thresholds: JsonField> = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("archived") + @ExcludeMissing + archived: JsonField = JsonMissing.of(), + @JsonProperty("delayWindow") + @ExcludeMissing + delayWindow: JsonField = JsonMissing.of(), + @JsonProperty("evaluationWindow") + @ExcludeMissing + evaluationWindow: JsonField = JsonMissing.of(), + @JsonProperty("usesMlModel") + @ExcludeMissing + usesMlModel: JsonField = JsonMissing.of(), + @JsonProperty("usesProductionData") + @ExcludeMissing + usesProductionData: JsonField = JsonMissing.of(), + @JsonProperty("usesReferenceDataset") + @ExcludeMissing + usesReferenceDataset: JsonField = JsonMissing.of(), + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + usesTrainingDataset: JsonField = JsonMissing.of(), + @JsonProperty("usesValidationDataset") + @ExcludeMissing + usesValidationDataset: JsonField = JsonMissing.of(), + ) : this( + id, + commentCount, + creatorId, + dateArchived, + dateCreated, + dateUpdated, + description, + name, + number, + originProjectVersionId, + subtype, + suggested, + thresholds, + type, + archived, + delayWindow, + evaluationWindow, + usesMlModel, + usesProductionData, + usesReferenceDataset, + usesTrainingDataset, + usesValidationDataset, + mutableMapOf(), + ) + + /** + * The test id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The number of comments on the test. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun commentCount(): Long = commentCount.getRequired("commentCount") + + /** + * The test creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun creatorId(): Optional = creatorId.getOptional("creatorId") + + /** + * The date the test was archived. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateArchived(): Optional = dateArchived.getOptional("dateArchived") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** The test description. */ + @JsonProperty("description") @ExcludeMissing fun _description(): JsonValue = description + + /** + * The test name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * The test number. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun number(): Long = number.getRequired("number") + + /** + * The project version (commit) id where the test was created. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun originProjectVersionId(): Optional = + originProjectVersionId.getOptional("originProjectVersionId") + + /** + * The test subtype. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun subtype(): Subtype = subtype.getRequired("subtype") + + /** + * Whether the test is suggested or user-created. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun suggested(): Boolean = suggested.getRequired("suggested") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun thresholds(): List = thresholds.getRequired("thresholds") + + /** + * The test type. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * Whether the test is archived. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun archived(): Optional = archived.getOptional("archived") + + /** + * The delay window in seconds. Only applies to tests that use production data. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun delayWindow(): Optional = delayWindow.getOptional("delayWindow") + + /** + * The evaluation window in seconds. Only applies to tests that use production data. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun evaluationWindow(): Optional = evaluationWindow.getOptional("evaluationWindow") + + /** + * Whether the test uses an ML model. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun usesMlModel(): Optional = usesMlModel.getOptional("usesMlModel") + + /** + * Whether the test uses production data (monitoring mode only). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun usesProductionData(): Optional = + usesProductionData.getOptional("usesProductionData") + + /** + * Whether the test uses a reference dataset (monitoring mode only). + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun usesReferenceDataset(): Optional = + usesReferenceDataset.getOptional("usesReferenceDataset") + + /** + * Whether the test uses a training dataset. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun usesTrainingDataset(): Optional = + usesTrainingDataset.getOptional("usesTrainingDataset") + + /** + * Whether the test uses a validation dataset. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun usesValidationDataset(): Optional = + usesValidationDataset.getOptional("usesValidationDataset") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [commentCount]. + * + * Unlike [commentCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("commentCount") + @ExcludeMissing + fun _commentCount(): JsonField = commentCount + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [dateArchived]. + * + * Unlike [dateArchived], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateArchived") + @ExcludeMissing + fun _dateArchived(): JsonField = dateArchived + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [number]. + * + * Unlike [number], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("number") @ExcludeMissing fun _number(): JsonField = number + + /** + * Returns the raw JSON value of [originProjectVersionId]. + * + * Unlike [originProjectVersionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("originProjectVersionId") + @ExcludeMissing + fun _originProjectVersionId(): JsonField = originProjectVersionId + + /** + * Returns the raw JSON value of [subtype]. + * + * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype + + /** + * Returns the raw JSON value of [suggested]. + * + * Unlike [suggested], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("suggested") @ExcludeMissing fun _suggested(): JsonField = suggested + + /** + * Returns the raw JSON value of [thresholds]. + * + * Unlike [thresholds], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("thresholds") + @ExcludeMissing + fun _thresholds(): JsonField> = thresholds + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [archived]. + * + * Unlike [archived], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived + + /** + * Returns the raw JSON value of [delayWindow]. + * + * Unlike [delayWindow], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("delayWindow") + @ExcludeMissing + fun _delayWindow(): JsonField = delayWindow + + /** + * Returns the raw JSON value of [evaluationWindow]. + * + * Unlike [evaluationWindow], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("evaluationWindow") + @ExcludeMissing + fun _evaluationWindow(): JsonField = evaluationWindow + + /** + * Returns the raw JSON value of [usesMlModel]. + * + * Unlike [usesMlModel], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("usesMlModel") + @ExcludeMissing + fun _usesMlModel(): JsonField = usesMlModel + + /** + * Returns the raw JSON value of [usesProductionData]. + * + * Unlike [usesProductionData], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("usesProductionData") + @ExcludeMissing + fun _usesProductionData(): JsonField = usesProductionData + + /** + * Returns the raw JSON value of [usesReferenceDataset]. + * + * Unlike [usesReferenceDataset], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("usesReferenceDataset") + @ExcludeMissing + fun _usesReferenceDataset(): JsonField = usesReferenceDataset + + /** + * Returns the raw JSON value of [usesTrainingDataset]. + * + * Unlike [usesTrainingDataset], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + fun _usesTrainingDataset(): JsonField = usesTrainingDataset + + /** + * Returns the raw JSON value of [usesValidationDataset]. + * + * Unlike [usesValidationDataset], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("usesValidationDataset") + @ExcludeMissing + fun _usesValidationDataset(): JsonField = usesValidationDataset + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Item]. + * + * The following fields are required: + * ```java + * .id() + * .commentCount() + * .creatorId() + * .dateArchived() + * .dateCreated() + * .dateUpdated() + * .description() + * .name() + * .number() + * .originProjectVersionId() + * .subtype() + * .suggested() + * .thresholds() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Item]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var commentCount: JsonField? = null + private var creatorId: JsonField? = null + private var dateArchived: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var description: JsonValue? = null + private var name: JsonField? = null + private var number: JsonField? = null + private var originProjectVersionId: JsonField? = null + private var subtype: JsonField? = null + private var suggested: JsonField? = null + private var thresholds: JsonField>? = null + private var type: JsonField? = null + private var archived: JsonField = JsonMissing.of() + private var delayWindow: JsonField = JsonMissing.of() + private var evaluationWindow: JsonField = JsonMissing.of() + private var usesMlModel: JsonField = JsonMissing.of() + private var usesProductionData: JsonField = JsonMissing.of() + private var usesReferenceDataset: JsonField = JsonMissing.of() + private var usesTrainingDataset: JsonField = JsonMissing.of() + private var usesValidationDataset: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + id = item.id + commentCount = item.commentCount + creatorId = item.creatorId + dateArchived = item.dateArchived + dateCreated = item.dateCreated + dateUpdated = item.dateUpdated + description = item.description + name = item.name + number = item.number + originProjectVersionId = item.originProjectVersionId + subtype = item.subtype + suggested = item.suggested + thresholds = item.thresholds.map { it.toMutableList() } + type = item.type + archived = item.archived + delayWindow = item.delayWindow + evaluationWindow = item.evaluationWindow + usesMlModel = item.usesMlModel + usesProductionData = item.usesProductionData + usesReferenceDataset = item.usesReferenceDataset + usesTrainingDataset = item.usesTrainingDataset + usesValidationDataset = item.usesValidationDataset + additionalProperties = item.additionalProperties.toMutableMap() + } + + /** The test id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The number of comments on the test. */ + fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) + + /** + * Sets [Builder.commentCount] to an arbitrary JSON value. + * + * You should usually call [Builder.commentCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun commentCount(commentCount: JsonField) = apply { + this.commentCount = commentCount + } + + /** The test creator id. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The date the test was archived. */ + fun dateArchived(dateArchived: OffsetDateTime?) = + dateArchived(JsonField.ofNullable(dateArchived)) + + /** Alias for calling [Builder.dateArchived] with `dateArchived.orElse(null)`. */ + fun dateArchived(dateArchived: Optional) = + dateArchived(dateArchived.getOrNull()) + + /** + * Sets [Builder.dateArchived] to an arbitrary JSON value. + * + * You should usually call [Builder.dateArchived] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateArchived(dateArchived: JsonField) = apply { + this.dateArchived = dateArchived + } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The test description. */ + fun description(description: JsonValue) = apply { this.description = description } + + /** The test name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** The test number. */ + fun number(number: Long) = number(JsonField.of(number)) + + /** + * Sets [Builder.number] to an arbitrary JSON value. + * + * You should usually call [Builder.number] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun number(number: JsonField) = apply { this.number = number } + + /** The project version (commit) id where the test was created. */ + fun originProjectVersionId(originProjectVersionId: String?) = + originProjectVersionId(JsonField.ofNullable(originProjectVersionId)) + + /** + * Alias for calling [Builder.originProjectVersionId] with + * `originProjectVersionId.orElse(null)`. + */ + fun originProjectVersionId(originProjectVersionId: Optional) = + originProjectVersionId(originProjectVersionId.getOrNull()) + + /** + * Sets [Builder.originProjectVersionId] to an arbitrary JSON value. + * + * You should usually call [Builder.originProjectVersionId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun originProjectVersionId(originProjectVersionId: JsonField) = apply { + this.originProjectVersionId = originProjectVersionId + } + + /** The test subtype. */ + fun subtype(subtype: Subtype) = subtype(JsonField.of(subtype)) + + /** + * Sets [Builder.subtype] to an arbitrary JSON value. + * + * You should usually call [Builder.subtype] with a well-typed [Subtype] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun subtype(subtype: JsonField) = apply { this.subtype = subtype } + + /** Whether the test is suggested or user-created. */ + fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) + + /** + * Sets [Builder.suggested] to an arbitrary JSON value. + * + * You should usually call [Builder.suggested] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun suggested(suggested: JsonField) = apply { this.suggested = suggested } + + fun thresholds(thresholds: List) = thresholds(JsonField.of(thresholds)) + + /** + * Sets [Builder.thresholds] to an arbitrary JSON value. + * + * You should usually call [Builder.thresholds] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun thresholds(thresholds: JsonField>) = apply { + this.thresholds = thresholds.map { it.toMutableList() } + } + + /** + * Adds a single [Threshold] to [thresholds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addThreshold(threshold: Threshold) = apply { + thresholds = + (thresholds ?: JsonField.of(mutableListOf())).also { + checkKnown("thresholds", it).add(threshold) + } + } + + /** The test type. */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** Whether the test is archived. */ + fun archived(archived: Boolean) = archived(JsonField.of(archived)) + + /** + * Sets [Builder.archived] to an arbitrary JSON value. + * + * You should usually call [Builder.archived] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun archived(archived: JsonField) = apply { this.archived = archived } + + /** The delay window in seconds. Only applies to tests that use production data. */ + fun delayWindow(delayWindow: Double?) = delayWindow(JsonField.ofNullable(delayWindow)) + + /** + * Alias for [Builder.delayWindow]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun delayWindow(delayWindow: Double) = delayWindow(delayWindow as Double?) + + /** Alias for calling [Builder.delayWindow] with `delayWindow.orElse(null)`. */ + fun delayWindow(delayWindow: Optional) = delayWindow(delayWindow.getOrNull()) + + /** + * Sets [Builder.delayWindow] to an arbitrary JSON value. + * + * You should usually call [Builder.delayWindow] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun delayWindow(delayWindow: JsonField) = apply { + this.delayWindow = delayWindow + } + + /** The evaluation window in seconds. Only applies to tests that use production data. */ + fun evaluationWindow(evaluationWindow: Double?) = + evaluationWindow(JsonField.ofNullable(evaluationWindow)) + + /** + * Alias for [Builder.evaluationWindow]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun evaluationWindow(evaluationWindow: Double) = + evaluationWindow(evaluationWindow as Double?) + + /** + * Alias for calling [Builder.evaluationWindow] with `evaluationWindow.orElse(null)`. + */ + fun evaluationWindow(evaluationWindow: Optional) = + evaluationWindow(evaluationWindow.getOrNull()) + + /** + * Sets [Builder.evaluationWindow] to an arbitrary JSON value. + * + * You should usually call [Builder.evaluationWindow] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun evaluationWindow(evaluationWindow: JsonField) = apply { + this.evaluationWindow = evaluationWindow + } + + /** Whether the test uses an ML model. */ + fun usesMlModel(usesMlModel: Boolean) = usesMlModel(JsonField.of(usesMlModel)) + + /** + * Sets [Builder.usesMlModel] to an arbitrary JSON value. + * + * You should usually call [Builder.usesMlModel] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun usesMlModel(usesMlModel: JsonField) = apply { + this.usesMlModel = usesMlModel + } + + /** Whether the test uses production data (monitoring mode only). */ + fun usesProductionData(usesProductionData: Boolean) = + usesProductionData(JsonField.of(usesProductionData)) + + /** + * Sets [Builder.usesProductionData] to an arbitrary JSON value. + * + * You should usually call [Builder.usesProductionData] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun usesProductionData(usesProductionData: JsonField) = apply { + this.usesProductionData = usesProductionData + } + + /** Whether the test uses a reference dataset (monitoring mode only). */ + fun usesReferenceDataset(usesReferenceDataset: Boolean) = + usesReferenceDataset(JsonField.of(usesReferenceDataset)) + + /** + * Sets [Builder.usesReferenceDataset] to an arbitrary JSON value. + * + * You should usually call [Builder.usesReferenceDataset] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun usesReferenceDataset(usesReferenceDataset: JsonField) = apply { + this.usesReferenceDataset = usesReferenceDataset + } + + /** Whether the test uses a training dataset. */ + fun usesTrainingDataset(usesTrainingDataset: Boolean) = + usesTrainingDataset(JsonField.of(usesTrainingDataset)) + + /** + * Sets [Builder.usesTrainingDataset] to an arbitrary JSON value. + * + * You should usually call [Builder.usesTrainingDataset] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun usesTrainingDataset(usesTrainingDataset: JsonField) = apply { + this.usesTrainingDataset = usesTrainingDataset + } + + /** Whether the test uses a validation dataset. */ + fun usesValidationDataset(usesValidationDataset: Boolean) = + usesValidationDataset(JsonField.of(usesValidationDataset)) + + /** + * Sets [Builder.usesValidationDataset] to an arbitrary JSON value. + * + * You should usually call [Builder.usesValidationDataset] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun usesValidationDataset(usesValidationDataset: JsonField) = apply { + this.usesValidationDataset = usesValidationDataset + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Item]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .commentCount() + * .creatorId() + * .dateArchived() + * .dateCreated() + * .dateUpdated() + * .description() + * .name() + * .number() + * .originProjectVersionId() + * .subtype() + * .suggested() + * .thresholds() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Item = + Item( + checkRequired("id", id), + checkRequired("commentCount", commentCount), + checkRequired("creatorId", creatorId), + checkRequired("dateArchived", dateArchived), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("description", description), + checkRequired("name", name), + checkRequired("number", number), + checkRequired("originProjectVersionId", originProjectVersionId), + checkRequired("subtype", subtype), + checkRequired("suggested", suggested), + checkRequired("thresholds", thresholds).map { it.toImmutable() }, + checkRequired("type", type), + archived, + delayWindow, + evaluationWindow, + usesMlModel, + usesProductionData, + usesReferenceDataset, + usesTrainingDataset, + usesValidationDataset, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + commentCount() + creatorId() + dateArchived() + dateCreated() + dateUpdated() + name() + number() + originProjectVersionId() + subtype().validate() + suggested() + thresholds().forEach { it.validate() } + type().validate() + archived() + delayWindow() + evaluationWindow() + usesMlModel() + usesProductionData() + usesReferenceDataset() + usesTrainingDataset() + usesValidationDataset() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (commentCount.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateArchived.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (number.asKnown().isPresent) 1 else 0) + + (if (originProjectVersionId.asKnown().isPresent) 1 else 0) + + (subtype.asKnown().getOrNull()?.validity() ?: 0) + + (if (suggested.asKnown().isPresent) 1 else 0) + + (thresholds.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (archived.asKnown().isPresent) 1 else 0) + + (if (delayWindow.asKnown().isPresent) 1 else 0) + + (if (evaluationWindow.asKnown().isPresent) 1 else 0) + + (if (usesMlModel.asKnown().isPresent) 1 else 0) + + (if (usesProductionData.asKnown().isPresent) 1 else 0) + + (if (usesReferenceDataset.asKnown().isPresent) 1 else 0) + + (if (usesTrainingDataset.asKnown().isPresent) 1 else 0) + + (if (usesValidationDataset.asKnown().isPresent) 1 else 0) + + /** The test subtype. */ + class Subtype @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val ANOMALOUS_COLUMN_COUNT = of("anomalousColumnCount") + + @JvmField val CHARACTER_LENGTH = of("characterLength") + + @JvmField val CLASS_IMBALANCE_RATIO = of("classImbalanceRatio") + + @JvmField val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") + + @JvmField val COLUMN_AVERAGE = of("columnAverage") + + @JvmField val COLUMN_DRIFT = of("columnDrift") + + @JvmField val COLUMN_STATISTIC = of("columnStatistic") + + @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") + + @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") + + @JvmField val CONTAINS_PII = of("containsPii") + + @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") + + @JvmField val CORRELATED_FEATURE_COUNT = of("correlatedFeatureCount") + + @JvmField val CUSTOM_METRIC_THRESHOLD = of("customMetricThreshold") + + @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") + + @JvmField val EMPTY_FEATURE = of("emptyFeature") + + @JvmField val EMPTY_FEATURE_COUNT = of("emptyFeatureCount") + + @JvmField val DRIFTED_FEATURE_COUNT = of("driftedFeatureCount") + + @JvmField val FEATURE_MISSING_VALUES = of("featureMissingValues") + + @JvmField val FEATURE_VALUE_VALIDATION = of("featureValueValidation") + + @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") + + @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") + + @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") + + @JvmField val IS_CODE = of("isCode") + + @JvmField val IS_JSON = of("isJson") + + @JvmField val LLM_RUBRIC_THRESHOLD_V2 = of("llmRubricThresholdV2") + + @JvmField val LABEL_DRIFT = of("labelDrift") + + @JvmField val METRIC_THRESHOLD = of("metricThreshold") + + @JvmField val NEW_CATEGORY_COUNT = of("newCategoryCount") + + @JvmField val NEW_LABEL_COUNT = of("newLabelCount") + + @JvmField val NULL_ROW_COUNT = of("nullRowCount") + + @JvmField val ROW_COUNT = of("rowCount") + + @JvmField val PP_SCORE_VALUE_VALIDATION = of("ppScoreValueValidation") + + @JvmField val QUASI_CONSTANT_FEATURE = of("quasiConstantFeature") + + @JvmField val QUASI_CONSTANT_FEATURE_COUNT = of("quasiConstantFeatureCount") + + @JvmField val SQL_QUERY = of("sqlQuery") + + @JvmField val DTYPE_VALIDATION = of("dtypeValidation") + + @JvmField val SENTENCE_LENGTH = of("sentenceLength") + + @JvmField val SIZE_RATIO = of("sizeRatio") + + @JvmField val SPECIAL_CHARACTERS_RATIO = of("specialCharactersRatio") + + @JvmField val STRING_VALIDATION = of("stringValidation") + + @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") + + @JvmStatic fun of(value: String) = Subtype(JsonField.of(value)) + } + + /** An enum containing [Subtype]'s known values. */ + enum class Known { + ANOMALOUS_COLUMN_COUNT, + CHARACTER_LENGTH, + CLASS_IMBALANCE_RATIO, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_STATISTIC, + COLUMN_VALUES_MATCH, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURE_COUNT, + CUSTOM_METRIC_THRESHOLD, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURE, + EMPTY_FEATURE_COUNT, + DRIFTED_FEATURE_COUNT, + FEATURE_MISSING_VALUES, + FEATURE_VALUE_VALIDATION, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_THRESHOLD_V2, + LABEL_DRIFT, + METRIC_THRESHOLD, + NEW_CATEGORY_COUNT, + NEW_LABEL_COUNT, + NULL_ROW_COUNT, + ROW_COUNT, + PP_SCORE_VALUE_VALIDATION, + QUASI_CONSTANT_FEATURE, + QUASI_CONSTANT_FEATURE_COUNT, + SQL_QUERY, + DTYPE_VALIDATION, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS_RATIO, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + } + + /** + * An enum containing [Subtype]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Subtype] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANOMALOUS_COLUMN_COUNT, + CHARACTER_LENGTH, + CLASS_IMBALANCE_RATIO, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_STATISTIC, + COLUMN_VALUES_MATCH, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURE_COUNT, + CUSTOM_METRIC_THRESHOLD, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURE, + EMPTY_FEATURE_COUNT, + DRIFTED_FEATURE_COUNT, + FEATURE_MISSING_VALUES, + FEATURE_VALUE_VALIDATION, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_THRESHOLD_V2, + LABEL_DRIFT, + METRIC_THRESHOLD, + NEW_CATEGORY_COUNT, + NEW_LABEL_COUNT, + NULL_ROW_COUNT, + ROW_COUNT, + PP_SCORE_VALUE_VALIDATION, + QUASI_CONSTANT_FEATURE, + QUASI_CONSTANT_FEATURE_COUNT, + SQL_QUERY, + DTYPE_VALIDATION, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS_RATIO, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + /** + * An enum member indicating that [Subtype] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANOMALOUS_COLUMN_COUNT -> Value.ANOMALOUS_COLUMN_COUNT + CHARACTER_LENGTH -> Value.CHARACTER_LENGTH + CLASS_IMBALANCE_RATIO -> Value.CLASS_IMBALANCE_RATIO + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Value.COLUMN_AVERAGE + COLUMN_DRIFT -> Value.COLUMN_DRIFT + COLUMN_STATISTIC -> Value.COLUMN_STATISTIC + COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH + CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Value.CONTAINS_PII + CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL + CORRELATED_FEATURE_COUNT -> Value.CORRELATED_FEATURE_COUNT + CUSTOM_METRIC_THRESHOLD -> Value.CUSTOM_METRIC_THRESHOLD + DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT + EMPTY_FEATURE -> Value.EMPTY_FEATURE + EMPTY_FEATURE_COUNT -> Value.EMPTY_FEATURE_COUNT + DRIFTED_FEATURE_COUNT -> Value.DRIFTED_FEATURE_COUNT + FEATURE_MISSING_VALUES -> Value.FEATURE_MISSING_VALUES + FEATURE_VALUE_VALIDATION -> Value.FEATURE_VALUE_VALIDATION + GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT + IS_CODE -> Value.IS_CODE + IS_JSON -> Value.IS_JSON + LLM_RUBRIC_THRESHOLD_V2 -> Value.LLM_RUBRIC_THRESHOLD_V2 + LABEL_DRIFT -> Value.LABEL_DRIFT + METRIC_THRESHOLD -> Value.METRIC_THRESHOLD + NEW_CATEGORY_COUNT -> Value.NEW_CATEGORY_COUNT + NEW_LABEL_COUNT -> Value.NEW_LABEL_COUNT + NULL_ROW_COUNT -> Value.NULL_ROW_COUNT + ROW_COUNT -> Value.ROW_COUNT + PP_SCORE_VALUE_VALIDATION -> Value.PP_SCORE_VALUE_VALIDATION + QUASI_CONSTANT_FEATURE -> Value.QUASI_CONSTANT_FEATURE + QUASI_CONSTANT_FEATURE_COUNT -> Value.QUASI_CONSTANT_FEATURE_COUNT + SQL_QUERY -> Value.SQL_QUERY + DTYPE_VALIDATION -> Value.DTYPE_VALIDATION + SENTENCE_LENGTH -> Value.SENTENCE_LENGTH + SIZE_RATIO -> Value.SIZE_RATIO + SPECIAL_CHARACTERS_RATIO -> Value.SPECIAL_CHARACTERS_RATIO + STRING_VALIDATION -> Value.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ANOMALOUS_COLUMN_COUNT -> Known.ANOMALOUS_COLUMN_COUNT + CHARACTER_LENGTH -> Known.CHARACTER_LENGTH + CLASS_IMBALANCE_RATIO -> Known.CLASS_IMBALANCE_RATIO + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Known.COLUMN_AVERAGE + COLUMN_DRIFT -> Known.COLUMN_DRIFT + COLUMN_STATISTIC -> Known.COLUMN_STATISTIC + COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH + CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Known.CONTAINS_PII + CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL + CORRELATED_FEATURE_COUNT -> Known.CORRELATED_FEATURE_COUNT + CUSTOM_METRIC_THRESHOLD -> Known.CUSTOM_METRIC_THRESHOLD + DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT + EMPTY_FEATURE -> Known.EMPTY_FEATURE + EMPTY_FEATURE_COUNT -> Known.EMPTY_FEATURE_COUNT + DRIFTED_FEATURE_COUNT -> Known.DRIFTED_FEATURE_COUNT + FEATURE_MISSING_VALUES -> Known.FEATURE_MISSING_VALUES + FEATURE_VALUE_VALIDATION -> Known.FEATURE_VALUE_VALIDATION + GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT + IS_CODE -> Known.IS_CODE + IS_JSON -> Known.IS_JSON + LLM_RUBRIC_THRESHOLD_V2 -> Known.LLM_RUBRIC_THRESHOLD_V2 + LABEL_DRIFT -> Known.LABEL_DRIFT + METRIC_THRESHOLD -> Known.METRIC_THRESHOLD + NEW_CATEGORY_COUNT -> Known.NEW_CATEGORY_COUNT + NEW_LABEL_COUNT -> Known.NEW_LABEL_COUNT + NULL_ROW_COUNT -> Known.NULL_ROW_COUNT + ROW_COUNT -> Known.ROW_COUNT + PP_SCORE_VALUE_VALIDATION -> Known.PP_SCORE_VALUE_VALIDATION + QUASI_CONSTANT_FEATURE -> Known.QUASI_CONSTANT_FEATURE + QUASI_CONSTANT_FEATURE_COUNT -> Known.QUASI_CONSTANT_FEATURE_COUNT + SQL_QUERY -> Known.SQL_QUERY + DTYPE_VALIDATION -> Known.DTYPE_VALIDATION + SENTENCE_LENGTH -> Known.SENTENCE_LENGTH + SIZE_RATIO -> Known.SIZE_RATIO + SPECIAL_CHARACTERS_RATIO -> Known.SPECIAL_CHARACTERS_RATIO + STRING_VALIDATION -> Known.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> throw OpenlayerInvalidDataException("Unknown Subtype: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Subtype = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Subtype && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Threshold + private constructor( + private val insightName: JsonField, + private val insightParameters: JsonField>, + private val measurement: JsonField, + private val operator: JsonField, + private val thresholdMode: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("insightName") + @ExcludeMissing + insightName: JsonField = JsonMissing.of(), + @JsonProperty("insightParameters") + @ExcludeMissing + insightParameters: JsonField> = JsonMissing.of(), + @JsonProperty("measurement") + @ExcludeMissing + measurement: JsonField = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + operator: JsonField = JsonMissing.of(), + @JsonProperty("thresholdMode") + @ExcludeMissing + thresholdMode: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + ) : this( + insightName, + insightParameters, + measurement, + operator, + thresholdMode, + value, + mutableMapOf(), + ) + + /** + * The insight name to be evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun insightName(): Optional = insightName.getOptional("insightName") + + /** + * The insight parameters. Required only for some test subtypes. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun insightParameters(): Optional> = + insightParameters.getOptional("insightParameters") + + /** + * The measurement to be evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun measurement(): Optional = measurement.getOptional("measurement") + + /** + * The operator to be used for the evaluation. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun operator(): Optional = operator.getOptional("operator") + + /** + * Whether to use automatic anomaly detection or manual thresholds + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun thresholdMode(): Optional = + thresholdMode.getOptional("thresholdMode") + + /** + * The value to be compared. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun value(): Optional = value.getOptional("value") + + /** + * Returns the raw JSON value of [insightName]. + * + * Unlike [insightName], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("insightName") + @ExcludeMissing + fun _insightName(): JsonField = insightName + + /** + * Returns the raw JSON value of [insightParameters]. + * + * Unlike [insightParameters], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("insightParameters") + @ExcludeMissing + fun _insightParameters(): JsonField> = insightParameters + + /** + * Returns the raw JSON value of [measurement]. + * + * Unlike [measurement], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("measurement") + @ExcludeMissing + fun _measurement(): JsonField = measurement + + /** + * Returns the raw JSON value of [operator]. + * + * Unlike [operator], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("operator") + @ExcludeMissing + fun _operator(): JsonField = operator + + /** + * Returns the raw JSON value of [thresholdMode]. + * + * Unlike [thresholdMode], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("thresholdMode") + @ExcludeMissing + fun _thresholdMode(): JsonField = thresholdMode + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Threshold]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Threshold]. */ + class Builder internal constructor() { + + private var insightName: JsonField = JsonMissing.of() + private var insightParameters: JsonField>? = null + private var measurement: JsonField = JsonMissing.of() + private var operator: JsonField = JsonMissing.of() + private var thresholdMode: JsonField = JsonMissing.of() + private var value: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(threshold: Threshold) = apply { + insightName = threshold.insightName + insightParameters = threshold.insightParameters.map { it.toMutableList() } + measurement = threshold.measurement + operator = threshold.operator + thresholdMode = threshold.thresholdMode + value = threshold.value + additionalProperties = threshold.additionalProperties.toMutableMap() + } + + /** The insight name to be evaluated. */ + fun insightName(insightName: String) = insightName(JsonField.of(insightName)) + + /** + * Sets [Builder.insightName] to an arbitrary JSON value. + * + * You should usually call [Builder.insightName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun insightName(insightName: JsonField) = apply { + this.insightName = insightName + } + + /** The insight parameters. Required only for some test subtypes. */ + fun insightParameters(insightParameters: List?) = + insightParameters(JsonField.ofNullable(insightParameters)) + + /** + * Alias for calling [Builder.insightParameters] with + * `insightParameters.orElse(null)`. + */ + fun insightParameters(insightParameters: Optional>) = + insightParameters(insightParameters.getOrNull()) + + /** + * Sets [Builder.insightParameters] to an arbitrary JSON value. + * + * You should usually call [Builder.insightParameters] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun insightParameters(insightParameters: JsonField>) = + apply { + this.insightParameters = insightParameters.map { it.toMutableList() } + } + + /** + * Adds a single [InsightParameter] to [insightParameters]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addInsightParameter(insightParameter: InsightParameter) = apply { + insightParameters = + (insightParameters ?: JsonField.of(mutableListOf())).also { + checkKnown("insightParameters", it).add(insightParameter) + } + } + + /** The measurement to be evaluated. */ + fun measurement(measurement: String) = measurement(JsonField.of(measurement)) + + /** + * Sets [Builder.measurement] to an arbitrary JSON value. + * + * You should usually call [Builder.measurement] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun measurement(measurement: JsonField) = apply { + this.measurement = measurement + } + + /** The operator to be used for the evaluation. */ + fun operator(operator: Operator) = operator(JsonField.of(operator)) + + /** + * Sets [Builder.operator] to an arbitrary JSON value. + * + * You should usually call [Builder.operator] with a well-typed [Operator] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun operator(operator: JsonField) = apply { this.operator = operator } + + /** Whether to use automatic anomaly detection or manual thresholds */ + fun thresholdMode(thresholdMode: ThresholdMode) = + thresholdMode(JsonField.of(thresholdMode)) + + /** + * Sets [Builder.thresholdMode] to an arbitrary JSON value. + * + * You should usually call [Builder.thresholdMode] with a well-typed [ThresholdMode] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun thresholdMode(thresholdMode: JsonField) = apply { + this.thresholdMode = thresholdMode + } + + /** The value to be compared. */ + fun value(value: Value) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [Value] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + /** Alias for calling [value] with `Value.ofNumber(number)`. */ + fun value(number: Double) = value(Value.ofNumber(number)) + + /** Alias for calling [value] with `Value.ofBool(bool)`. */ + fun value(bool: Boolean) = value(Value.ofBool(bool)) + + /** Alias for calling [value] with `Value.ofString(string)`. */ + fun value(string: String) = value(Value.ofString(string)) + + /** Alias for calling [value] with `Value.ofStrings(strings)`. */ + fun valueOfStrings(strings: List) = value(Value.ofStrings(strings)) + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Threshold]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Threshold = + Threshold( + insightName, + (insightParameters ?: JsonMissing.of()).map { it.toImmutable() }, + measurement, + operator, + thresholdMode, + value, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Threshold = apply { + if (validated) { + return@apply + } + + insightName() + insightParameters().ifPresent { it.forEach { it.validate() } } + measurement() + operator().ifPresent { it.validate() } + thresholdMode().ifPresent { it.validate() } + value().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (insightName.asKnown().isPresent) 1 else 0) + + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } + ?: 0) + + (if (measurement.asKnown().isPresent) 1 else 0) + + (operator.asKnown().getOrNull()?.validity() ?: 0) + + (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + + (value.asKnown().getOrNull()?.validity() ?: 0) + + class InsightParameter + private constructor( + private val name: JsonField, + private val value: JsonValue, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonValue = JsonMissing.of(), + ) : this(name, value, mutableMapOf()) + + /** + * The name of the insight filter. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun name(): String = name.getRequired("name") + + @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [InsightParameter]. + * + * The following fields are required: + * ```java + * .name() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InsightParameter]. */ + class Builder internal constructor() { + + private var name: JsonField? = null + private var value: JsonValue? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(insightParameter: InsightParameter) = apply { + name = insightParameter.name + value = insightParameter.value + additionalProperties = insightParameter.additionalProperties.toMutableMap() + } + + /** The name of the insight filter. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun value(value: JsonValue) = apply { this.value = value } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [InsightParameter]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .name() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): InsightParameter = + InsightParameter( + checkRequired("name", name), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): InsightParameter = apply { + if (validated) { + return@apply + } + + name() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (if (name.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InsightParameter && name == other.name && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(name, value, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InsightParameter{name=$name, value=$value, additionalProperties=$additionalProperties}" + } + + /** The operator to be used for the evaluation. */ + class Operator @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val IS = of("is") + + @JvmField val GREATER = of(">") + + @JvmField val GREATER_OR_EQUALS = of(">=") + + @JvmField val LESS = of("<") + + @JvmField val LESS_OR_EQUALS = of("<=") + + @JvmField val NOT_EQUALS = of("!=") + + @JvmStatic fun of(value: String) = Operator(JsonField.of(value)) + } + + /** An enum containing [Operator]'s known values. */ + enum class Known { + IS, + GREATER, + GREATER_OR_EQUALS, + LESS, + LESS_OR_EQUALS, + NOT_EQUALS, + } + + /** + * An enum containing [Operator]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Operator] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + IS, + GREATER, + GREATER_OR_EQUALS, + LESS, + LESS_OR_EQUALS, + NOT_EQUALS, + /** + * An enum member indicating that [Operator] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + IS -> Value.IS + GREATER -> Value.GREATER + GREATER_OR_EQUALS -> Value.GREATER_OR_EQUALS + LESS -> Value.LESS + LESS_OR_EQUALS -> Value.LESS_OR_EQUALS + NOT_EQUALS -> Value.NOT_EQUALS + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + IS -> Known.IS + GREATER -> Known.GREATER + GREATER_OR_EQUALS -> Known.GREATER_OR_EQUALS + LESS -> Known.LESS + LESS_OR_EQUALS -> Known.LESS_OR_EQUALS + NOT_EQUALS -> Known.NOT_EQUALS + else -> throw OpenlayerInvalidDataException("Unknown Operator: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Operator = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Operator && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Whether to use automatic anomaly detection or manual thresholds */ + class ThresholdMode + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val AUTOMATIC = of("automatic") + + @JvmField val MANUAL = of("manual") + + @JvmStatic fun of(value: String) = ThresholdMode(JsonField.of(value)) + } + + /** An enum containing [ThresholdMode]'s known values. */ + enum class Known { + AUTOMATIC, + MANUAL, + } + + /** + * An enum containing [ThresholdMode]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [ThresholdMode] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + AUTOMATIC, + MANUAL, + /** + * An enum member indicating that [ThresholdMode] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + AUTOMATIC -> Value.AUTOMATIC + MANUAL -> Value.MANUAL + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + AUTOMATIC -> Known.AUTOMATIC + MANUAL -> Known.MANUAL + else -> throw OpenlayerInvalidDataException("Unknown ThresholdMode: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): ThresholdMode = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ThresholdMode && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The value to be compared. */ + @JsonDeserialize(using = Value.Deserializer::class) + @JsonSerialize(using = Value.Serializer::class) + class Value + private constructor( + private val number: Double? = null, + private val bool: Boolean? = null, + private val string: String? = null, + private val strings: List? = null, + private val _json: JsonValue? = null, + ) { + + fun number(): Optional = Optional.ofNullable(number) + + fun bool(): Optional = Optional.ofNullable(bool) + + fun string(): Optional = Optional.ofNullable(string) + + fun strings(): Optional> = Optional.ofNullable(strings) + + fun isNumber(): Boolean = number != null + + fun isBool(): Boolean = bool != null + + fun isString(): Boolean = string != null + + fun isStrings(): Boolean = strings != null + + fun asNumber(): Double = number.getOrThrow("number") + + fun asBool(): Boolean = bool.getOrThrow("bool") + + fun asString(): String = string.getOrThrow("string") + + fun asStrings(): List = strings.getOrThrow("strings") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T = + when { + number != null -> visitor.visitNumber(number) + bool != null -> visitor.visitBool(bool) + string != null -> visitor.visitString(string) + strings != null -> visitor.visitStrings(strings) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + fun validate(): Value = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitNumber(number: Double) {} + + override fun visitBool(bool: Boolean) {} + + override fun visitString(string: String) {} + + override fun visitStrings(strings: List) {} + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitNumber(number: Double) = 1 + + override fun visitBool(bool: Boolean) = 1 + + override fun visitString(string: String) = 1 + + override fun visitStrings(strings: List) = strings.size + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Value && number == other.number && bool == other.bool && string == other.string && strings == other.strings /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(number, bool, string, strings) /* spotless:on */ + + override fun toString(): String = + when { + number != null -> "Value{number=$number}" + bool != null -> "Value{bool=$bool}" + string != null -> "Value{string=$string}" + strings != null -> "Value{strings=$strings}" + _json != null -> "Value{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Value") + } + + companion object { + + @JvmStatic fun ofNumber(number: Double) = Value(number = number) + + @JvmStatic fun ofBool(bool: Boolean) = Value(bool = bool) + + @JvmStatic fun ofString(string: String) = Value(string = string) + + @JvmStatic fun ofStrings(strings: List) = Value(strings = strings) + } + + /** + * An interface that defines how to map each variant of [Value] to a value of type + * [T]. + */ + interface Visitor { + + fun visitNumber(number: Double): T + + fun visitBool(bool: Boolean): T + + fun visitString(string: String): T + + fun visitStrings(strings: List): T + + /** + * Maps an unknown variant of [Value] to a value of type [T]. + * + * An instance of [Value] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on + * an older version than the API, then the API may respond with new variants + * that the SDK is unaware of. + * + * @throws OpenlayerInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw OpenlayerInvalidDataException("Unknown Value: $json") + } + } + + internal class Deserializer : BaseDeserializer(Value::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Value { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef())?.let { + Value(number = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Value(bool = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Value(string = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef>())?.let { + Value(strings = it, _json = json) + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely + // incompatible with all the possible variants (e.g. deserializing from + // object). + 0 -> Value(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then use + // the first completely valid match, or simply the first match if none + // are completely valid. + else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + } + } + } + + internal class Serializer : BaseSerializer(Value::class) { + + override fun serialize( + value: Value, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.number != null -> generator.writeObject(value.number) + value.bool != null -> generator.writeObject(value.bool) + value.string != null -> generator.writeObject(value.string) + value.strings != null -> generator.writeObject(value.strings) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Value") + } + } + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Threshold && insightName == other.insightName && insightParameters == other.insightParameters && measurement == other.measurement && operator == other.operator && thresholdMode == other.thresholdMode && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(insightName, insightParameters, measurement, operator, thresholdMode, value, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Threshold{insightName=$insightName, insightParameters=$insightParameters, measurement=$measurement, operator=$operator, thresholdMode=$thresholdMode, value=$value, additionalProperties=$additionalProperties}" + } + + /** The test type. */ + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val INTEGRITY = of("integrity") + + @JvmField val CONSISTENCY = of("consistency") + + @JvmField val PERFORMANCE = of("performance") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + INTEGRITY -> Value.INTEGRITY + CONSISTENCY -> Value.CONSISTENCY + PERFORMANCE -> Value.PERFORMANCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + INTEGRITY -> Known.INTEGRITY + CONSISTENCY -> Known.CONSISTENCY + PERFORMANCE -> Known.PERFORMANCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Item && id == other.id && commentCount == other.commentCount && creatorId == other.creatorId && dateArchived == other.dateArchived && dateCreated == other.dateCreated && dateUpdated == other.dateUpdated && description == other.description && name == other.name && number == other.number && originProjectVersionId == other.originProjectVersionId && subtype == other.subtype && suggested == other.suggested && thresholds == other.thresholds && type == other.type && archived == other.archived && delayWindow == other.delayWindow && evaluationWindow == other.evaluationWindow && usesMlModel == other.usesMlModel && usesProductionData == other.usesProductionData && usesReferenceDataset == other.usesReferenceDataset && usesTrainingDataset == other.usesTrainingDataset && usesValidationDataset == other.usesValidationDataset && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, commentCount, creatorId, dateArchived, dateCreated, dateUpdated, description, name, number, originProjectVersionId, subtype, suggested, thresholds, type, archived, delayWindow, evaluationWindow, usesMlModel, usesProductionData, usesReferenceDataset, usesTrainingDataset, usesValidationDataset, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Item{id=$id, commentCount=$commentCount, creatorId=$creatorId, dateArchived=$dateArchived, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, name=$name, number=$number, originProjectVersionId=$originProjectVersionId, subtype=$subtype, suggested=$suggested, thresholds=$thresholds, type=$type, archived=$archived, delayWindow=$delayWindow, evaluationWindow=$evaluationWindow, usesMlModel=$usesMlModel, usesProductionData=$usesProductionData, usesReferenceDataset=$usesReferenceDataset, usesTrainingDataset=$usesTrainingDataset, usesValidationDataset=$usesValidationDataset, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TestListResponse && _meta == other._meta && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(_meta, items, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TestListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsync.kt index 7a18e5bd..11ccd47b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsync.kt @@ -7,6 +7,8 @@ import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.projects.tests.TestCreateParams import com.openlayer.api.models.projects.tests.TestCreateResponse +import com.openlayer.api.models.projects.tests.TestListParams +import com.openlayer.api.models.projects.tests.TestListResponse import java.util.concurrent.CompletableFuture interface TestServiceAsync { @@ -26,6 +28,16 @@ interface TestServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** List tests under a project. */ + fun list(params: TestListParams): CompletableFuture = + list(params, RequestOptions.none()) + + /** @see [list] */ + fun list( + params: TestListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + /** A view of [TestServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -45,5 +57,20 @@ interface TestServiceAsync { params: TestCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /projects/{projectId}/tests`, but is otherwise the + * same as [TestServiceAsync.list]. + */ + @MustBeClosed + fun list(params: TestListParams): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + params: TestListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncImpl.kt index c1203bfb..a4bb054e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncImpl.kt @@ -17,6 +17,8 @@ import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.models.projects.tests.TestCreateParams import com.openlayer.api.models.projects.tests.TestCreateResponse +import com.openlayer.api.models.projects.tests.TestListParams +import com.openlayer.api.models.projects.tests.TestListResponse import java.util.concurrent.CompletableFuture class TestServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -35,6 +37,13 @@ class TestServiceAsyncImpl internal constructor(private val clientOptions: Clien // post /projects/{projectId}/tests withRawResponse().create(params, requestOptions).thenApply { it.parse() } + override fun list( + params: TestListParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /projects/{projectId}/tests + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : TestServiceAsync.WithRawResponse { @@ -69,5 +78,34 @@ class TestServiceAsyncImpl internal constructor(private val clientOptions: Clien } } } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun list( + params: TestListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects", params._pathParam(0), "tests") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestService.kt index 2b1c881c..4c272d6b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestService.kt @@ -7,6 +7,8 @@ import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.projects.tests.TestCreateParams import com.openlayer.api.models.projects.tests.TestCreateResponse +import com.openlayer.api.models.projects.tests.TestListParams +import com.openlayer.api.models.projects.tests.TestListResponse interface TestService { @@ -24,6 +26,15 @@ interface TestService { requestOptions: RequestOptions = RequestOptions.none(), ): TestCreateResponse + /** List tests under a project. */ + fun list(params: TestListParams): TestListResponse = list(params, RequestOptions.none()) + + /** @see [list] */ + fun list( + params: TestListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): TestListResponse + /** A view of [TestService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -41,5 +52,20 @@ interface TestService { params: TestCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /projects/{projectId}/tests`, but is otherwise the + * same as [TestService.list]. + */ + @MustBeClosed + fun list(params: TestListParams): HttpResponseFor = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + params: TestListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestServiceImpl.kt index 16b09e4c..685e51bd 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestServiceImpl.kt @@ -17,6 +17,8 @@ import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.models.projects.tests.TestCreateParams import com.openlayer.api.models.projects.tests.TestCreateResponse +import com.openlayer.api.models.projects.tests.TestListParams +import com.openlayer.api.models.projects.tests.TestListResponse class TestServiceImpl internal constructor(private val clientOptions: ClientOptions) : TestService { @@ -33,6 +35,10 @@ class TestServiceImpl internal constructor(private val clientOptions: ClientOpti // post /projects/{projectId}/tests withRawResponse().create(params, requestOptions).parse() + override fun list(params: TestListParams, requestOptions: RequestOptions): TestListResponse = + // get /projects/{projectId}/tests + withRawResponse().list(params, requestOptions).parse() + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : TestService.WithRawResponse { @@ -64,5 +70,31 @@ class TestServiceImpl internal constructor(private val clientOptions: ClientOpti } } } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun list( + params: TestListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects", params._pathParam(0), "tests") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListParamsTest.kt new file mode 100644 index 00000000..e3c72200 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListParamsTest.kt @@ -0,0 +1,74 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.projects.tests + +import com.openlayer.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class TestListParamsTest { + + @Test + fun create() { + TestListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeArchived(true) + .originVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .page(1L) + .perPage(1L) + .suggested(true) + .type(TestListParams.Type.INTEGRITY) + .usesProductionData(true) + .build() + } + + @Test + fun pathParams() { + val params = + TestListParams.builder().projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun queryParams() { + val params = + TestListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeArchived(true) + .originVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .page(1L) + .perPage(1L) + .suggested(true) + .type(TestListParams.Type.INTEGRITY) + .usesProductionData(true) + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("includeArchived", "true") + .put("originVersionId", "3fa85f64-5717-4562-b3fc-2c963f66afa6") + .put("page", "1") + .put("perPage", "1") + .put("suggested", "true") + .put("type", "integrity") + .put("usesProductionData", "true") + .build() + ) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = + TestListParams.builder().projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt new file mode 100644 index 00000000..915e8704 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt @@ -0,0 +1,196 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.projects.tests + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class TestListResponseTest { + + @Test + fun create() { + val testListResponse = + TestListResponse.builder() + ._meta( + TestListResponse._Meta + .builder() + .page(1L) + .perPage(1L) + .totalItems(0L) + .totalPages(0L) + .build() + ) + .addItem( + TestListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(0L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description( + JsonValue.from("This test checks for duplicate rows in the dataset.") + ) + .name("No duplicate rows") + .number(1L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype(TestListResponse.Item.Subtype.DUPLICATE_ROW_COUNT) + .suggested(false) + .addThreshold( + TestListResponse.Item.Threshold.builder() + .insightName("duplicateRowCount") + .addInsightParameter( + TestListResponse.Item.Threshold.InsightParameter.builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) + .measurement("duplicateRowCount") + .operator(TestListResponse.Item.Threshold.Operator.LESS_OR_EQUALS) + .thresholdMode( + TestListResponse.Item.Threshold.ThresholdMode.AUTOMATIC + ) + .value(0.0) + .build() + ) + .type(TestListResponse.Item.Type.INTEGRITY) + .archived(false) + .delayWindow(0.0) + .evaluationWindow(3600.0) + .usesMlModel(false) + .usesProductionData(false) + .usesReferenceDataset(false) + .usesTrainingDataset(false) + .usesValidationDataset(true) + .build() + ) + .build() + + assertThat(testListResponse._meta()) + .isEqualTo( + TestListResponse._Meta + .builder() + .page(1L) + .perPage(1L) + .totalItems(0L) + .totalPages(0L) + .build() + ) + assertThat(testListResponse.items()) + .containsExactly( + TestListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(0L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description( + JsonValue.from("This test checks for duplicate rows in the dataset.") + ) + .name("No duplicate rows") + .number(1L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype(TestListResponse.Item.Subtype.DUPLICATE_ROW_COUNT) + .suggested(false) + .addThreshold( + TestListResponse.Item.Threshold.builder() + .insightName("duplicateRowCount") + .addInsightParameter( + TestListResponse.Item.Threshold.InsightParameter.builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) + .measurement("duplicateRowCount") + .operator(TestListResponse.Item.Threshold.Operator.LESS_OR_EQUALS) + .thresholdMode(TestListResponse.Item.Threshold.ThresholdMode.AUTOMATIC) + .value(0.0) + .build() + ) + .type(TestListResponse.Item.Type.INTEGRITY) + .archived(false) + .delayWindow(0.0) + .evaluationWindow(3600.0) + .usesMlModel(false) + .usesProductionData(false) + .usesReferenceDataset(false) + .usesTrainingDataset(false) + .usesValidationDataset(true) + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val testListResponse = + TestListResponse.builder() + ._meta( + TestListResponse._Meta + .builder() + .page(1L) + .perPage(1L) + .totalItems(0L) + .totalPages(0L) + .build() + ) + .addItem( + TestListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(0L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description( + JsonValue.from("This test checks for duplicate rows in the dataset.") + ) + .name("No duplicate rows") + .number(1L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype(TestListResponse.Item.Subtype.DUPLICATE_ROW_COUNT) + .suggested(false) + .addThreshold( + TestListResponse.Item.Threshold.builder() + .insightName("duplicateRowCount") + .addInsightParameter( + TestListResponse.Item.Threshold.InsightParameter.builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) + .measurement("duplicateRowCount") + .operator(TestListResponse.Item.Threshold.Operator.LESS_OR_EQUALS) + .thresholdMode( + TestListResponse.Item.Threshold.ThresholdMode.AUTOMATIC + ) + .value(0.0) + .build() + ) + .type(TestListResponse.Item.Type.INTEGRITY) + .archived(false) + .delayWindow(0.0) + .evaluationWindow(3600.0) + .usesMlModel(false) + .usesProductionData(false) + .usesReferenceDataset(false) + .usesTrainingDataset(false) + .usesValidationDataset(true) + .build() + ) + .build() + + val roundtrippedTestListResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(testListResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedTestListResponse).isEqualTo(testListResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt index 55fc392c..cc01be9e 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt @@ -6,6 +6,7 @@ import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync import com.openlayer.api.core.JsonValue import com.openlayer.api.models.projects.tests.TestCreateParams +import com.openlayer.api.models.projects.tests.TestListParams import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -70,4 +71,31 @@ internal class TestServiceAsyncTest { val test = testFuture.get() test.validate() } + + @Test + fun list() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val testServiceAsync = client.projects().tests() + + val testsFuture = + testServiceAsync.list( + TestListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeArchived(true) + .originVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .page(1L) + .perPage(1L) + .suggested(true) + .type(TestListParams.Type.INTEGRITY) + .usesProductionData(true) + .build() + ) + + val tests = testsFuture.get() + tests.validate() + } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt index c754201d..ec3b3e75 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt @@ -6,6 +6,7 @@ import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.core.JsonValue import com.openlayer.api.models.projects.tests.TestCreateParams +import com.openlayer.api.models.projects.tests.TestListParams import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -69,4 +70,30 @@ internal class TestServiceTest { test.validate() } + + @Test + fun list() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val testService = client.projects().tests() + + val tests = + testService.list( + TestListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeArchived(true) + .originVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .page(1L) + .perPage(1L) + .suggested(true) + .type(TestListParams.Type.INTEGRITY) + .usesProductionData(true) + .build() + ) + + tests.validate() + } } From 76afcb9b2d3f5ab89cd420cbdb084ab400ce5622 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 21:19:16 +0000 Subject: [PATCH 67/74] feat(api): api update --- .stats.yml | 2 +- .../models/projects/tests/TestListResponse.kt | 316 +----------------- .../projects/tests/TestListResponseTest.kt | 28 -- 3 files changed, 7 insertions(+), 339 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1dee8043..279dd7b9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 17 -openapi_spec_hash: 8827ead72aa0c635ccafac5e008fe247 +openapi_spec_hash: a9c2f380c41389904ec243caa6fd4cc8 config_hash: 087e6b8013c398a6d24031d24594fdec diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt index b42c76fd..a861673e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt @@ -34,22 +34,14 @@ import kotlin.jvm.optionals.getOrNull class TestListResponse private constructor( - private val _meta: JsonField<_Meta>, private val items: JsonField>, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("_meta") @ExcludeMissing _meta: JsonField<_Meta> = JsonMissing.of(), - @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of(), - ) : this(_meta, items, mutableMapOf()) - - /** - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun _meta(): _Meta = _meta.getRequired("_meta") + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is @@ -57,13 +49,6 @@ private constructor( */ fun items(): List = items.getRequired("items") - /** - * Returns the raw JSON value of [_meta]. - * - * Unlike [_meta], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("_meta") @ExcludeMissing fun __meta(): JsonField<_Meta> = _meta - /** * Returns the raw JSON value of [items]. * @@ -90,7 +75,6 @@ private constructor( * * The following fields are required: * ```java - * ._meta() * .items() * ``` */ @@ -100,27 +84,15 @@ private constructor( /** A builder for [TestListResponse]. */ class Builder internal constructor() { - private var _meta: JsonField<_Meta>? = null private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(testListResponse: TestListResponse) = apply { - _meta = testListResponse._meta items = testListResponse.items.map { it.toMutableList() } additionalProperties = testListResponse.additionalProperties.toMutableMap() } - fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta)) - - /** - * Sets [Builder._meta] to an arbitrary JSON value. - * - * You should usually call [Builder._meta] with a well-typed [_Meta] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } - fun items(items: List) = items(JsonField.of(items)) /** @@ -170,7 +142,6 @@ private constructor( * * The following fields are required: * ```java - * ._meta() * .items() * ``` * @@ -178,7 +149,6 @@ private constructor( */ fun build(): TestListResponse = TestListResponse( - checkRequired("_meta", _meta), checkRequired("items", items).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) @@ -191,7 +161,6 @@ private constructor( return@apply } - _meta().validate() items().forEach { it.validate() } validated = true } @@ -211,280 +180,7 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (_meta.asKnown().getOrNull()?.validity() ?: 0) + - (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - class _Meta - private constructor( - private val page: JsonField, - private val perPage: JsonField, - private val totalItems: JsonField, - private val totalPages: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("page") @ExcludeMissing page: JsonField = JsonMissing.of(), - @JsonProperty("perPage") @ExcludeMissing perPage: JsonField = JsonMissing.of(), - @JsonProperty("totalItems") - @ExcludeMissing - totalItems: JsonField = JsonMissing.of(), - @JsonProperty("totalPages") - @ExcludeMissing - totalPages: JsonField = JsonMissing.of(), - ) : this(page, perPage, totalItems, totalPages, mutableMapOf()) - - /** - * The current page. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun page(): Long = page.getRequired("page") - - /** - * The number of items per page. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun perPage(): Long = perPage.getRequired("perPage") - - /** - * The total number of items. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun totalItems(): Long = totalItems.getRequired("totalItems") - - /** - * The total number of pages. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun totalPages(): Long = totalPages.getRequired("totalPages") - - /** - * Returns the raw JSON value of [page]. - * - * Unlike [page], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("page") @ExcludeMissing fun _page(): JsonField = page - - /** - * Returns the raw JSON value of [perPage]. - * - * Unlike [perPage], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("perPage") @ExcludeMissing fun _perPage(): JsonField = perPage - - /** - * Returns the raw JSON value of [totalItems]. - * - * Unlike [totalItems], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("totalItems") @ExcludeMissing fun _totalItems(): JsonField = totalItems - - /** - * Returns the raw JSON value of [totalPages]. - * - * Unlike [totalPages], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("totalPages") @ExcludeMissing fun _totalPages(): JsonField = totalPages - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [_Meta]. - * - * The following fields are required: - * ```java - * .page() - * .perPage() - * .totalItems() - * .totalPages() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [_Meta]. */ - class Builder internal constructor() { - - private var page: JsonField? = null - private var perPage: JsonField? = null - private var totalItems: JsonField? = null - private var totalPages: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(_meta: _Meta) = apply { - page = _meta.page - perPage = _meta.perPage - totalItems = _meta.totalItems - totalPages = _meta.totalPages - additionalProperties = _meta.additionalProperties.toMutableMap() - } - - /** The current page. */ - fun page(page: Long) = page(JsonField.of(page)) - - /** - * Sets [Builder.page] to an arbitrary JSON value. - * - * You should usually call [Builder.page] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun page(page: JsonField) = apply { this.page = page } - - /** The number of items per page. */ - fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) - - /** - * Sets [Builder.perPage] to an arbitrary JSON value. - * - * You should usually call [Builder.perPage] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun perPage(perPage: JsonField) = apply { this.perPage = perPage } - - /** The total number of items. */ - fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) - - /** - * Sets [Builder.totalItems] to an arbitrary JSON value. - * - * You should usually call [Builder.totalItems] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } - - /** The total number of pages. */ - fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) - - /** - * Sets [Builder.totalPages] to an arbitrary JSON value. - * - * You should usually call [Builder.totalPages] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [_Meta]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .page() - * .perPage() - * .totalItems() - * .totalPages() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): _Meta = - _Meta( - checkRequired("page", page), - checkRequired("perPage", perPage), - checkRequired("totalItems", totalItems), - checkRequired("totalPages", totalPages), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): _Meta = apply { - if (validated) { - return@apply - } - - page() - perPage() - totalItems() - totalPages() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OpenlayerInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (page.asKnown().isPresent) 1 else 0) + - (if (perPage.asKnown().isPresent) 1 else 0) + - (if (totalItems.asKnown().isPresent) 1 else 0) + - (if (totalPages.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is _Meta && page == other.page && perPage == other.perPage && totalItems == other.totalItems && totalPages == other.totalPages && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(page, perPage, totalItems, totalPages, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" - } + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) class Item private constructor( @@ -3120,15 +2816,15 @@ private constructor( return true } - return /* spotless:off */ other is TestListResponse && _meta == other._meta && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TestListResponse && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(_meta, items, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(items, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TestListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + "TestListResponse{items=$items, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt index 915e8704..d92c9094 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt @@ -15,15 +15,6 @@ internal class TestListResponseTest { fun create() { val testListResponse = TestListResponse.builder() - ._meta( - TestListResponse._Meta - .builder() - .page(1L) - .perPage(1L) - .totalItems(0L) - .totalPages(0L) - .build() - ) .addItem( TestListResponse.Item.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -70,16 +61,6 @@ internal class TestListResponseTest { ) .build() - assertThat(testListResponse._meta()) - .isEqualTo( - TestListResponse._Meta - .builder() - .page(1L) - .perPage(1L) - .totalItems(0L) - .totalPages(0L) - .build() - ) assertThat(testListResponse.items()) .containsExactly( TestListResponse.Item.builder() @@ -130,15 +111,6 @@ internal class TestListResponseTest { val jsonMapper = jsonMapper() val testListResponse = TestListResponse.builder() - ._meta( - TestListResponse._Meta - .builder() - .page(1L) - .perPage(1L) - .totalItems(0L) - .totalPages(0L) - .build() - ) .addItem( TestListResponse.Item.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") From e8b984c7c9efde4ecfff57307652f71dc872f900 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 21:25:47 +0000 Subject: [PATCH 68/74] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 279dd7b9..69b1757b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 17 -openapi_spec_hash: a9c2f380c41389904ec243caa6fd4cc8 +openapi_spec_hash: 17fb5502c19253c7c89785273e89b023 config_hash: 087e6b8013c398a6d24031d24594fdec From 8fdd96d6b76ffdbf24914b50cf5d57197bbcd1ab Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 21:27:55 +0000 Subject: [PATCH 69/74] feat(api): expose test retrieval endpoint --- .stats.yml | 2 +- .../models/projects/tests/TestListResponse.kt | 316 +++++++++++++++++- .../projects/tests/TestListResponseTest.kt | 28 ++ 3 files changed, 339 insertions(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index 69b1757b..1dee8043 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 17 -openapi_spec_hash: 17fb5502c19253c7c89785273e89b023 +openapi_spec_hash: 8827ead72aa0c635ccafac5e008fe247 config_hash: 087e6b8013c398a6d24031d24594fdec diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt index a861673e..b42c76fd 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt @@ -34,14 +34,22 @@ import kotlin.jvm.optionals.getOrNull class TestListResponse private constructor( + private val _meta: JsonField<_Meta>, private val items: JsonField>, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() - ) : this(items, mutableMapOf()) + @JsonProperty("_meta") @ExcludeMissing _meta: JsonField<_Meta> = JsonMissing.of(), + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of(), + ) : this(_meta, items, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun _meta(): _Meta = _meta.getRequired("_meta") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is @@ -49,6 +57,13 @@ private constructor( */ fun items(): List = items.getRequired("items") + /** + * Returns the raw JSON value of [_meta]. + * + * Unlike [_meta], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("_meta") @ExcludeMissing fun __meta(): JsonField<_Meta> = _meta + /** * Returns the raw JSON value of [items]. * @@ -75,6 +90,7 @@ private constructor( * * The following fields are required: * ```java + * ._meta() * .items() * ``` */ @@ -84,15 +100,27 @@ private constructor( /** A builder for [TestListResponse]. */ class Builder internal constructor() { + private var _meta: JsonField<_Meta>? = null private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(testListResponse: TestListResponse) = apply { + _meta = testListResponse._meta items = testListResponse.items.map { it.toMutableList() } additionalProperties = testListResponse.additionalProperties.toMutableMap() } + fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta)) + + /** + * Sets [Builder._meta] to an arbitrary JSON value. + * + * You should usually call [Builder._meta] with a well-typed [_Meta] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } + fun items(items: List) = items(JsonField.of(items)) /** @@ -142,6 +170,7 @@ private constructor( * * The following fields are required: * ```java + * ._meta() * .items() * ``` * @@ -149,6 +178,7 @@ private constructor( */ fun build(): TestListResponse = TestListResponse( + checkRequired("_meta", _meta), checkRequired("items", items).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) @@ -161,6 +191,7 @@ private constructor( return@apply } + _meta().validate() items().forEach { it.validate() } validated = true } @@ -180,7 +211,280 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (_meta.asKnown().getOrNull()?.validity() ?: 0) + + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class _Meta + private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("page") @ExcludeMissing page: JsonField = JsonMissing.of(), + @JsonProperty("perPage") @ExcludeMissing perPage: JsonField = JsonMissing.of(), + @JsonProperty("totalItems") + @ExcludeMissing + totalItems: JsonField = JsonMissing.of(), + @JsonProperty("totalPages") + @ExcludeMissing + totalPages: JsonField = JsonMissing.of(), + ) : this(page, perPage, totalItems, totalPages, mutableMapOf()) + + /** + * The current page. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun page(): Long = page.getRequired("page") + + /** + * The number of items per page. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun perPage(): Long = perPage.getRequired("perPage") + + /** + * The total number of items. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalItems(): Long = totalItems.getRequired("totalItems") + + /** + * The total number of pages. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalPages(): Long = totalPages.getRequired("totalPages") + + /** + * Returns the raw JSON value of [page]. + * + * Unlike [page], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("page") @ExcludeMissing fun _page(): JsonField = page + + /** + * Returns the raw JSON value of [perPage]. + * + * Unlike [perPage], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("perPage") @ExcludeMissing fun _perPage(): JsonField = perPage + + /** + * Returns the raw JSON value of [totalItems]. + * + * Unlike [totalItems], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems(): JsonField = totalItems + + /** + * Returns the raw JSON value of [totalPages]. + * + * Unlike [totalPages], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages(): JsonField = totalPages + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [_Meta]. + * + * The following fields are required: + * ```java + * .page() + * .perPage() + * .totalItems() + * .totalPages() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [_Meta]. */ + class Builder internal constructor() { + + private var page: JsonField? = null + private var perPage: JsonField? = null + private var totalItems: JsonField? = null + private var totalPages: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(_meta: _Meta) = apply { + page = _meta.page + perPage = _meta.perPage + totalItems = _meta.totalItems + totalPages = _meta.totalPages + additionalProperties = _meta.additionalProperties.toMutableMap() + } + + /** The current page. */ + fun page(page: Long) = page(JsonField.of(page)) + + /** + * Sets [Builder.page] to an arbitrary JSON value. + * + * You should usually call [Builder.page] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun page(page: JsonField) = apply { this.page = page } + + /** The number of items per page. */ + fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) + + /** + * Sets [Builder.perPage] to an arbitrary JSON value. + * + * You should usually call [Builder.perPage] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } + + /** The total number of items. */ + fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) + + /** + * Sets [Builder.totalItems] to an arbitrary JSON value. + * + * You should usually call [Builder.totalItems] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } + + /** The total number of pages. */ + fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) + + /** + * Sets [Builder.totalPages] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPages] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [_Meta]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .page() + * .perPage() + * .totalItems() + * .totalPages() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): _Meta = + _Meta( + checkRequired("page", page), + checkRequired("perPage", perPage), + checkRequired("totalItems", totalItems), + checkRequired("totalPages", totalPages), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): _Meta = apply { + if (validated) { + return@apply + } + + page() + perPage() + totalItems() + totalPages() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (page.asKnown().isPresent) 1 else 0) + + (if (perPage.asKnown().isPresent) 1 else 0) + + (if (totalItems.asKnown().isPresent) 1 else 0) + + (if (totalPages.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is _Meta && page == other.page && perPage == other.perPage && totalItems == other.totalItems && totalPages == other.totalPages && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(page, perPage, totalItems, totalPages, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + } class Item private constructor( @@ -2816,15 +3120,15 @@ private constructor( return true } - return /* spotless:off */ other is TestListResponse && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TestListResponse && _meta == other._meta && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(items, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(_meta, items, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TestListResponse{items=$items, additionalProperties=$additionalProperties}" + "TestListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt index d92c9094..915e8704 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt @@ -15,6 +15,15 @@ internal class TestListResponseTest { fun create() { val testListResponse = TestListResponse.builder() + ._meta( + TestListResponse._Meta + .builder() + .page(1L) + .perPage(1L) + .totalItems(0L) + .totalPages(0L) + .build() + ) .addItem( TestListResponse.Item.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -61,6 +70,16 @@ internal class TestListResponseTest { ) .build() + assertThat(testListResponse._meta()) + .isEqualTo( + TestListResponse._Meta + .builder() + .page(1L) + .perPage(1L) + .totalItems(0L) + .totalPages(0L) + .build() + ) assertThat(testListResponse.items()) .containsExactly( TestListResponse.Item.builder() @@ -111,6 +130,15 @@ internal class TestListResponseTest { val jsonMapper = jsonMapper() val testListResponse = TestListResponse.builder() + ._meta( + TestListResponse._Meta + .builder() + .page(1L) + .perPage(1L) + .totalItems(0L) + .totalPages(0L) + .build() + ) .addItem( TestListResponse.Item.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") From afb521e47092ec517327a7398a4a1f768f411e41 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 10:23:40 +0000 Subject: [PATCH 70/74] feat(api): api update --- .stats.yml | 2 +- .../testresults/TestResultListResponse.kt | 364 +++++++++- .../testresults/TestResultListResponse.kt | 364 +++++++++- .../models/projects/tests/TestCreateParams.kt | 354 ++++++++- .../projects/tests/TestCreateResponse.kt | 354 ++++++++- .../models/projects/tests/TestListResponse.kt | 676 +++++++++--------- .../testresults/TestResultListResponseTest.kt | 15 +- .../testresults/TestResultListResponseTest.kt | 15 +- .../projects/tests/TestCreateParamsTest.kt | 6 +- .../projects/tests/TestCreateResponseTest.kt | 6 +- .../projects/tests/TestListResponseTest.kt | 40 +- .../async/projects/TestServiceAsyncTest.kt | 2 +- .../blocking/projects/TestServiceTest.kt | 2 +- 13 files changed, 1782 insertions(+), 418 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1dee8043..5c7a03ff 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 17 -openapi_spec_hash: 8827ead72aa0c635ccafac5e008fe247 +openapi_spec_hash: 4f09f95fd31c148d1be80b7e643346ce config_hash: 087e6b8013c398a6d24031d24594fdec diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt index da5447fc..3f65823c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt @@ -2360,7 +2360,7 @@ private constructor( class Threshold private constructor( - private val insightName: JsonField, + private val insightName: JsonField, private val insightParameters: JsonField>, private val measurement: JsonField, private val operator: JsonField, @@ -2373,7 +2373,7 @@ private constructor( private constructor( @JsonProperty("insightName") @ExcludeMissing - insightName: JsonField = JsonMissing.of(), + insightName: JsonField = JsonMissing.of(), @JsonProperty("insightParameters") @ExcludeMissing insightParameters: JsonField> = JsonMissing.of(), @@ -2405,10 +2405,12 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun insightName(): Optional = insightName.getOptional("insightName") + fun insightName(): Optional = insightName.getOptional("insightName") /** - * The insight parameters. Required only for some test subtypes. + * The insight parameters. Required only for some test subtypes. For example, for + * tests that require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] * * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -2457,7 +2459,7 @@ private constructor( */ @JsonProperty("insightName") @ExcludeMissing - fun _insightName(): JsonField = insightName + fun _insightName(): JsonField = insightName /** * Returns the raw JSON value of [insightParameters]. @@ -2528,7 +2530,7 @@ private constructor( /** A builder for [Threshold]. */ class Builder internal constructor() { - private var insightName: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() private var insightParameters: JsonField>? = null private var measurement: JsonField = JsonMissing.of() private var operator: JsonField = JsonMissing.of() @@ -2548,20 +2550,25 @@ private constructor( } /** The insight name to be evaluated. */ - fun insightName(insightName: String) = insightName(JsonField.of(insightName)) + fun insightName(insightName: InsightName) = + insightName(JsonField.of(insightName)) /** * Sets [Builder.insightName] to an arbitrary JSON value. * - * You should usually call [Builder.insightName] with a well-typed [String] + * You should usually call [Builder.insightName] with a well-typed [InsightName] * value instead. This method is primarily for setting the field to an * undocumented or not yet supported value. */ - fun insightName(insightName: JsonField) = apply { + fun insightName(insightName: JsonField) = apply { this.insightName = insightName } - /** The insight parameters. Required only for some test subtypes. */ + /** + * The insight parameters. Required only for some test subtypes. For example, + * for tests that require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] + */ fun insightParameters(insightParameters: List?) = insightParameters(JsonField.ofNullable(insightParameters)) @@ -2707,7 +2714,7 @@ private constructor( return@apply } - insightName() + insightName().ifPresent { it.validate() } insightParameters().ifPresent { it.forEach { it.validate() } } measurement() operator().ifPresent { it.validate() } @@ -2732,7 +2739,7 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (insightName.asKnown().isPresent) 1 else 0) + + (insightName.asKnown().getOrNull()?.validity() ?: 0) + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (measurement.asKnown().isPresent) 1 else 0) + @@ -2740,6 +2747,339 @@ private constructor( (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) + /** The insight name to be evaluated. */ + class InsightName + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val CHARACTER_LENGTH = of("characterLength") + + @JvmField val CLASS_IMBALANCE = of("classImbalance") + + @JvmField + val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") + + @JvmField val COLUMN_AVERAGE = of("columnAverage") + + @JvmField val COLUMN_DRIFT = of("columnDrift") + + @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") + + @JvmField val CONFIDENCE_DISTRIBUTION = of("confidenceDistribution") + + @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") + + @JvmField val CONTAINS_PII = of("containsPii") + + @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") + + @JvmField val CORRELATED_FEATURES = of("correlatedFeatures") + + @JvmField val CUSTOM_METRIC = of("customMetric") + + @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") + + @JvmField val EMPTY_FEATURES = of("emptyFeatures") + + @JvmField val FEATURE_DRIFT = of("featureDrift") + + @JvmField val FEATURE_PROFILE = of("featureProfile") + + @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") + + @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") + + @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") + + @JvmField val IS_CODE = of("isCode") + + @JvmField val IS_JSON = of("isJson") + + @JvmField val LLM_RUBRIC_V2 = of("llmRubricV2") + + @JvmField val LABEL_DRIFT = of("labelDrift") + + @JvmField val METRICS = of("metrics") + + @JvmField val NEW_CATEGORIES = of("newCategories") + + @JvmField val NEW_LABELS = of("newLabels") + + @JvmField val NULL_ROW_COUNT = of("nullRowCount") + + @JvmField val PP_SCORE = of("ppScore") + + @JvmField val QUASI_CONSTANT_FEATURES = of("quasiConstantFeatures") + + @JvmField val SENTENCE_LENGTH = of("sentenceLength") + + @JvmField val SIZE_RATIO = of("sizeRatio") + + @JvmField val SPECIAL_CHARACTERS = of("specialCharacters") + + @JvmField val STRING_VALIDATION = of("stringValidation") + + @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") + + @JvmStatic fun of(value: String) = InsightName(JsonField.of(value)) + } + + /** An enum containing [InsightName]'s known values. */ + enum class Known { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + } + + /** + * An enum containing [InsightName]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [InsightName] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + /** + * An enum member indicating that [InsightName] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CHARACTER_LENGTH -> Value.CHARACTER_LENGTH + CLASS_IMBALANCE -> Value.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> + Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Value.COLUMN_AVERAGE + COLUMN_DRIFT -> Value.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Value.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Value.CONTAINS_PII + CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Value.CORRELATED_FEATURES + CUSTOM_METRIC -> Value.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Value.EMPTY_FEATURES + FEATURE_DRIFT -> Value.FEATURE_DRIFT + FEATURE_PROFILE -> Value.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT + IS_CODE -> Value.IS_CODE + IS_JSON -> Value.IS_JSON + LLM_RUBRIC_V2 -> Value.LLM_RUBRIC_V2 + LABEL_DRIFT -> Value.LABEL_DRIFT + METRICS -> Value.METRICS + NEW_CATEGORIES -> Value.NEW_CATEGORIES + NEW_LABELS -> Value.NEW_LABELS + NULL_ROW_COUNT -> Value.NULL_ROW_COUNT + PP_SCORE -> Value.PP_SCORE + QUASI_CONSTANT_FEATURES -> Value.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Value.SENTENCE_LENGTH + SIZE_RATIO -> Value.SIZE_RATIO + SPECIAL_CHARACTERS -> Value.SPECIAL_CHARACTERS + STRING_VALIDATION -> Value.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + CHARACTER_LENGTH -> Known.CHARACTER_LENGTH + CLASS_IMBALANCE -> Known.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> + Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Known.COLUMN_AVERAGE + COLUMN_DRIFT -> Known.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Known.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Known.CONTAINS_PII + CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Known.CORRELATED_FEATURES + CUSTOM_METRIC -> Known.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Known.EMPTY_FEATURES + FEATURE_DRIFT -> Known.FEATURE_DRIFT + FEATURE_PROFILE -> Known.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT + IS_CODE -> Known.IS_CODE + IS_JSON -> Known.IS_JSON + LLM_RUBRIC_V2 -> Known.LLM_RUBRIC_V2 + LABEL_DRIFT -> Known.LABEL_DRIFT + METRICS -> Known.METRICS + NEW_CATEGORIES -> Known.NEW_CATEGORIES + NEW_LABELS -> Known.NEW_LABELS + NULL_ROW_COUNT -> Known.NULL_ROW_COUNT + PP_SCORE -> Known.PP_SCORE + QUASI_CONSTANT_FEATURES -> Known.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Known.SENTENCE_LENGTH + SIZE_RATIO -> Known.SIZE_RATIO + SPECIAL_CHARACTERS -> Known.SPECIAL_CHARACTERS + STRING_VALIDATION -> Known.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> + throw OpenlayerInvalidDataException("Unknown InsightName: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): InsightName = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InsightName && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + class InsightParameter private constructor( private val name: JsonField, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt index 4008e972..adcbdab7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt @@ -2360,7 +2360,7 @@ private constructor( class Threshold private constructor( - private val insightName: JsonField, + private val insightName: JsonField, private val insightParameters: JsonField>, private val measurement: JsonField, private val operator: JsonField, @@ -2373,7 +2373,7 @@ private constructor( private constructor( @JsonProperty("insightName") @ExcludeMissing - insightName: JsonField = JsonMissing.of(), + insightName: JsonField = JsonMissing.of(), @JsonProperty("insightParameters") @ExcludeMissing insightParameters: JsonField> = JsonMissing.of(), @@ -2405,10 +2405,12 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun insightName(): Optional = insightName.getOptional("insightName") + fun insightName(): Optional = insightName.getOptional("insightName") /** - * The insight parameters. Required only for some test subtypes. + * The insight parameters. Required only for some test subtypes. For example, for + * tests that require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] * * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -2457,7 +2459,7 @@ private constructor( */ @JsonProperty("insightName") @ExcludeMissing - fun _insightName(): JsonField = insightName + fun _insightName(): JsonField = insightName /** * Returns the raw JSON value of [insightParameters]. @@ -2528,7 +2530,7 @@ private constructor( /** A builder for [Threshold]. */ class Builder internal constructor() { - private var insightName: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() private var insightParameters: JsonField>? = null private var measurement: JsonField = JsonMissing.of() private var operator: JsonField = JsonMissing.of() @@ -2548,20 +2550,25 @@ private constructor( } /** The insight name to be evaluated. */ - fun insightName(insightName: String) = insightName(JsonField.of(insightName)) + fun insightName(insightName: InsightName) = + insightName(JsonField.of(insightName)) /** * Sets [Builder.insightName] to an arbitrary JSON value. * - * You should usually call [Builder.insightName] with a well-typed [String] + * You should usually call [Builder.insightName] with a well-typed [InsightName] * value instead. This method is primarily for setting the field to an * undocumented or not yet supported value. */ - fun insightName(insightName: JsonField) = apply { + fun insightName(insightName: JsonField) = apply { this.insightName = insightName } - /** The insight parameters. Required only for some test subtypes. */ + /** + * The insight parameters. Required only for some test subtypes. For example, + * for tests that require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] + */ fun insightParameters(insightParameters: List?) = insightParameters(JsonField.ofNullable(insightParameters)) @@ -2707,7 +2714,7 @@ private constructor( return@apply } - insightName() + insightName().ifPresent { it.validate() } insightParameters().ifPresent { it.forEach { it.validate() } } measurement() operator().ifPresent { it.validate() } @@ -2732,7 +2739,7 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (insightName.asKnown().isPresent) 1 else 0) + + (insightName.asKnown().getOrNull()?.validity() ?: 0) + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (measurement.asKnown().isPresent) 1 else 0) + @@ -2740,6 +2747,339 @@ private constructor( (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) + /** The insight name to be evaluated. */ + class InsightName + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val CHARACTER_LENGTH = of("characterLength") + + @JvmField val CLASS_IMBALANCE = of("classImbalance") + + @JvmField + val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") + + @JvmField val COLUMN_AVERAGE = of("columnAverage") + + @JvmField val COLUMN_DRIFT = of("columnDrift") + + @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") + + @JvmField val CONFIDENCE_DISTRIBUTION = of("confidenceDistribution") + + @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") + + @JvmField val CONTAINS_PII = of("containsPii") + + @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") + + @JvmField val CORRELATED_FEATURES = of("correlatedFeatures") + + @JvmField val CUSTOM_METRIC = of("customMetric") + + @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") + + @JvmField val EMPTY_FEATURES = of("emptyFeatures") + + @JvmField val FEATURE_DRIFT = of("featureDrift") + + @JvmField val FEATURE_PROFILE = of("featureProfile") + + @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") + + @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") + + @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") + + @JvmField val IS_CODE = of("isCode") + + @JvmField val IS_JSON = of("isJson") + + @JvmField val LLM_RUBRIC_V2 = of("llmRubricV2") + + @JvmField val LABEL_DRIFT = of("labelDrift") + + @JvmField val METRICS = of("metrics") + + @JvmField val NEW_CATEGORIES = of("newCategories") + + @JvmField val NEW_LABELS = of("newLabels") + + @JvmField val NULL_ROW_COUNT = of("nullRowCount") + + @JvmField val PP_SCORE = of("ppScore") + + @JvmField val QUASI_CONSTANT_FEATURES = of("quasiConstantFeatures") + + @JvmField val SENTENCE_LENGTH = of("sentenceLength") + + @JvmField val SIZE_RATIO = of("sizeRatio") + + @JvmField val SPECIAL_CHARACTERS = of("specialCharacters") + + @JvmField val STRING_VALIDATION = of("stringValidation") + + @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") + + @JvmStatic fun of(value: String) = InsightName(JsonField.of(value)) + } + + /** An enum containing [InsightName]'s known values. */ + enum class Known { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + } + + /** + * An enum containing [InsightName]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [InsightName] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + /** + * An enum member indicating that [InsightName] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CHARACTER_LENGTH -> Value.CHARACTER_LENGTH + CLASS_IMBALANCE -> Value.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> + Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Value.COLUMN_AVERAGE + COLUMN_DRIFT -> Value.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Value.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Value.CONTAINS_PII + CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Value.CORRELATED_FEATURES + CUSTOM_METRIC -> Value.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Value.EMPTY_FEATURES + FEATURE_DRIFT -> Value.FEATURE_DRIFT + FEATURE_PROFILE -> Value.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT + IS_CODE -> Value.IS_CODE + IS_JSON -> Value.IS_JSON + LLM_RUBRIC_V2 -> Value.LLM_RUBRIC_V2 + LABEL_DRIFT -> Value.LABEL_DRIFT + METRICS -> Value.METRICS + NEW_CATEGORIES -> Value.NEW_CATEGORIES + NEW_LABELS -> Value.NEW_LABELS + NULL_ROW_COUNT -> Value.NULL_ROW_COUNT + PP_SCORE -> Value.PP_SCORE + QUASI_CONSTANT_FEATURES -> Value.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Value.SENTENCE_LENGTH + SIZE_RATIO -> Value.SIZE_RATIO + SPECIAL_CHARACTERS -> Value.SPECIAL_CHARACTERS + STRING_VALIDATION -> Value.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + CHARACTER_LENGTH -> Known.CHARACTER_LENGTH + CLASS_IMBALANCE -> Known.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> + Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Known.COLUMN_AVERAGE + COLUMN_DRIFT -> Known.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Known.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Known.CONTAINS_PII + CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Known.CORRELATED_FEATURES + CUSTOM_METRIC -> Known.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Known.EMPTY_FEATURES + FEATURE_DRIFT -> Known.FEATURE_DRIFT + FEATURE_PROFILE -> Known.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT + IS_CODE -> Known.IS_CODE + IS_JSON -> Known.IS_JSON + LLM_RUBRIC_V2 -> Known.LLM_RUBRIC_V2 + LABEL_DRIFT -> Known.LABEL_DRIFT + METRICS -> Known.METRICS + NEW_CATEGORIES -> Known.NEW_CATEGORIES + NEW_LABELS -> Known.NEW_LABELS + NULL_ROW_COUNT -> Known.NULL_ROW_COUNT + PP_SCORE -> Known.PP_SCORE + QUASI_CONSTANT_FEATURES -> Known.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Known.SENTENCE_LENGTH + SIZE_RATIO -> Known.SIZE_RATIO + SPECIAL_CHARACTERS -> Known.SPECIAL_CHARACTERS + STRING_VALIDATION -> Known.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> + throw OpenlayerInvalidDataException("Unknown InsightName: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): InsightName = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InsightName && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + class InsightParameter private constructor( private val name: JsonField, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt index fee3025e..13947875 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt @@ -2339,7 +2339,7 @@ private constructor( class Threshold private constructor( - private val insightName: JsonField, + private val insightName: JsonField, private val insightParameters: JsonField>, private val measurement: JsonField, private val operator: JsonField, @@ -2352,7 +2352,7 @@ private constructor( private constructor( @JsonProperty("insightName") @ExcludeMissing - insightName: JsonField = JsonMissing.of(), + insightName: JsonField = JsonMissing.of(), @JsonProperty("insightParameters") @ExcludeMissing insightParameters: JsonField> = JsonMissing.of(), @@ -2382,10 +2382,12 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun insightName(): Optional = insightName.getOptional("insightName") + fun insightName(): Optional = insightName.getOptional("insightName") /** - * The insight parameters. Required only for some test subtypes. + * The insight parameters. Required only for some test subtypes. For example, for tests that + * require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] * * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -2432,7 +2434,7 @@ private constructor( */ @JsonProperty("insightName") @ExcludeMissing - fun _insightName(): JsonField = insightName + fun _insightName(): JsonField = insightName /** * Returns the raw JSON value of [insightParameters]. @@ -2498,7 +2500,7 @@ private constructor( /** A builder for [Threshold]. */ class Builder internal constructor() { - private var insightName: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() private var insightParameters: JsonField>? = null private var measurement: JsonField = JsonMissing.of() private var operator: JsonField = JsonMissing.of() @@ -2518,20 +2520,24 @@ private constructor( } /** The insight name to be evaluated. */ - fun insightName(insightName: String) = insightName(JsonField.of(insightName)) + fun insightName(insightName: InsightName) = insightName(JsonField.of(insightName)) /** * Sets [Builder.insightName] to an arbitrary JSON value. * - * You should usually call [Builder.insightName] with a well-typed [String] value + * You should usually call [Builder.insightName] with a well-typed [InsightName] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun insightName(insightName: JsonField) = apply { + fun insightName(insightName: JsonField) = apply { this.insightName = insightName } - /** The insight parameters. Required only for some test subtypes. */ + /** + * The insight parameters. Required only for some test subtypes. For example, for tests + * that require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] + */ fun insightParameters(insightParameters: List?) = insightParameters(JsonField.ofNullable(insightParameters)) @@ -2672,7 +2678,7 @@ private constructor( return@apply } - insightName() + insightName().ifPresent { it.validate() } insightParameters().ifPresent { it.forEach { it.validate() } } measurement() operator().ifPresent { it.validate() } @@ -2697,13 +2703,337 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (insightName.asKnown().isPresent) 1 else 0) + + (insightName.asKnown().getOrNull()?.validity() ?: 0) + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (measurement.asKnown().isPresent) 1 else 0) + (operator.asKnown().getOrNull()?.validity() ?: 0) + (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) + /** The insight name to be evaluated. */ + class InsightName @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val CHARACTER_LENGTH = of("characterLength") + + @JvmField val CLASS_IMBALANCE = of("classImbalance") + + @JvmField val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") + + @JvmField val COLUMN_AVERAGE = of("columnAverage") + + @JvmField val COLUMN_DRIFT = of("columnDrift") + + @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") + + @JvmField val CONFIDENCE_DISTRIBUTION = of("confidenceDistribution") + + @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") + + @JvmField val CONTAINS_PII = of("containsPii") + + @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") + + @JvmField val CORRELATED_FEATURES = of("correlatedFeatures") + + @JvmField val CUSTOM_METRIC = of("customMetric") + + @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") + + @JvmField val EMPTY_FEATURES = of("emptyFeatures") + + @JvmField val FEATURE_DRIFT = of("featureDrift") + + @JvmField val FEATURE_PROFILE = of("featureProfile") + + @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") + + @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") + + @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") + + @JvmField val IS_CODE = of("isCode") + + @JvmField val IS_JSON = of("isJson") + + @JvmField val LLM_RUBRIC_V2 = of("llmRubricV2") + + @JvmField val LABEL_DRIFT = of("labelDrift") + + @JvmField val METRICS = of("metrics") + + @JvmField val NEW_CATEGORIES = of("newCategories") + + @JvmField val NEW_LABELS = of("newLabels") + + @JvmField val NULL_ROW_COUNT = of("nullRowCount") + + @JvmField val PP_SCORE = of("ppScore") + + @JvmField val QUASI_CONSTANT_FEATURES = of("quasiConstantFeatures") + + @JvmField val SENTENCE_LENGTH = of("sentenceLength") + + @JvmField val SIZE_RATIO = of("sizeRatio") + + @JvmField val SPECIAL_CHARACTERS = of("specialCharacters") + + @JvmField val STRING_VALIDATION = of("stringValidation") + + @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") + + @JvmStatic fun of(value: String) = InsightName(JsonField.of(value)) + } + + /** An enum containing [InsightName]'s known values. */ + enum class Known { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + } + + /** + * An enum containing [InsightName]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [InsightName] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + /** + * An enum member indicating that [InsightName] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CHARACTER_LENGTH -> Value.CHARACTER_LENGTH + CLASS_IMBALANCE -> Value.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Value.COLUMN_AVERAGE + COLUMN_DRIFT -> Value.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Value.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Value.CONTAINS_PII + CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Value.CORRELATED_FEATURES + CUSTOM_METRIC -> Value.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Value.EMPTY_FEATURES + FEATURE_DRIFT -> Value.FEATURE_DRIFT + FEATURE_PROFILE -> Value.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT + IS_CODE -> Value.IS_CODE + IS_JSON -> Value.IS_JSON + LLM_RUBRIC_V2 -> Value.LLM_RUBRIC_V2 + LABEL_DRIFT -> Value.LABEL_DRIFT + METRICS -> Value.METRICS + NEW_CATEGORIES -> Value.NEW_CATEGORIES + NEW_LABELS -> Value.NEW_LABELS + NULL_ROW_COUNT -> Value.NULL_ROW_COUNT + PP_SCORE -> Value.PP_SCORE + QUASI_CONSTANT_FEATURES -> Value.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Value.SENTENCE_LENGTH + SIZE_RATIO -> Value.SIZE_RATIO + SPECIAL_CHARACTERS -> Value.SPECIAL_CHARACTERS + STRING_VALIDATION -> Value.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + CHARACTER_LENGTH -> Known.CHARACTER_LENGTH + CLASS_IMBALANCE -> Known.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Known.COLUMN_AVERAGE + COLUMN_DRIFT -> Known.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Known.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Known.CONTAINS_PII + CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Known.CORRELATED_FEATURES + CUSTOM_METRIC -> Known.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Known.EMPTY_FEATURES + FEATURE_DRIFT -> Known.FEATURE_DRIFT + FEATURE_PROFILE -> Known.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT + IS_CODE -> Known.IS_CODE + IS_JSON -> Known.IS_JSON + LLM_RUBRIC_V2 -> Known.LLM_RUBRIC_V2 + LABEL_DRIFT -> Known.LABEL_DRIFT + METRICS -> Known.METRICS + NEW_CATEGORIES -> Known.NEW_CATEGORIES + NEW_LABELS -> Known.NEW_LABELS + NULL_ROW_COUNT -> Known.NULL_ROW_COUNT + PP_SCORE -> Known.PP_SCORE + QUASI_CONSTANT_FEATURES -> Known.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Known.SENTENCE_LENGTH + SIZE_RATIO -> Known.SIZE_RATIO + SPECIAL_CHARACTERS -> Known.SPECIAL_CHARACTERS + STRING_VALIDATION -> Known.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> throw OpenlayerInvalidDataException("Unknown InsightName: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): InsightName = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InsightName && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + class InsightParameter private constructor( private val name: JsonField, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt index 804667da..8daa8003 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt @@ -1406,7 +1406,7 @@ private constructor( class Threshold private constructor( - private val insightName: JsonField, + private val insightName: JsonField, private val insightParameters: JsonField>, private val measurement: JsonField, private val operator: JsonField, @@ -1419,7 +1419,7 @@ private constructor( private constructor( @JsonProperty("insightName") @ExcludeMissing - insightName: JsonField = JsonMissing.of(), + insightName: JsonField = JsonMissing.of(), @JsonProperty("insightParameters") @ExcludeMissing insightParameters: JsonField> = JsonMissing.of(), @@ -1449,10 +1449,12 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun insightName(): Optional = insightName.getOptional("insightName") + fun insightName(): Optional = insightName.getOptional("insightName") /** - * The insight parameters. Required only for some test subtypes. + * The insight parameters. Required only for some test subtypes. For example, for tests that + * require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] * * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -1499,7 +1501,7 @@ private constructor( */ @JsonProperty("insightName") @ExcludeMissing - fun _insightName(): JsonField = insightName + fun _insightName(): JsonField = insightName /** * Returns the raw JSON value of [insightParameters]. @@ -1565,7 +1567,7 @@ private constructor( /** A builder for [Threshold]. */ class Builder internal constructor() { - private var insightName: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() private var insightParameters: JsonField>? = null private var measurement: JsonField = JsonMissing.of() private var operator: JsonField = JsonMissing.of() @@ -1585,20 +1587,24 @@ private constructor( } /** The insight name to be evaluated. */ - fun insightName(insightName: String) = insightName(JsonField.of(insightName)) + fun insightName(insightName: InsightName) = insightName(JsonField.of(insightName)) /** * Sets [Builder.insightName] to an arbitrary JSON value. * - * You should usually call [Builder.insightName] with a well-typed [String] value + * You should usually call [Builder.insightName] with a well-typed [InsightName] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun insightName(insightName: JsonField) = apply { + fun insightName(insightName: JsonField) = apply { this.insightName = insightName } - /** The insight parameters. Required only for some test subtypes. */ + /** + * The insight parameters. Required only for some test subtypes. For example, for tests + * that require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] + */ fun insightParameters(insightParameters: List?) = insightParameters(JsonField.ofNullable(insightParameters)) @@ -1739,7 +1745,7 @@ private constructor( return@apply } - insightName() + insightName().ifPresent { it.validate() } insightParameters().ifPresent { it.forEach { it.validate() } } measurement() operator().ifPresent { it.validate() } @@ -1764,13 +1770,337 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (insightName.asKnown().isPresent) 1 else 0) + + (insightName.asKnown().getOrNull()?.validity() ?: 0) + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (measurement.asKnown().isPresent) 1 else 0) + (operator.asKnown().getOrNull()?.validity() ?: 0) + (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) + /** The insight name to be evaluated. */ + class InsightName @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val CHARACTER_LENGTH = of("characterLength") + + @JvmField val CLASS_IMBALANCE = of("classImbalance") + + @JvmField val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") + + @JvmField val COLUMN_AVERAGE = of("columnAverage") + + @JvmField val COLUMN_DRIFT = of("columnDrift") + + @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") + + @JvmField val CONFIDENCE_DISTRIBUTION = of("confidenceDistribution") + + @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") + + @JvmField val CONTAINS_PII = of("containsPii") + + @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") + + @JvmField val CORRELATED_FEATURES = of("correlatedFeatures") + + @JvmField val CUSTOM_METRIC = of("customMetric") + + @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") + + @JvmField val EMPTY_FEATURES = of("emptyFeatures") + + @JvmField val FEATURE_DRIFT = of("featureDrift") + + @JvmField val FEATURE_PROFILE = of("featureProfile") + + @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") + + @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") + + @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") + + @JvmField val IS_CODE = of("isCode") + + @JvmField val IS_JSON = of("isJson") + + @JvmField val LLM_RUBRIC_V2 = of("llmRubricV2") + + @JvmField val LABEL_DRIFT = of("labelDrift") + + @JvmField val METRICS = of("metrics") + + @JvmField val NEW_CATEGORIES = of("newCategories") + + @JvmField val NEW_LABELS = of("newLabels") + + @JvmField val NULL_ROW_COUNT = of("nullRowCount") + + @JvmField val PP_SCORE = of("ppScore") + + @JvmField val QUASI_CONSTANT_FEATURES = of("quasiConstantFeatures") + + @JvmField val SENTENCE_LENGTH = of("sentenceLength") + + @JvmField val SIZE_RATIO = of("sizeRatio") + + @JvmField val SPECIAL_CHARACTERS = of("specialCharacters") + + @JvmField val STRING_VALIDATION = of("stringValidation") + + @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") + + @JvmStatic fun of(value: String) = InsightName(JsonField.of(value)) + } + + /** An enum containing [InsightName]'s known values. */ + enum class Known { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + } + + /** + * An enum containing [InsightName]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [InsightName] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + /** + * An enum member indicating that [InsightName] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CHARACTER_LENGTH -> Value.CHARACTER_LENGTH + CLASS_IMBALANCE -> Value.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Value.COLUMN_AVERAGE + COLUMN_DRIFT -> Value.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Value.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Value.CONTAINS_PII + CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Value.CORRELATED_FEATURES + CUSTOM_METRIC -> Value.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Value.EMPTY_FEATURES + FEATURE_DRIFT -> Value.FEATURE_DRIFT + FEATURE_PROFILE -> Value.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT + IS_CODE -> Value.IS_CODE + IS_JSON -> Value.IS_JSON + LLM_RUBRIC_V2 -> Value.LLM_RUBRIC_V2 + LABEL_DRIFT -> Value.LABEL_DRIFT + METRICS -> Value.METRICS + NEW_CATEGORIES -> Value.NEW_CATEGORIES + NEW_LABELS -> Value.NEW_LABELS + NULL_ROW_COUNT -> Value.NULL_ROW_COUNT + PP_SCORE -> Value.PP_SCORE + QUASI_CONSTANT_FEATURES -> Value.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Value.SENTENCE_LENGTH + SIZE_RATIO -> Value.SIZE_RATIO + SPECIAL_CHARACTERS -> Value.SPECIAL_CHARACTERS + STRING_VALIDATION -> Value.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + CHARACTER_LENGTH -> Known.CHARACTER_LENGTH + CLASS_IMBALANCE -> Known.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Known.COLUMN_AVERAGE + COLUMN_DRIFT -> Known.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Known.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Known.CONTAINS_PII + CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Known.CORRELATED_FEATURES + CUSTOM_METRIC -> Known.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Known.EMPTY_FEATURES + FEATURE_DRIFT -> Known.FEATURE_DRIFT + FEATURE_PROFILE -> Known.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT + IS_CODE -> Known.IS_CODE + IS_JSON -> Known.IS_JSON + LLM_RUBRIC_V2 -> Known.LLM_RUBRIC_V2 + LABEL_DRIFT -> Known.LABEL_DRIFT + METRICS -> Known.METRICS + NEW_CATEGORIES -> Known.NEW_CATEGORIES + NEW_LABELS -> Known.NEW_LABELS + NULL_ROW_COUNT -> Known.NULL_ROW_COUNT + PP_SCORE -> Known.PP_SCORE + QUASI_CONSTANT_FEATURES -> Known.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Known.SENTENCE_LENGTH + SIZE_RATIO -> Known.SIZE_RATIO + SPECIAL_CHARACTERS -> Known.SPECIAL_CHARACTERS + STRING_VALIDATION -> Known.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> throw OpenlayerInvalidDataException("Unknown InsightName: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): InsightName = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InsightName && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + class InsightParameter private constructor( private val name: JsonField, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt index b42c76fd..e3a0fd60 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt @@ -34,22 +34,14 @@ import kotlin.jvm.optionals.getOrNull class TestListResponse private constructor( - private val _meta: JsonField<_Meta>, private val items: JsonField>, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("_meta") @ExcludeMissing _meta: JsonField<_Meta> = JsonMissing.of(), - @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of(), - ) : this(_meta, items, mutableMapOf()) - - /** - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun _meta(): _Meta = _meta.getRequired("_meta") + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is @@ -57,13 +49,6 @@ private constructor( */ fun items(): List = items.getRequired("items") - /** - * Returns the raw JSON value of [_meta]. - * - * Unlike [_meta], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("_meta") @ExcludeMissing fun __meta(): JsonField<_Meta> = _meta - /** * Returns the raw JSON value of [items]. * @@ -90,7 +75,6 @@ private constructor( * * The following fields are required: * ```java - * ._meta() * .items() * ``` */ @@ -100,27 +84,15 @@ private constructor( /** A builder for [TestListResponse]. */ class Builder internal constructor() { - private var _meta: JsonField<_Meta>? = null private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(testListResponse: TestListResponse) = apply { - _meta = testListResponse._meta items = testListResponse.items.map { it.toMutableList() } additionalProperties = testListResponse.additionalProperties.toMutableMap() } - fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta)) - - /** - * Sets [Builder._meta] to an arbitrary JSON value. - * - * You should usually call [Builder._meta] with a well-typed [_Meta] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } - fun items(items: List) = items(JsonField.of(items)) /** @@ -170,7 +142,6 @@ private constructor( * * The following fields are required: * ```java - * ._meta() * .items() * ``` * @@ -178,7 +149,6 @@ private constructor( */ fun build(): TestListResponse = TestListResponse( - checkRequired("_meta", _meta), checkRequired("items", items).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) @@ -191,7 +161,6 @@ private constructor( return@apply } - _meta().validate() items().forEach { it.validate() } validated = true } @@ -211,280 +180,7 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (_meta.asKnown().getOrNull()?.validity() ?: 0) + - (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - class _Meta - private constructor( - private val page: JsonField, - private val perPage: JsonField, - private val totalItems: JsonField, - private val totalPages: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("page") @ExcludeMissing page: JsonField = JsonMissing.of(), - @JsonProperty("perPage") @ExcludeMissing perPage: JsonField = JsonMissing.of(), - @JsonProperty("totalItems") - @ExcludeMissing - totalItems: JsonField = JsonMissing.of(), - @JsonProperty("totalPages") - @ExcludeMissing - totalPages: JsonField = JsonMissing.of(), - ) : this(page, perPage, totalItems, totalPages, mutableMapOf()) - - /** - * The current page. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun page(): Long = page.getRequired("page") - - /** - * The number of items per page. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun perPage(): Long = perPage.getRequired("perPage") - - /** - * The total number of items. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun totalItems(): Long = totalItems.getRequired("totalItems") - - /** - * The total number of pages. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun totalPages(): Long = totalPages.getRequired("totalPages") - - /** - * Returns the raw JSON value of [page]. - * - * Unlike [page], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("page") @ExcludeMissing fun _page(): JsonField = page - - /** - * Returns the raw JSON value of [perPage]. - * - * Unlike [perPage], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("perPage") @ExcludeMissing fun _perPage(): JsonField = perPage - - /** - * Returns the raw JSON value of [totalItems]. - * - * Unlike [totalItems], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("totalItems") @ExcludeMissing fun _totalItems(): JsonField = totalItems - - /** - * Returns the raw JSON value of [totalPages]. - * - * Unlike [totalPages], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("totalPages") @ExcludeMissing fun _totalPages(): JsonField = totalPages - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [_Meta]. - * - * The following fields are required: - * ```java - * .page() - * .perPage() - * .totalItems() - * .totalPages() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [_Meta]. */ - class Builder internal constructor() { - - private var page: JsonField? = null - private var perPage: JsonField? = null - private var totalItems: JsonField? = null - private var totalPages: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(_meta: _Meta) = apply { - page = _meta.page - perPage = _meta.perPage - totalItems = _meta.totalItems - totalPages = _meta.totalPages - additionalProperties = _meta.additionalProperties.toMutableMap() - } - - /** The current page. */ - fun page(page: Long) = page(JsonField.of(page)) - - /** - * Sets [Builder.page] to an arbitrary JSON value. - * - * You should usually call [Builder.page] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun page(page: JsonField) = apply { this.page = page } - - /** The number of items per page. */ - fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) - - /** - * Sets [Builder.perPage] to an arbitrary JSON value. - * - * You should usually call [Builder.perPage] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun perPage(perPage: JsonField) = apply { this.perPage = perPage } - - /** The total number of items. */ - fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) - - /** - * Sets [Builder.totalItems] to an arbitrary JSON value. - * - * You should usually call [Builder.totalItems] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } - - /** The total number of pages. */ - fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) - - /** - * Sets [Builder.totalPages] to an arbitrary JSON value. - * - * You should usually call [Builder.totalPages] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [_Meta]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .page() - * .perPage() - * .totalItems() - * .totalPages() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): _Meta = - _Meta( - checkRequired("page", page), - checkRequired("perPage", perPage), - checkRequired("totalItems", totalItems), - checkRequired("totalPages", totalPages), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): _Meta = apply { - if (validated) { - return@apply - } - - page() - perPage() - totalItems() - totalPages() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OpenlayerInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (page.asKnown().isPresent) 1 else 0) + - (if (perPage.asKnown().isPresent) 1 else 0) + - (if (totalItems.asKnown().isPresent) 1 else 0) + - (if (totalPages.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is _Meta && page == other.page && perPage == other.perPage && totalItems == other.totalItems && totalPages == other.totalPages && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(page, perPage, totalItems, totalPages, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" - } + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) class Item private constructor( @@ -1887,7 +1583,7 @@ private constructor( class Threshold private constructor( - private val insightName: JsonField, + private val insightName: JsonField, private val insightParameters: JsonField>, private val measurement: JsonField, private val operator: JsonField, @@ -1900,7 +1596,7 @@ private constructor( private constructor( @JsonProperty("insightName") @ExcludeMissing - insightName: JsonField = JsonMissing.of(), + insightName: JsonField = JsonMissing.of(), @JsonProperty("insightParameters") @ExcludeMissing insightParameters: JsonField> = JsonMissing.of(), @@ -1930,10 +1626,12 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun insightName(): Optional = insightName.getOptional("insightName") + fun insightName(): Optional = insightName.getOptional("insightName") /** - * The insight parameters. Required only for some test subtypes. + * The insight parameters. Required only for some test subtypes. For example, for tests + * that require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] * * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -1982,7 +1680,7 @@ private constructor( */ @JsonProperty("insightName") @ExcludeMissing - fun _insightName(): JsonField = insightName + fun _insightName(): JsonField = insightName /** * Returns the raw JSON value of [insightParameters]. @@ -2052,7 +1750,7 @@ private constructor( /** A builder for [Threshold]. */ class Builder internal constructor() { - private var insightName: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() private var insightParameters: JsonField>? = null private var measurement: JsonField = JsonMissing.of() private var operator: JsonField = JsonMissing.of() @@ -2072,20 +1770,24 @@ private constructor( } /** The insight name to be evaluated. */ - fun insightName(insightName: String) = insightName(JsonField.of(insightName)) + fun insightName(insightName: InsightName) = insightName(JsonField.of(insightName)) /** * Sets [Builder.insightName] to an arbitrary JSON value. * - * You should usually call [Builder.insightName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * You should usually call [Builder.insightName] with a well-typed [InsightName] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ - fun insightName(insightName: JsonField) = apply { + fun insightName(insightName: JsonField) = apply { this.insightName = insightName } - /** The insight parameters. Required only for some test subtypes. */ + /** + * The insight parameters. Required only for some test subtypes. For example, for + * tests that require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] + */ fun insightParameters(insightParameters: List?) = insightParameters(JsonField.ofNullable(insightParameters)) @@ -2231,7 +1933,7 @@ private constructor( return@apply } - insightName() + insightName().ifPresent { it.validate() } insightParameters().ifPresent { it.forEach { it.validate() } } measurement() operator().ifPresent { it.validate() } @@ -2256,7 +1958,7 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (insightName.asKnown().isPresent) 1 else 0) + + (insightName.asKnown().getOrNull()?.validity() ?: 0) + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (measurement.asKnown().isPresent) 1 else 0) + @@ -2264,6 +1966,332 @@ private constructor( (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) + /** The insight name to be evaluated. */ + class InsightName + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val CHARACTER_LENGTH = of("characterLength") + + @JvmField val CLASS_IMBALANCE = of("classImbalance") + + @JvmField + val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") + + @JvmField val COLUMN_AVERAGE = of("columnAverage") + + @JvmField val COLUMN_DRIFT = of("columnDrift") + + @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") + + @JvmField val CONFIDENCE_DISTRIBUTION = of("confidenceDistribution") + + @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") + + @JvmField val CONTAINS_PII = of("containsPii") + + @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") + + @JvmField val CORRELATED_FEATURES = of("correlatedFeatures") + + @JvmField val CUSTOM_METRIC = of("customMetric") + + @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") + + @JvmField val EMPTY_FEATURES = of("emptyFeatures") + + @JvmField val FEATURE_DRIFT = of("featureDrift") + + @JvmField val FEATURE_PROFILE = of("featureProfile") + + @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") + + @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") + + @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") + + @JvmField val IS_CODE = of("isCode") + + @JvmField val IS_JSON = of("isJson") + + @JvmField val LLM_RUBRIC_V2 = of("llmRubricV2") + + @JvmField val LABEL_DRIFT = of("labelDrift") + + @JvmField val METRICS = of("metrics") + + @JvmField val NEW_CATEGORIES = of("newCategories") + + @JvmField val NEW_LABELS = of("newLabels") + + @JvmField val NULL_ROW_COUNT = of("nullRowCount") + + @JvmField val PP_SCORE = of("ppScore") + + @JvmField val QUASI_CONSTANT_FEATURES = of("quasiConstantFeatures") + + @JvmField val SENTENCE_LENGTH = of("sentenceLength") + + @JvmField val SIZE_RATIO = of("sizeRatio") + + @JvmField val SPECIAL_CHARACTERS = of("specialCharacters") + + @JvmField val STRING_VALIDATION = of("stringValidation") + + @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") + + @JvmStatic fun of(value: String) = InsightName(JsonField.of(value)) + } + + /** An enum containing [InsightName]'s known values. */ + enum class Known { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + } + + /** + * An enum containing [InsightName]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [InsightName] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + /** + * An enum member indicating that [InsightName] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CHARACTER_LENGTH -> Value.CHARACTER_LENGTH + CLASS_IMBALANCE -> Value.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Value.COLUMN_AVERAGE + COLUMN_DRIFT -> Value.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Value.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Value.CONTAINS_PII + CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Value.CORRELATED_FEATURES + CUSTOM_METRIC -> Value.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Value.EMPTY_FEATURES + FEATURE_DRIFT -> Value.FEATURE_DRIFT + FEATURE_PROFILE -> Value.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT + IS_CODE -> Value.IS_CODE + IS_JSON -> Value.IS_JSON + LLM_RUBRIC_V2 -> Value.LLM_RUBRIC_V2 + LABEL_DRIFT -> Value.LABEL_DRIFT + METRICS -> Value.METRICS + NEW_CATEGORIES -> Value.NEW_CATEGORIES + NEW_LABELS -> Value.NEW_LABELS + NULL_ROW_COUNT -> Value.NULL_ROW_COUNT + PP_SCORE -> Value.PP_SCORE + QUASI_CONSTANT_FEATURES -> Value.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Value.SENTENCE_LENGTH + SIZE_RATIO -> Value.SIZE_RATIO + SPECIAL_CHARACTERS -> Value.SPECIAL_CHARACTERS + STRING_VALIDATION -> Value.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + CHARACTER_LENGTH -> Known.CHARACTER_LENGTH + CLASS_IMBALANCE -> Known.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Known.COLUMN_AVERAGE + COLUMN_DRIFT -> Known.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Known.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Known.CONTAINS_PII + CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Known.CORRELATED_FEATURES + CUSTOM_METRIC -> Known.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Known.EMPTY_FEATURES + FEATURE_DRIFT -> Known.FEATURE_DRIFT + FEATURE_PROFILE -> Known.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT + IS_CODE -> Known.IS_CODE + IS_JSON -> Known.IS_JSON + LLM_RUBRIC_V2 -> Known.LLM_RUBRIC_V2 + LABEL_DRIFT -> Known.LABEL_DRIFT + METRICS -> Known.METRICS + NEW_CATEGORIES -> Known.NEW_CATEGORIES + NEW_LABELS -> Known.NEW_LABELS + NULL_ROW_COUNT -> Known.NULL_ROW_COUNT + PP_SCORE -> Known.PP_SCORE + QUASI_CONSTANT_FEATURES -> Known.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Known.SENTENCE_LENGTH + SIZE_RATIO -> Known.SIZE_RATIO + SPECIAL_CHARACTERS -> Known.SPECIAL_CHARACTERS + STRING_VALIDATION -> Known.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> throw OpenlayerInvalidDataException("Unknown InsightName: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): InsightName = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InsightName && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + class InsightParameter private constructor( private val name: JsonField, @@ -3120,15 +3148,15 @@ private constructor( return true } - return /* spotless:off */ other is TestListResponse && _meta == other._meta && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TestListResponse && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(_meta, items, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(items, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TestListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + "TestListResponse{items=$items, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt index f9ecbcb1..5045cc8f 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt @@ -48,7 +48,10 @@ internal class TestResultListResponseTest { .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") + .insightName( + TestResultListResponse.Item.Goal.Threshold.InsightName + .DUPLICATE_ROW_COUNT + ) .addInsightParameter( TestResultListResponse.Item.Goal.Threshold .InsightParameter @@ -117,7 +120,10 @@ internal class TestResultListResponseTest { .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") + .insightName( + TestResultListResponse.Item.Goal.Threshold.InsightName + .DUPLICATE_ROW_COUNT + ) .addInsightParameter( TestResultListResponse.Item.Goal.Threshold.InsightParameter .builder() @@ -191,7 +197,10 @@ internal class TestResultListResponseTest { .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") + .insightName( + TestResultListResponse.Item.Goal.Threshold.InsightName + .DUPLICATE_ROW_COUNT + ) .addInsightParameter( TestResultListResponse.Item.Goal.Threshold .InsightParameter diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt index 53cca3af..6051c9ef 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt @@ -48,7 +48,10 @@ internal class TestResultListResponseTest { .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") + .insightName( + TestResultListResponse.Item.Goal.Threshold.InsightName + .DUPLICATE_ROW_COUNT + ) .addInsightParameter( TestResultListResponse.Item.Goal.Threshold .InsightParameter @@ -117,7 +120,10 @@ internal class TestResultListResponseTest { .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") + .insightName( + TestResultListResponse.Item.Goal.Threshold.InsightName + .DUPLICATE_ROW_COUNT + ) .addInsightParameter( TestResultListResponse.Item.Goal.Threshold.InsightParameter .builder() @@ -191,7 +197,10 @@ internal class TestResultListResponseTest { .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") + .insightName( + TestResultListResponse.Item.Goal.Threshold.InsightName + .DUPLICATE_ROW_COUNT + ) .addInsightParameter( TestResultListResponse.Item.Goal.Threshold .InsightParameter diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt index e113b43c..53507331 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt @@ -27,7 +27,7 @@ internal class TestCreateParamsTest { .suggested(false) .addThreshold( TestCreateParams.Threshold.builder() - .insightName("duplicateRowCount") + .insightName(TestCreateParams.Threshold.InsightName.DUPLICATE_ROW_COUNT) .addInsightParameter( TestCreateParams.Threshold.InsightParameter.builder() .name("column_name") @@ -97,7 +97,7 @@ internal class TestCreateParamsTest { .suggested(false) .addThreshold( TestCreateParams.Threshold.builder() - .insightName("duplicateRowCount") + .insightName(TestCreateParams.Threshold.InsightName.DUPLICATE_ROW_COUNT) .addInsightParameter( TestCreateParams.Threshold.InsightParameter.builder() .name("column_name") @@ -139,7 +139,7 @@ internal class TestCreateParamsTest { assertThat(body.thresholds()) .containsExactly( TestCreateParams.Threshold.builder() - .insightName("duplicateRowCount") + .insightName(TestCreateParams.Threshold.InsightName.DUPLICATE_ROW_COUNT) .addInsightParameter( TestCreateParams.Threshold.InsightParameter.builder() .name("column_name") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt index f4e284f2..81df5c07 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt @@ -29,7 +29,7 @@ internal class TestCreateResponseTest { .suggested(false) .addThreshold( TestCreateResponse.Threshold.builder() - .insightName("duplicateRowCount") + .insightName(TestCreateResponse.Threshold.InsightName.DUPLICATE_ROW_COUNT) .addInsightParameter( TestCreateResponse.Threshold.InsightParameter.builder() .name("column_name") @@ -74,7 +74,7 @@ internal class TestCreateResponseTest { assertThat(testCreateResponse.thresholds()) .containsExactly( TestCreateResponse.Threshold.builder() - .insightName("duplicateRowCount") + .insightName(TestCreateResponse.Threshold.InsightName.DUPLICATE_ROW_COUNT) .addInsightParameter( TestCreateResponse.Threshold.InsightParameter.builder() .name("column_name") @@ -117,7 +117,7 @@ internal class TestCreateResponseTest { .suggested(false) .addThreshold( TestCreateResponse.Threshold.builder() - .insightName("duplicateRowCount") + .insightName(TestCreateResponse.Threshold.InsightName.DUPLICATE_ROW_COUNT) .addInsightParameter( TestCreateResponse.Threshold.InsightParameter.builder() .name("column_name") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt index 915e8704..1f32f4a2 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt @@ -15,15 +15,6 @@ internal class TestListResponseTest { fun create() { val testListResponse = TestListResponse.builder() - ._meta( - TestListResponse._Meta - .builder() - .page(1L) - .perPage(1L) - .totalItems(0L) - .totalPages(0L) - .build() - ) .addItem( TestListResponse.Item.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -42,7 +33,9 @@ internal class TestListResponseTest { .suggested(false) .addThreshold( TestListResponse.Item.Threshold.builder() - .insightName("duplicateRowCount") + .insightName( + TestListResponse.Item.Threshold.InsightName.DUPLICATE_ROW_COUNT + ) .addInsightParameter( TestListResponse.Item.Threshold.InsightParameter.builder() .name("column_name") @@ -70,16 +63,6 @@ internal class TestListResponseTest { ) .build() - assertThat(testListResponse._meta()) - .isEqualTo( - TestListResponse._Meta - .builder() - .page(1L) - .perPage(1L) - .totalItems(0L) - .totalPages(0L) - .build() - ) assertThat(testListResponse.items()) .containsExactly( TestListResponse.Item.builder() @@ -99,7 +82,9 @@ internal class TestListResponseTest { .suggested(false) .addThreshold( TestListResponse.Item.Threshold.builder() - .insightName("duplicateRowCount") + .insightName( + TestListResponse.Item.Threshold.InsightName.DUPLICATE_ROW_COUNT + ) .addInsightParameter( TestListResponse.Item.Threshold.InsightParameter.builder() .name("column_name") @@ -130,15 +115,6 @@ internal class TestListResponseTest { val jsonMapper = jsonMapper() val testListResponse = TestListResponse.builder() - ._meta( - TestListResponse._Meta - .builder() - .page(1L) - .perPage(1L) - .totalItems(0L) - .totalPages(0L) - .build() - ) .addItem( TestListResponse.Item.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -157,7 +133,9 @@ internal class TestListResponseTest { .suggested(false) .addThreshold( TestListResponse.Item.Threshold.builder() - .insightName("duplicateRowCount") + .insightName( + TestListResponse.Item.Threshold.InsightName.DUPLICATE_ROW_COUNT + ) .addInsightParameter( TestListResponse.Item.Threshold.InsightParameter.builder() .name("column_name") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt index cc01be9e..29e4a402 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt @@ -43,7 +43,7 @@ internal class TestServiceAsyncTest { .suggested(false) .addThreshold( TestCreateParams.Threshold.builder() - .insightName("duplicateRowCount") + .insightName(TestCreateParams.Threshold.InsightName.DUPLICATE_ROW_COUNT) .addInsightParameter( TestCreateParams.Threshold.InsightParameter.builder() .name("column_name") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt index ec3b3e75..c1d7ca69 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt @@ -43,7 +43,7 @@ internal class TestServiceTest { .suggested(false) .addThreshold( TestCreateParams.Threshold.builder() - .insightName("duplicateRowCount") + .insightName(TestCreateParams.Threshold.InsightName.DUPLICATE_ROW_COUNT) .addInsightParameter( TestCreateParams.Threshold.InsightParameter.builder() .name("column_name") From 7ae882e19aca6c298a0184d135a4365b5148f3ce Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 10:25:45 +0000 Subject: [PATCH 71/74] feat(api): expose test update endpoint --- .stats.yml | 4 +- .../testresults/TestResultListResponse.kt | 364 +--------- .../testresults/TestResultListResponse.kt | 364 +--------- .../models/projects/tests/TestCreateParams.kt | 354 +-------- .../projects/tests/TestCreateResponse.kt | 354 +-------- .../models/projects/tests/TestListResponse.kt | 676 +++++++++--------- .../testresults/TestResultListResponseTest.kt | 15 +- .../testresults/TestResultListResponseTest.kt | 15 +- .../projects/tests/TestCreateParamsTest.kt | 6 +- .../projects/tests/TestCreateResponseTest.kt | 6 +- .../projects/tests/TestListResponseTest.kt | 40 +- .../async/projects/TestServiceAsyncTest.kt | 2 +- .../blocking/projects/TestServiceTest.kt | 2 +- 13 files changed, 419 insertions(+), 1783 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5c7a03ff..4546c8ad 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 17 -openapi_spec_hash: 4f09f95fd31c148d1be80b7e643346ce -config_hash: 087e6b8013c398a6d24031d24594fdec +openapi_spec_hash: 8827ead72aa0c635ccafac5e008fe247 +config_hash: 30422a4611d93ca69e4f1aff60b9ddb5 diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt index 3f65823c..da5447fc 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt @@ -2360,7 +2360,7 @@ private constructor( class Threshold private constructor( - private val insightName: JsonField, + private val insightName: JsonField, private val insightParameters: JsonField>, private val measurement: JsonField, private val operator: JsonField, @@ -2373,7 +2373,7 @@ private constructor( private constructor( @JsonProperty("insightName") @ExcludeMissing - insightName: JsonField = JsonMissing.of(), + insightName: JsonField = JsonMissing.of(), @JsonProperty("insightParameters") @ExcludeMissing insightParameters: JsonField> = JsonMissing.of(), @@ -2405,12 +2405,10 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun insightName(): Optional = insightName.getOptional("insightName") + fun insightName(): Optional = insightName.getOptional("insightName") /** - * The insight parameters. Required only for some test subtypes. For example, for - * tests that require a column name, the insight parameters will be - * [{'name': 'column_name', 'value': 'Age'}] + * The insight parameters. Required only for some test subtypes. * * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -2459,7 +2457,7 @@ private constructor( */ @JsonProperty("insightName") @ExcludeMissing - fun _insightName(): JsonField = insightName + fun _insightName(): JsonField = insightName /** * Returns the raw JSON value of [insightParameters]. @@ -2530,7 +2528,7 @@ private constructor( /** A builder for [Threshold]. */ class Builder internal constructor() { - private var insightName: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() private var insightParameters: JsonField>? = null private var measurement: JsonField = JsonMissing.of() private var operator: JsonField = JsonMissing.of() @@ -2550,25 +2548,20 @@ private constructor( } /** The insight name to be evaluated. */ - fun insightName(insightName: InsightName) = - insightName(JsonField.of(insightName)) + fun insightName(insightName: String) = insightName(JsonField.of(insightName)) /** * Sets [Builder.insightName] to an arbitrary JSON value. * - * You should usually call [Builder.insightName] with a well-typed [InsightName] + * You should usually call [Builder.insightName] with a well-typed [String] * value instead. This method is primarily for setting the field to an * undocumented or not yet supported value. */ - fun insightName(insightName: JsonField) = apply { + fun insightName(insightName: JsonField) = apply { this.insightName = insightName } - /** - * The insight parameters. Required only for some test subtypes. For example, - * for tests that require a column name, the insight parameters will be - * [{'name': 'column_name', 'value': 'Age'}] - */ + /** The insight parameters. Required only for some test subtypes. */ fun insightParameters(insightParameters: List?) = insightParameters(JsonField.ofNullable(insightParameters)) @@ -2714,7 +2707,7 @@ private constructor( return@apply } - insightName().ifPresent { it.validate() } + insightName() insightParameters().ifPresent { it.forEach { it.validate() } } measurement() operator().ifPresent { it.validate() } @@ -2739,7 +2732,7 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (insightName.asKnown().getOrNull()?.validity() ?: 0) + + (if (insightName.asKnown().isPresent) 1 else 0) + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (measurement.asKnown().isPresent) 1 else 0) + @@ -2747,339 +2740,6 @@ private constructor( (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) - /** The insight name to be evaluated. */ - class InsightName - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val CHARACTER_LENGTH = of("characterLength") - - @JvmField val CLASS_IMBALANCE = of("classImbalance") - - @JvmField - val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") - - @JvmField val COLUMN_AVERAGE = of("columnAverage") - - @JvmField val COLUMN_DRIFT = of("columnDrift") - - @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") - - @JvmField val CONFIDENCE_DISTRIBUTION = of("confidenceDistribution") - - @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") - - @JvmField val CONTAINS_PII = of("containsPii") - - @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") - - @JvmField val CORRELATED_FEATURES = of("correlatedFeatures") - - @JvmField val CUSTOM_METRIC = of("customMetric") - - @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") - - @JvmField val EMPTY_FEATURES = of("emptyFeatures") - - @JvmField val FEATURE_DRIFT = of("featureDrift") - - @JvmField val FEATURE_PROFILE = of("featureProfile") - - @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") - - @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") - - @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") - - @JvmField val IS_CODE = of("isCode") - - @JvmField val IS_JSON = of("isJson") - - @JvmField val LLM_RUBRIC_V2 = of("llmRubricV2") - - @JvmField val LABEL_DRIFT = of("labelDrift") - - @JvmField val METRICS = of("metrics") - - @JvmField val NEW_CATEGORIES = of("newCategories") - - @JvmField val NEW_LABELS = of("newLabels") - - @JvmField val NULL_ROW_COUNT = of("nullRowCount") - - @JvmField val PP_SCORE = of("ppScore") - - @JvmField val QUASI_CONSTANT_FEATURES = of("quasiConstantFeatures") - - @JvmField val SENTENCE_LENGTH = of("sentenceLength") - - @JvmField val SIZE_RATIO = of("sizeRatio") - - @JvmField val SPECIAL_CHARACTERS = of("specialCharacters") - - @JvmField val STRING_VALIDATION = of("stringValidation") - - @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") - - @JvmStatic fun of(value: String) = InsightName(JsonField.of(value)) - } - - /** An enum containing [InsightName]'s known values. */ - enum class Known { - CHARACTER_LENGTH, - CLASS_IMBALANCE, - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, - COLUMN_AVERAGE, - COLUMN_DRIFT, - COLUMN_VALUES_MATCH, - CONFIDENCE_DISTRIBUTION, - CONFLICTING_LABEL_ROW_COUNT, - CONTAINS_PII, - CONTAINS_VALID_URL, - CORRELATED_FEATURES, - CUSTOM_METRIC, - DUPLICATE_ROW_COUNT, - EMPTY_FEATURES, - FEATURE_DRIFT, - FEATURE_PROFILE, - GREAT_EXPECTATIONS, - GROUP_BY_COLUMN_STATS_CHECK, - ILL_FORMED_ROW_COUNT, - IS_CODE, - IS_JSON, - LLM_RUBRIC_V2, - LABEL_DRIFT, - METRICS, - NEW_CATEGORIES, - NEW_LABELS, - NULL_ROW_COUNT, - PP_SCORE, - QUASI_CONSTANT_FEATURES, - SENTENCE_LENGTH, - SIZE_RATIO, - SPECIAL_CHARACTERS, - STRING_VALIDATION, - TRAIN_VAL_LEAKAGE_ROW_COUNT, - } - - /** - * An enum containing [InsightName]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [InsightName] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CHARACTER_LENGTH, - CLASS_IMBALANCE, - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, - COLUMN_AVERAGE, - COLUMN_DRIFT, - COLUMN_VALUES_MATCH, - CONFIDENCE_DISTRIBUTION, - CONFLICTING_LABEL_ROW_COUNT, - CONTAINS_PII, - CONTAINS_VALID_URL, - CORRELATED_FEATURES, - CUSTOM_METRIC, - DUPLICATE_ROW_COUNT, - EMPTY_FEATURES, - FEATURE_DRIFT, - FEATURE_PROFILE, - GREAT_EXPECTATIONS, - GROUP_BY_COLUMN_STATS_CHECK, - ILL_FORMED_ROW_COUNT, - IS_CODE, - IS_JSON, - LLM_RUBRIC_V2, - LABEL_DRIFT, - METRICS, - NEW_CATEGORIES, - NEW_LABELS, - NULL_ROW_COUNT, - PP_SCORE, - QUASI_CONSTANT_FEATURES, - SENTENCE_LENGTH, - SIZE_RATIO, - SPECIAL_CHARACTERS, - STRING_VALIDATION, - TRAIN_VAL_LEAKAGE_ROW_COUNT, - /** - * An enum member indicating that [InsightName] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CHARACTER_LENGTH -> Value.CHARACTER_LENGTH - CLASS_IMBALANCE -> Value.CLASS_IMBALANCE - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> - Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B - COLUMN_AVERAGE -> Value.COLUMN_AVERAGE - COLUMN_DRIFT -> Value.COLUMN_DRIFT - COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH - CONFIDENCE_DISTRIBUTION -> Value.CONFIDENCE_DISTRIBUTION - CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT - CONTAINS_PII -> Value.CONTAINS_PII - CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL - CORRELATED_FEATURES -> Value.CORRELATED_FEATURES - CUSTOM_METRIC -> Value.CUSTOM_METRIC - DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT - EMPTY_FEATURES -> Value.EMPTY_FEATURES - FEATURE_DRIFT -> Value.FEATURE_DRIFT - FEATURE_PROFILE -> Value.FEATURE_PROFILE - GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS - GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK - ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT - IS_CODE -> Value.IS_CODE - IS_JSON -> Value.IS_JSON - LLM_RUBRIC_V2 -> Value.LLM_RUBRIC_V2 - LABEL_DRIFT -> Value.LABEL_DRIFT - METRICS -> Value.METRICS - NEW_CATEGORIES -> Value.NEW_CATEGORIES - NEW_LABELS -> Value.NEW_LABELS - NULL_ROW_COUNT -> Value.NULL_ROW_COUNT - PP_SCORE -> Value.PP_SCORE - QUASI_CONSTANT_FEATURES -> Value.QUASI_CONSTANT_FEATURES - SENTENCE_LENGTH -> Value.SENTENCE_LENGTH - SIZE_RATIO -> Value.SIZE_RATIO - SPECIAL_CHARACTERS -> Value.SPECIAL_CHARACTERS - STRING_VALIDATION -> Value.STRING_VALIDATION - TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OpenlayerInvalidDataException if this class instance's value is a not - * a known member. - */ - fun known(): Known = - when (this) { - CHARACTER_LENGTH -> Known.CHARACTER_LENGTH - CLASS_IMBALANCE -> Known.CLASS_IMBALANCE - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> - Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B - COLUMN_AVERAGE -> Known.COLUMN_AVERAGE - COLUMN_DRIFT -> Known.COLUMN_DRIFT - COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH - CONFIDENCE_DISTRIBUTION -> Known.CONFIDENCE_DISTRIBUTION - CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT - CONTAINS_PII -> Known.CONTAINS_PII - CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL - CORRELATED_FEATURES -> Known.CORRELATED_FEATURES - CUSTOM_METRIC -> Known.CUSTOM_METRIC - DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT - EMPTY_FEATURES -> Known.EMPTY_FEATURES - FEATURE_DRIFT -> Known.FEATURE_DRIFT - FEATURE_PROFILE -> Known.FEATURE_PROFILE - GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS - GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK - ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT - IS_CODE -> Known.IS_CODE - IS_JSON -> Known.IS_JSON - LLM_RUBRIC_V2 -> Known.LLM_RUBRIC_V2 - LABEL_DRIFT -> Known.LABEL_DRIFT - METRICS -> Known.METRICS - NEW_CATEGORIES -> Known.NEW_CATEGORIES - NEW_LABELS -> Known.NEW_LABELS - NULL_ROW_COUNT -> Known.NULL_ROW_COUNT - PP_SCORE -> Known.PP_SCORE - QUASI_CONSTANT_FEATURES -> Known.QUASI_CONSTANT_FEATURES - SENTENCE_LENGTH -> Known.SENTENCE_LENGTH - SIZE_RATIO -> Known.SIZE_RATIO - SPECIAL_CHARACTERS -> Known.SPECIAL_CHARACTERS - STRING_VALIDATION -> Known.STRING_VALIDATION - TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT - else -> - throw OpenlayerInvalidDataException("Unknown InsightName: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OpenlayerInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OpenlayerInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): InsightName = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OpenlayerInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is InsightName && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class InsightParameter private constructor( private val name: JsonField, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt index adcbdab7..4008e972 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt @@ -2360,7 +2360,7 @@ private constructor( class Threshold private constructor( - private val insightName: JsonField, + private val insightName: JsonField, private val insightParameters: JsonField>, private val measurement: JsonField, private val operator: JsonField, @@ -2373,7 +2373,7 @@ private constructor( private constructor( @JsonProperty("insightName") @ExcludeMissing - insightName: JsonField = JsonMissing.of(), + insightName: JsonField = JsonMissing.of(), @JsonProperty("insightParameters") @ExcludeMissing insightParameters: JsonField> = JsonMissing.of(), @@ -2405,12 +2405,10 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun insightName(): Optional = insightName.getOptional("insightName") + fun insightName(): Optional = insightName.getOptional("insightName") /** - * The insight parameters. Required only for some test subtypes. For example, for - * tests that require a column name, the insight parameters will be - * [{'name': 'column_name', 'value': 'Age'}] + * The insight parameters. Required only for some test subtypes. * * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -2459,7 +2457,7 @@ private constructor( */ @JsonProperty("insightName") @ExcludeMissing - fun _insightName(): JsonField = insightName + fun _insightName(): JsonField = insightName /** * Returns the raw JSON value of [insightParameters]. @@ -2530,7 +2528,7 @@ private constructor( /** A builder for [Threshold]. */ class Builder internal constructor() { - private var insightName: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() private var insightParameters: JsonField>? = null private var measurement: JsonField = JsonMissing.of() private var operator: JsonField = JsonMissing.of() @@ -2550,25 +2548,20 @@ private constructor( } /** The insight name to be evaluated. */ - fun insightName(insightName: InsightName) = - insightName(JsonField.of(insightName)) + fun insightName(insightName: String) = insightName(JsonField.of(insightName)) /** * Sets [Builder.insightName] to an arbitrary JSON value. * - * You should usually call [Builder.insightName] with a well-typed [InsightName] + * You should usually call [Builder.insightName] with a well-typed [String] * value instead. This method is primarily for setting the field to an * undocumented or not yet supported value. */ - fun insightName(insightName: JsonField) = apply { + fun insightName(insightName: JsonField) = apply { this.insightName = insightName } - /** - * The insight parameters. Required only for some test subtypes. For example, - * for tests that require a column name, the insight parameters will be - * [{'name': 'column_name', 'value': 'Age'}] - */ + /** The insight parameters. Required only for some test subtypes. */ fun insightParameters(insightParameters: List?) = insightParameters(JsonField.ofNullable(insightParameters)) @@ -2714,7 +2707,7 @@ private constructor( return@apply } - insightName().ifPresent { it.validate() } + insightName() insightParameters().ifPresent { it.forEach { it.validate() } } measurement() operator().ifPresent { it.validate() } @@ -2739,7 +2732,7 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (insightName.asKnown().getOrNull()?.validity() ?: 0) + + (if (insightName.asKnown().isPresent) 1 else 0) + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (measurement.asKnown().isPresent) 1 else 0) + @@ -2747,339 +2740,6 @@ private constructor( (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) - /** The insight name to be evaluated. */ - class InsightName - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val CHARACTER_LENGTH = of("characterLength") - - @JvmField val CLASS_IMBALANCE = of("classImbalance") - - @JvmField - val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") - - @JvmField val COLUMN_AVERAGE = of("columnAverage") - - @JvmField val COLUMN_DRIFT = of("columnDrift") - - @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") - - @JvmField val CONFIDENCE_DISTRIBUTION = of("confidenceDistribution") - - @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") - - @JvmField val CONTAINS_PII = of("containsPii") - - @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") - - @JvmField val CORRELATED_FEATURES = of("correlatedFeatures") - - @JvmField val CUSTOM_METRIC = of("customMetric") - - @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") - - @JvmField val EMPTY_FEATURES = of("emptyFeatures") - - @JvmField val FEATURE_DRIFT = of("featureDrift") - - @JvmField val FEATURE_PROFILE = of("featureProfile") - - @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") - - @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") - - @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") - - @JvmField val IS_CODE = of("isCode") - - @JvmField val IS_JSON = of("isJson") - - @JvmField val LLM_RUBRIC_V2 = of("llmRubricV2") - - @JvmField val LABEL_DRIFT = of("labelDrift") - - @JvmField val METRICS = of("metrics") - - @JvmField val NEW_CATEGORIES = of("newCategories") - - @JvmField val NEW_LABELS = of("newLabels") - - @JvmField val NULL_ROW_COUNT = of("nullRowCount") - - @JvmField val PP_SCORE = of("ppScore") - - @JvmField val QUASI_CONSTANT_FEATURES = of("quasiConstantFeatures") - - @JvmField val SENTENCE_LENGTH = of("sentenceLength") - - @JvmField val SIZE_RATIO = of("sizeRatio") - - @JvmField val SPECIAL_CHARACTERS = of("specialCharacters") - - @JvmField val STRING_VALIDATION = of("stringValidation") - - @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") - - @JvmStatic fun of(value: String) = InsightName(JsonField.of(value)) - } - - /** An enum containing [InsightName]'s known values. */ - enum class Known { - CHARACTER_LENGTH, - CLASS_IMBALANCE, - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, - COLUMN_AVERAGE, - COLUMN_DRIFT, - COLUMN_VALUES_MATCH, - CONFIDENCE_DISTRIBUTION, - CONFLICTING_LABEL_ROW_COUNT, - CONTAINS_PII, - CONTAINS_VALID_URL, - CORRELATED_FEATURES, - CUSTOM_METRIC, - DUPLICATE_ROW_COUNT, - EMPTY_FEATURES, - FEATURE_DRIFT, - FEATURE_PROFILE, - GREAT_EXPECTATIONS, - GROUP_BY_COLUMN_STATS_CHECK, - ILL_FORMED_ROW_COUNT, - IS_CODE, - IS_JSON, - LLM_RUBRIC_V2, - LABEL_DRIFT, - METRICS, - NEW_CATEGORIES, - NEW_LABELS, - NULL_ROW_COUNT, - PP_SCORE, - QUASI_CONSTANT_FEATURES, - SENTENCE_LENGTH, - SIZE_RATIO, - SPECIAL_CHARACTERS, - STRING_VALIDATION, - TRAIN_VAL_LEAKAGE_ROW_COUNT, - } - - /** - * An enum containing [InsightName]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [InsightName] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CHARACTER_LENGTH, - CLASS_IMBALANCE, - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, - COLUMN_AVERAGE, - COLUMN_DRIFT, - COLUMN_VALUES_MATCH, - CONFIDENCE_DISTRIBUTION, - CONFLICTING_LABEL_ROW_COUNT, - CONTAINS_PII, - CONTAINS_VALID_URL, - CORRELATED_FEATURES, - CUSTOM_METRIC, - DUPLICATE_ROW_COUNT, - EMPTY_FEATURES, - FEATURE_DRIFT, - FEATURE_PROFILE, - GREAT_EXPECTATIONS, - GROUP_BY_COLUMN_STATS_CHECK, - ILL_FORMED_ROW_COUNT, - IS_CODE, - IS_JSON, - LLM_RUBRIC_V2, - LABEL_DRIFT, - METRICS, - NEW_CATEGORIES, - NEW_LABELS, - NULL_ROW_COUNT, - PP_SCORE, - QUASI_CONSTANT_FEATURES, - SENTENCE_LENGTH, - SIZE_RATIO, - SPECIAL_CHARACTERS, - STRING_VALIDATION, - TRAIN_VAL_LEAKAGE_ROW_COUNT, - /** - * An enum member indicating that [InsightName] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CHARACTER_LENGTH -> Value.CHARACTER_LENGTH - CLASS_IMBALANCE -> Value.CLASS_IMBALANCE - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> - Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B - COLUMN_AVERAGE -> Value.COLUMN_AVERAGE - COLUMN_DRIFT -> Value.COLUMN_DRIFT - COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH - CONFIDENCE_DISTRIBUTION -> Value.CONFIDENCE_DISTRIBUTION - CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT - CONTAINS_PII -> Value.CONTAINS_PII - CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL - CORRELATED_FEATURES -> Value.CORRELATED_FEATURES - CUSTOM_METRIC -> Value.CUSTOM_METRIC - DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT - EMPTY_FEATURES -> Value.EMPTY_FEATURES - FEATURE_DRIFT -> Value.FEATURE_DRIFT - FEATURE_PROFILE -> Value.FEATURE_PROFILE - GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS - GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK - ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT - IS_CODE -> Value.IS_CODE - IS_JSON -> Value.IS_JSON - LLM_RUBRIC_V2 -> Value.LLM_RUBRIC_V2 - LABEL_DRIFT -> Value.LABEL_DRIFT - METRICS -> Value.METRICS - NEW_CATEGORIES -> Value.NEW_CATEGORIES - NEW_LABELS -> Value.NEW_LABELS - NULL_ROW_COUNT -> Value.NULL_ROW_COUNT - PP_SCORE -> Value.PP_SCORE - QUASI_CONSTANT_FEATURES -> Value.QUASI_CONSTANT_FEATURES - SENTENCE_LENGTH -> Value.SENTENCE_LENGTH - SIZE_RATIO -> Value.SIZE_RATIO - SPECIAL_CHARACTERS -> Value.SPECIAL_CHARACTERS - STRING_VALIDATION -> Value.STRING_VALIDATION - TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OpenlayerInvalidDataException if this class instance's value is a not - * a known member. - */ - fun known(): Known = - when (this) { - CHARACTER_LENGTH -> Known.CHARACTER_LENGTH - CLASS_IMBALANCE -> Known.CLASS_IMBALANCE - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> - Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B - COLUMN_AVERAGE -> Known.COLUMN_AVERAGE - COLUMN_DRIFT -> Known.COLUMN_DRIFT - COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH - CONFIDENCE_DISTRIBUTION -> Known.CONFIDENCE_DISTRIBUTION - CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT - CONTAINS_PII -> Known.CONTAINS_PII - CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL - CORRELATED_FEATURES -> Known.CORRELATED_FEATURES - CUSTOM_METRIC -> Known.CUSTOM_METRIC - DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT - EMPTY_FEATURES -> Known.EMPTY_FEATURES - FEATURE_DRIFT -> Known.FEATURE_DRIFT - FEATURE_PROFILE -> Known.FEATURE_PROFILE - GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS - GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK - ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT - IS_CODE -> Known.IS_CODE - IS_JSON -> Known.IS_JSON - LLM_RUBRIC_V2 -> Known.LLM_RUBRIC_V2 - LABEL_DRIFT -> Known.LABEL_DRIFT - METRICS -> Known.METRICS - NEW_CATEGORIES -> Known.NEW_CATEGORIES - NEW_LABELS -> Known.NEW_LABELS - NULL_ROW_COUNT -> Known.NULL_ROW_COUNT - PP_SCORE -> Known.PP_SCORE - QUASI_CONSTANT_FEATURES -> Known.QUASI_CONSTANT_FEATURES - SENTENCE_LENGTH -> Known.SENTENCE_LENGTH - SIZE_RATIO -> Known.SIZE_RATIO - SPECIAL_CHARACTERS -> Known.SPECIAL_CHARACTERS - STRING_VALIDATION -> Known.STRING_VALIDATION - TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT - else -> - throw OpenlayerInvalidDataException("Unknown InsightName: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OpenlayerInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OpenlayerInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): InsightName = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OpenlayerInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is InsightName && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class InsightParameter private constructor( private val name: JsonField, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt index 13947875..fee3025e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt @@ -2339,7 +2339,7 @@ private constructor( class Threshold private constructor( - private val insightName: JsonField, + private val insightName: JsonField, private val insightParameters: JsonField>, private val measurement: JsonField, private val operator: JsonField, @@ -2352,7 +2352,7 @@ private constructor( private constructor( @JsonProperty("insightName") @ExcludeMissing - insightName: JsonField = JsonMissing.of(), + insightName: JsonField = JsonMissing.of(), @JsonProperty("insightParameters") @ExcludeMissing insightParameters: JsonField> = JsonMissing.of(), @@ -2382,12 +2382,10 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun insightName(): Optional = insightName.getOptional("insightName") + fun insightName(): Optional = insightName.getOptional("insightName") /** - * The insight parameters. Required only for some test subtypes. For example, for tests that - * require a column name, the insight parameters will be - * [{'name': 'column_name', 'value': 'Age'}] + * The insight parameters. Required only for some test subtypes. * * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -2434,7 +2432,7 @@ private constructor( */ @JsonProperty("insightName") @ExcludeMissing - fun _insightName(): JsonField = insightName + fun _insightName(): JsonField = insightName /** * Returns the raw JSON value of [insightParameters]. @@ -2500,7 +2498,7 @@ private constructor( /** A builder for [Threshold]. */ class Builder internal constructor() { - private var insightName: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() private var insightParameters: JsonField>? = null private var measurement: JsonField = JsonMissing.of() private var operator: JsonField = JsonMissing.of() @@ -2520,24 +2518,20 @@ private constructor( } /** The insight name to be evaluated. */ - fun insightName(insightName: InsightName) = insightName(JsonField.of(insightName)) + fun insightName(insightName: String) = insightName(JsonField.of(insightName)) /** * Sets [Builder.insightName] to an arbitrary JSON value. * - * You should usually call [Builder.insightName] with a well-typed [InsightName] value + * You should usually call [Builder.insightName] with a well-typed [String] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun insightName(insightName: JsonField) = apply { + fun insightName(insightName: JsonField) = apply { this.insightName = insightName } - /** - * The insight parameters. Required only for some test subtypes. For example, for tests - * that require a column name, the insight parameters will be - * [{'name': 'column_name', 'value': 'Age'}] - */ + /** The insight parameters. Required only for some test subtypes. */ fun insightParameters(insightParameters: List?) = insightParameters(JsonField.ofNullable(insightParameters)) @@ -2678,7 +2672,7 @@ private constructor( return@apply } - insightName().ifPresent { it.validate() } + insightName() insightParameters().ifPresent { it.forEach { it.validate() } } measurement() operator().ifPresent { it.validate() } @@ -2703,337 +2697,13 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (insightName.asKnown().getOrNull()?.validity() ?: 0) + + (if (insightName.asKnown().isPresent) 1 else 0) + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (measurement.asKnown().isPresent) 1 else 0) + (operator.asKnown().getOrNull()?.validity() ?: 0) + (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) - /** The insight name to be evaluated. */ - class InsightName @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CHARACTER_LENGTH = of("characterLength") - - @JvmField val CLASS_IMBALANCE = of("classImbalance") - - @JvmField val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") - - @JvmField val COLUMN_AVERAGE = of("columnAverage") - - @JvmField val COLUMN_DRIFT = of("columnDrift") - - @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") - - @JvmField val CONFIDENCE_DISTRIBUTION = of("confidenceDistribution") - - @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") - - @JvmField val CONTAINS_PII = of("containsPii") - - @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") - - @JvmField val CORRELATED_FEATURES = of("correlatedFeatures") - - @JvmField val CUSTOM_METRIC = of("customMetric") - - @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") - - @JvmField val EMPTY_FEATURES = of("emptyFeatures") - - @JvmField val FEATURE_DRIFT = of("featureDrift") - - @JvmField val FEATURE_PROFILE = of("featureProfile") - - @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") - - @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") - - @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") - - @JvmField val IS_CODE = of("isCode") - - @JvmField val IS_JSON = of("isJson") - - @JvmField val LLM_RUBRIC_V2 = of("llmRubricV2") - - @JvmField val LABEL_DRIFT = of("labelDrift") - - @JvmField val METRICS = of("metrics") - - @JvmField val NEW_CATEGORIES = of("newCategories") - - @JvmField val NEW_LABELS = of("newLabels") - - @JvmField val NULL_ROW_COUNT = of("nullRowCount") - - @JvmField val PP_SCORE = of("ppScore") - - @JvmField val QUASI_CONSTANT_FEATURES = of("quasiConstantFeatures") - - @JvmField val SENTENCE_LENGTH = of("sentenceLength") - - @JvmField val SIZE_RATIO = of("sizeRatio") - - @JvmField val SPECIAL_CHARACTERS = of("specialCharacters") - - @JvmField val STRING_VALIDATION = of("stringValidation") - - @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") - - @JvmStatic fun of(value: String) = InsightName(JsonField.of(value)) - } - - /** An enum containing [InsightName]'s known values. */ - enum class Known { - CHARACTER_LENGTH, - CLASS_IMBALANCE, - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, - COLUMN_AVERAGE, - COLUMN_DRIFT, - COLUMN_VALUES_MATCH, - CONFIDENCE_DISTRIBUTION, - CONFLICTING_LABEL_ROW_COUNT, - CONTAINS_PII, - CONTAINS_VALID_URL, - CORRELATED_FEATURES, - CUSTOM_METRIC, - DUPLICATE_ROW_COUNT, - EMPTY_FEATURES, - FEATURE_DRIFT, - FEATURE_PROFILE, - GREAT_EXPECTATIONS, - GROUP_BY_COLUMN_STATS_CHECK, - ILL_FORMED_ROW_COUNT, - IS_CODE, - IS_JSON, - LLM_RUBRIC_V2, - LABEL_DRIFT, - METRICS, - NEW_CATEGORIES, - NEW_LABELS, - NULL_ROW_COUNT, - PP_SCORE, - QUASI_CONSTANT_FEATURES, - SENTENCE_LENGTH, - SIZE_RATIO, - SPECIAL_CHARACTERS, - STRING_VALIDATION, - TRAIN_VAL_LEAKAGE_ROW_COUNT, - } - - /** - * An enum containing [InsightName]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [InsightName] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CHARACTER_LENGTH, - CLASS_IMBALANCE, - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, - COLUMN_AVERAGE, - COLUMN_DRIFT, - COLUMN_VALUES_MATCH, - CONFIDENCE_DISTRIBUTION, - CONFLICTING_LABEL_ROW_COUNT, - CONTAINS_PII, - CONTAINS_VALID_URL, - CORRELATED_FEATURES, - CUSTOM_METRIC, - DUPLICATE_ROW_COUNT, - EMPTY_FEATURES, - FEATURE_DRIFT, - FEATURE_PROFILE, - GREAT_EXPECTATIONS, - GROUP_BY_COLUMN_STATS_CHECK, - ILL_FORMED_ROW_COUNT, - IS_CODE, - IS_JSON, - LLM_RUBRIC_V2, - LABEL_DRIFT, - METRICS, - NEW_CATEGORIES, - NEW_LABELS, - NULL_ROW_COUNT, - PP_SCORE, - QUASI_CONSTANT_FEATURES, - SENTENCE_LENGTH, - SIZE_RATIO, - SPECIAL_CHARACTERS, - STRING_VALIDATION, - TRAIN_VAL_LEAKAGE_ROW_COUNT, - /** - * An enum member indicating that [InsightName] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CHARACTER_LENGTH -> Value.CHARACTER_LENGTH - CLASS_IMBALANCE -> Value.CLASS_IMBALANCE - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B - COLUMN_AVERAGE -> Value.COLUMN_AVERAGE - COLUMN_DRIFT -> Value.COLUMN_DRIFT - COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH - CONFIDENCE_DISTRIBUTION -> Value.CONFIDENCE_DISTRIBUTION - CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT - CONTAINS_PII -> Value.CONTAINS_PII - CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL - CORRELATED_FEATURES -> Value.CORRELATED_FEATURES - CUSTOM_METRIC -> Value.CUSTOM_METRIC - DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT - EMPTY_FEATURES -> Value.EMPTY_FEATURES - FEATURE_DRIFT -> Value.FEATURE_DRIFT - FEATURE_PROFILE -> Value.FEATURE_PROFILE - GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS - GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK - ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT - IS_CODE -> Value.IS_CODE - IS_JSON -> Value.IS_JSON - LLM_RUBRIC_V2 -> Value.LLM_RUBRIC_V2 - LABEL_DRIFT -> Value.LABEL_DRIFT - METRICS -> Value.METRICS - NEW_CATEGORIES -> Value.NEW_CATEGORIES - NEW_LABELS -> Value.NEW_LABELS - NULL_ROW_COUNT -> Value.NULL_ROW_COUNT - PP_SCORE -> Value.PP_SCORE - QUASI_CONSTANT_FEATURES -> Value.QUASI_CONSTANT_FEATURES - SENTENCE_LENGTH -> Value.SENTENCE_LENGTH - SIZE_RATIO -> Value.SIZE_RATIO - SPECIAL_CHARACTERS -> Value.SPECIAL_CHARACTERS - STRING_VALIDATION -> Value.STRING_VALIDATION - TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OpenlayerInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CHARACTER_LENGTH -> Known.CHARACTER_LENGTH - CLASS_IMBALANCE -> Known.CLASS_IMBALANCE - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B - COLUMN_AVERAGE -> Known.COLUMN_AVERAGE - COLUMN_DRIFT -> Known.COLUMN_DRIFT - COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH - CONFIDENCE_DISTRIBUTION -> Known.CONFIDENCE_DISTRIBUTION - CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT - CONTAINS_PII -> Known.CONTAINS_PII - CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL - CORRELATED_FEATURES -> Known.CORRELATED_FEATURES - CUSTOM_METRIC -> Known.CUSTOM_METRIC - DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT - EMPTY_FEATURES -> Known.EMPTY_FEATURES - FEATURE_DRIFT -> Known.FEATURE_DRIFT - FEATURE_PROFILE -> Known.FEATURE_PROFILE - GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS - GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK - ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT - IS_CODE -> Known.IS_CODE - IS_JSON -> Known.IS_JSON - LLM_RUBRIC_V2 -> Known.LLM_RUBRIC_V2 - LABEL_DRIFT -> Known.LABEL_DRIFT - METRICS -> Known.METRICS - NEW_CATEGORIES -> Known.NEW_CATEGORIES - NEW_LABELS -> Known.NEW_LABELS - NULL_ROW_COUNT -> Known.NULL_ROW_COUNT - PP_SCORE -> Known.PP_SCORE - QUASI_CONSTANT_FEATURES -> Known.QUASI_CONSTANT_FEATURES - SENTENCE_LENGTH -> Known.SENTENCE_LENGTH - SIZE_RATIO -> Known.SIZE_RATIO - SPECIAL_CHARACTERS -> Known.SPECIAL_CHARACTERS - STRING_VALIDATION -> Known.STRING_VALIDATION - TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT - else -> throw OpenlayerInvalidDataException("Unknown InsightName: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OpenlayerInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OpenlayerInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): InsightName = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OpenlayerInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is InsightName && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class InsightParameter private constructor( private val name: JsonField, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt index 8daa8003..804667da 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt @@ -1406,7 +1406,7 @@ private constructor( class Threshold private constructor( - private val insightName: JsonField, + private val insightName: JsonField, private val insightParameters: JsonField>, private val measurement: JsonField, private val operator: JsonField, @@ -1419,7 +1419,7 @@ private constructor( private constructor( @JsonProperty("insightName") @ExcludeMissing - insightName: JsonField = JsonMissing.of(), + insightName: JsonField = JsonMissing.of(), @JsonProperty("insightParameters") @ExcludeMissing insightParameters: JsonField> = JsonMissing.of(), @@ -1449,12 +1449,10 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun insightName(): Optional = insightName.getOptional("insightName") + fun insightName(): Optional = insightName.getOptional("insightName") /** - * The insight parameters. Required only for some test subtypes. For example, for tests that - * require a column name, the insight parameters will be - * [{'name': 'column_name', 'value': 'Age'}] + * The insight parameters. Required only for some test subtypes. * * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -1501,7 +1499,7 @@ private constructor( */ @JsonProperty("insightName") @ExcludeMissing - fun _insightName(): JsonField = insightName + fun _insightName(): JsonField = insightName /** * Returns the raw JSON value of [insightParameters]. @@ -1567,7 +1565,7 @@ private constructor( /** A builder for [Threshold]. */ class Builder internal constructor() { - private var insightName: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() private var insightParameters: JsonField>? = null private var measurement: JsonField = JsonMissing.of() private var operator: JsonField = JsonMissing.of() @@ -1587,24 +1585,20 @@ private constructor( } /** The insight name to be evaluated. */ - fun insightName(insightName: InsightName) = insightName(JsonField.of(insightName)) + fun insightName(insightName: String) = insightName(JsonField.of(insightName)) /** * Sets [Builder.insightName] to an arbitrary JSON value. * - * You should usually call [Builder.insightName] with a well-typed [InsightName] value + * You should usually call [Builder.insightName] with a well-typed [String] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun insightName(insightName: JsonField) = apply { + fun insightName(insightName: JsonField) = apply { this.insightName = insightName } - /** - * The insight parameters. Required only for some test subtypes. For example, for tests - * that require a column name, the insight parameters will be - * [{'name': 'column_name', 'value': 'Age'}] - */ + /** The insight parameters. Required only for some test subtypes. */ fun insightParameters(insightParameters: List?) = insightParameters(JsonField.ofNullable(insightParameters)) @@ -1745,7 +1739,7 @@ private constructor( return@apply } - insightName().ifPresent { it.validate() } + insightName() insightParameters().ifPresent { it.forEach { it.validate() } } measurement() operator().ifPresent { it.validate() } @@ -1770,337 +1764,13 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (insightName.asKnown().getOrNull()?.validity() ?: 0) + + (if (insightName.asKnown().isPresent) 1 else 0) + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (measurement.asKnown().isPresent) 1 else 0) + (operator.asKnown().getOrNull()?.validity() ?: 0) + (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) - /** The insight name to be evaluated. */ - class InsightName @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CHARACTER_LENGTH = of("characterLength") - - @JvmField val CLASS_IMBALANCE = of("classImbalance") - - @JvmField val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") - - @JvmField val COLUMN_AVERAGE = of("columnAverage") - - @JvmField val COLUMN_DRIFT = of("columnDrift") - - @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") - - @JvmField val CONFIDENCE_DISTRIBUTION = of("confidenceDistribution") - - @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") - - @JvmField val CONTAINS_PII = of("containsPii") - - @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") - - @JvmField val CORRELATED_FEATURES = of("correlatedFeatures") - - @JvmField val CUSTOM_METRIC = of("customMetric") - - @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") - - @JvmField val EMPTY_FEATURES = of("emptyFeatures") - - @JvmField val FEATURE_DRIFT = of("featureDrift") - - @JvmField val FEATURE_PROFILE = of("featureProfile") - - @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") - - @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") - - @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") - - @JvmField val IS_CODE = of("isCode") - - @JvmField val IS_JSON = of("isJson") - - @JvmField val LLM_RUBRIC_V2 = of("llmRubricV2") - - @JvmField val LABEL_DRIFT = of("labelDrift") - - @JvmField val METRICS = of("metrics") - - @JvmField val NEW_CATEGORIES = of("newCategories") - - @JvmField val NEW_LABELS = of("newLabels") - - @JvmField val NULL_ROW_COUNT = of("nullRowCount") - - @JvmField val PP_SCORE = of("ppScore") - - @JvmField val QUASI_CONSTANT_FEATURES = of("quasiConstantFeatures") - - @JvmField val SENTENCE_LENGTH = of("sentenceLength") - - @JvmField val SIZE_RATIO = of("sizeRatio") - - @JvmField val SPECIAL_CHARACTERS = of("specialCharacters") - - @JvmField val STRING_VALIDATION = of("stringValidation") - - @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") - - @JvmStatic fun of(value: String) = InsightName(JsonField.of(value)) - } - - /** An enum containing [InsightName]'s known values. */ - enum class Known { - CHARACTER_LENGTH, - CLASS_IMBALANCE, - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, - COLUMN_AVERAGE, - COLUMN_DRIFT, - COLUMN_VALUES_MATCH, - CONFIDENCE_DISTRIBUTION, - CONFLICTING_LABEL_ROW_COUNT, - CONTAINS_PII, - CONTAINS_VALID_URL, - CORRELATED_FEATURES, - CUSTOM_METRIC, - DUPLICATE_ROW_COUNT, - EMPTY_FEATURES, - FEATURE_DRIFT, - FEATURE_PROFILE, - GREAT_EXPECTATIONS, - GROUP_BY_COLUMN_STATS_CHECK, - ILL_FORMED_ROW_COUNT, - IS_CODE, - IS_JSON, - LLM_RUBRIC_V2, - LABEL_DRIFT, - METRICS, - NEW_CATEGORIES, - NEW_LABELS, - NULL_ROW_COUNT, - PP_SCORE, - QUASI_CONSTANT_FEATURES, - SENTENCE_LENGTH, - SIZE_RATIO, - SPECIAL_CHARACTERS, - STRING_VALIDATION, - TRAIN_VAL_LEAKAGE_ROW_COUNT, - } - - /** - * An enum containing [InsightName]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [InsightName] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CHARACTER_LENGTH, - CLASS_IMBALANCE, - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, - COLUMN_AVERAGE, - COLUMN_DRIFT, - COLUMN_VALUES_MATCH, - CONFIDENCE_DISTRIBUTION, - CONFLICTING_LABEL_ROW_COUNT, - CONTAINS_PII, - CONTAINS_VALID_URL, - CORRELATED_FEATURES, - CUSTOM_METRIC, - DUPLICATE_ROW_COUNT, - EMPTY_FEATURES, - FEATURE_DRIFT, - FEATURE_PROFILE, - GREAT_EXPECTATIONS, - GROUP_BY_COLUMN_STATS_CHECK, - ILL_FORMED_ROW_COUNT, - IS_CODE, - IS_JSON, - LLM_RUBRIC_V2, - LABEL_DRIFT, - METRICS, - NEW_CATEGORIES, - NEW_LABELS, - NULL_ROW_COUNT, - PP_SCORE, - QUASI_CONSTANT_FEATURES, - SENTENCE_LENGTH, - SIZE_RATIO, - SPECIAL_CHARACTERS, - STRING_VALIDATION, - TRAIN_VAL_LEAKAGE_ROW_COUNT, - /** - * An enum member indicating that [InsightName] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CHARACTER_LENGTH -> Value.CHARACTER_LENGTH - CLASS_IMBALANCE -> Value.CLASS_IMBALANCE - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B - COLUMN_AVERAGE -> Value.COLUMN_AVERAGE - COLUMN_DRIFT -> Value.COLUMN_DRIFT - COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH - CONFIDENCE_DISTRIBUTION -> Value.CONFIDENCE_DISTRIBUTION - CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT - CONTAINS_PII -> Value.CONTAINS_PII - CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL - CORRELATED_FEATURES -> Value.CORRELATED_FEATURES - CUSTOM_METRIC -> Value.CUSTOM_METRIC - DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT - EMPTY_FEATURES -> Value.EMPTY_FEATURES - FEATURE_DRIFT -> Value.FEATURE_DRIFT - FEATURE_PROFILE -> Value.FEATURE_PROFILE - GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS - GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK - ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT - IS_CODE -> Value.IS_CODE - IS_JSON -> Value.IS_JSON - LLM_RUBRIC_V2 -> Value.LLM_RUBRIC_V2 - LABEL_DRIFT -> Value.LABEL_DRIFT - METRICS -> Value.METRICS - NEW_CATEGORIES -> Value.NEW_CATEGORIES - NEW_LABELS -> Value.NEW_LABELS - NULL_ROW_COUNT -> Value.NULL_ROW_COUNT - PP_SCORE -> Value.PP_SCORE - QUASI_CONSTANT_FEATURES -> Value.QUASI_CONSTANT_FEATURES - SENTENCE_LENGTH -> Value.SENTENCE_LENGTH - SIZE_RATIO -> Value.SIZE_RATIO - SPECIAL_CHARACTERS -> Value.SPECIAL_CHARACTERS - STRING_VALIDATION -> Value.STRING_VALIDATION - TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OpenlayerInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CHARACTER_LENGTH -> Known.CHARACTER_LENGTH - CLASS_IMBALANCE -> Known.CLASS_IMBALANCE - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B - COLUMN_AVERAGE -> Known.COLUMN_AVERAGE - COLUMN_DRIFT -> Known.COLUMN_DRIFT - COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH - CONFIDENCE_DISTRIBUTION -> Known.CONFIDENCE_DISTRIBUTION - CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT - CONTAINS_PII -> Known.CONTAINS_PII - CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL - CORRELATED_FEATURES -> Known.CORRELATED_FEATURES - CUSTOM_METRIC -> Known.CUSTOM_METRIC - DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT - EMPTY_FEATURES -> Known.EMPTY_FEATURES - FEATURE_DRIFT -> Known.FEATURE_DRIFT - FEATURE_PROFILE -> Known.FEATURE_PROFILE - GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS - GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK - ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT - IS_CODE -> Known.IS_CODE - IS_JSON -> Known.IS_JSON - LLM_RUBRIC_V2 -> Known.LLM_RUBRIC_V2 - LABEL_DRIFT -> Known.LABEL_DRIFT - METRICS -> Known.METRICS - NEW_CATEGORIES -> Known.NEW_CATEGORIES - NEW_LABELS -> Known.NEW_LABELS - NULL_ROW_COUNT -> Known.NULL_ROW_COUNT - PP_SCORE -> Known.PP_SCORE - QUASI_CONSTANT_FEATURES -> Known.QUASI_CONSTANT_FEATURES - SENTENCE_LENGTH -> Known.SENTENCE_LENGTH - SIZE_RATIO -> Known.SIZE_RATIO - SPECIAL_CHARACTERS -> Known.SPECIAL_CHARACTERS - STRING_VALIDATION -> Known.STRING_VALIDATION - TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT - else -> throw OpenlayerInvalidDataException("Unknown InsightName: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OpenlayerInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OpenlayerInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): InsightName = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OpenlayerInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is InsightName && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class InsightParameter private constructor( private val name: JsonField, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt index e3a0fd60..b42c76fd 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt @@ -34,14 +34,22 @@ import kotlin.jvm.optionals.getOrNull class TestListResponse private constructor( + private val _meta: JsonField<_Meta>, private val items: JsonField>, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() - ) : this(items, mutableMapOf()) + @JsonProperty("_meta") @ExcludeMissing _meta: JsonField<_Meta> = JsonMissing.of(), + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of(), + ) : this(_meta, items, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun _meta(): _Meta = _meta.getRequired("_meta") /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is @@ -49,6 +57,13 @@ private constructor( */ fun items(): List = items.getRequired("items") + /** + * Returns the raw JSON value of [_meta]. + * + * Unlike [_meta], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("_meta") @ExcludeMissing fun __meta(): JsonField<_Meta> = _meta + /** * Returns the raw JSON value of [items]. * @@ -75,6 +90,7 @@ private constructor( * * The following fields are required: * ```java + * ._meta() * .items() * ``` */ @@ -84,15 +100,27 @@ private constructor( /** A builder for [TestListResponse]. */ class Builder internal constructor() { + private var _meta: JsonField<_Meta>? = null private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(testListResponse: TestListResponse) = apply { + _meta = testListResponse._meta items = testListResponse.items.map { it.toMutableList() } additionalProperties = testListResponse.additionalProperties.toMutableMap() } + fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta)) + + /** + * Sets [Builder._meta] to an arbitrary JSON value. + * + * You should usually call [Builder._meta] with a well-typed [_Meta] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } + fun items(items: List) = items(JsonField.of(items)) /** @@ -142,6 +170,7 @@ private constructor( * * The following fields are required: * ```java + * ._meta() * .items() * ``` * @@ -149,6 +178,7 @@ private constructor( */ fun build(): TestListResponse = TestListResponse( + checkRequired("_meta", _meta), checkRequired("items", items).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) @@ -161,6 +191,7 @@ private constructor( return@apply } + _meta().validate() items().forEach { it.validate() } validated = true } @@ -180,7 +211,280 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (_meta.asKnown().getOrNull()?.validity() ?: 0) + + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class _Meta + private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("page") @ExcludeMissing page: JsonField = JsonMissing.of(), + @JsonProperty("perPage") @ExcludeMissing perPage: JsonField = JsonMissing.of(), + @JsonProperty("totalItems") + @ExcludeMissing + totalItems: JsonField = JsonMissing.of(), + @JsonProperty("totalPages") + @ExcludeMissing + totalPages: JsonField = JsonMissing.of(), + ) : this(page, perPage, totalItems, totalPages, mutableMapOf()) + + /** + * The current page. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun page(): Long = page.getRequired("page") + + /** + * The number of items per page. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun perPage(): Long = perPage.getRequired("perPage") + + /** + * The total number of items. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalItems(): Long = totalItems.getRequired("totalItems") + + /** + * The total number of pages. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalPages(): Long = totalPages.getRequired("totalPages") + + /** + * Returns the raw JSON value of [page]. + * + * Unlike [page], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("page") @ExcludeMissing fun _page(): JsonField = page + + /** + * Returns the raw JSON value of [perPage]. + * + * Unlike [perPage], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("perPage") @ExcludeMissing fun _perPage(): JsonField = perPage + + /** + * Returns the raw JSON value of [totalItems]. + * + * Unlike [totalItems], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems(): JsonField = totalItems + + /** + * Returns the raw JSON value of [totalPages]. + * + * Unlike [totalPages], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages(): JsonField = totalPages + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [_Meta]. + * + * The following fields are required: + * ```java + * .page() + * .perPage() + * .totalItems() + * .totalPages() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [_Meta]. */ + class Builder internal constructor() { + + private var page: JsonField? = null + private var perPage: JsonField? = null + private var totalItems: JsonField? = null + private var totalPages: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(_meta: _Meta) = apply { + page = _meta.page + perPage = _meta.perPage + totalItems = _meta.totalItems + totalPages = _meta.totalPages + additionalProperties = _meta.additionalProperties.toMutableMap() + } + + /** The current page. */ + fun page(page: Long) = page(JsonField.of(page)) + + /** + * Sets [Builder.page] to an arbitrary JSON value. + * + * You should usually call [Builder.page] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun page(page: JsonField) = apply { this.page = page } + + /** The number of items per page. */ + fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) + + /** + * Sets [Builder.perPage] to an arbitrary JSON value. + * + * You should usually call [Builder.perPage] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } + + /** The total number of items. */ + fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) + + /** + * Sets [Builder.totalItems] to an arbitrary JSON value. + * + * You should usually call [Builder.totalItems] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } + + /** The total number of pages. */ + fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) + + /** + * Sets [Builder.totalPages] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPages] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [_Meta]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .page() + * .perPage() + * .totalItems() + * .totalPages() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): _Meta = + _Meta( + checkRequired("page", page), + checkRequired("perPage", perPage), + checkRequired("totalItems", totalItems), + checkRequired("totalPages", totalPages), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): _Meta = apply { + if (validated) { + return@apply + } + + page() + perPage() + totalItems() + totalPages() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (page.asKnown().isPresent) 1 else 0) + + (if (perPage.asKnown().isPresent) 1 else 0) + + (if (totalItems.asKnown().isPresent) 1 else 0) + + (if (totalPages.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is _Meta && page == other.page && perPage == other.perPage && totalItems == other.totalItems && totalPages == other.totalPages && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(page, perPage, totalItems, totalPages, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + } class Item private constructor( @@ -1583,7 +1887,7 @@ private constructor( class Threshold private constructor( - private val insightName: JsonField, + private val insightName: JsonField, private val insightParameters: JsonField>, private val measurement: JsonField, private val operator: JsonField, @@ -1596,7 +1900,7 @@ private constructor( private constructor( @JsonProperty("insightName") @ExcludeMissing - insightName: JsonField = JsonMissing.of(), + insightName: JsonField = JsonMissing.of(), @JsonProperty("insightParameters") @ExcludeMissing insightParameters: JsonField> = JsonMissing.of(), @@ -1626,12 +1930,10 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun insightName(): Optional = insightName.getOptional("insightName") + fun insightName(): Optional = insightName.getOptional("insightName") /** - * The insight parameters. Required only for some test subtypes. For example, for tests - * that require a column name, the insight parameters will be - * [{'name': 'column_name', 'value': 'Age'}] + * The insight parameters. Required only for some test subtypes. * * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -1680,7 +1982,7 @@ private constructor( */ @JsonProperty("insightName") @ExcludeMissing - fun _insightName(): JsonField = insightName + fun _insightName(): JsonField = insightName /** * Returns the raw JSON value of [insightParameters]. @@ -1750,7 +2052,7 @@ private constructor( /** A builder for [Threshold]. */ class Builder internal constructor() { - private var insightName: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() private var insightParameters: JsonField>? = null private var measurement: JsonField = JsonMissing.of() private var operator: JsonField = JsonMissing.of() @@ -1770,24 +2072,20 @@ private constructor( } /** The insight name to be evaluated. */ - fun insightName(insightName: InsightName) = insightName(JsonField.of(insightName)) + fun insightName(insightName: String) = insightName(JsonField.of(insightName)) /** * Sets [Builder.insightName] to an arbitrary JSON value. * - * You should usually call [Builder.insightName] with a well-typed [InsightName] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * You should usually call [Builder.insightName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun insightName(insightName: JsonField) = apply { + fun insightName(insightName: JsonField) = apply { this.insightName = insightName } - /** - * The insight parameters. Required only for some test subtypes. For example, for - * tests that require a column name, the insight parameters will be - * [{'name': 'column_name', 'value': 'Age'}] - */ + /** The insight parameters. Required only for some test subtypes. */ fun insightParameters(insightParameters: List?) = insightParameters(JsonField.ofNullable(insightParameters)) @@ -1933,7 +2231,7 @@ private constructor( return@apply } - insightName().ifPresent { it.validate() } + insightName() insightParameters().ifPresent { it.forEach { it.validate() } } measurement() operator().ifPresent { it.validate() } @@ -1958,7 +2256,7 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (insightName.asKnown().getOrNull()?.validity() ?: 0) + + (if (insightName.asKnown().isPresent) 1 else 0) + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (measurement.asKnown().isPresent) 1 else 0) + @@ -1966,332 +2264,6 @@ private constructor( (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) - /** The insight name to be evaluated. */ - class InsightName - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CHARACTER_LENGTH = of("characterLength") - - @JvmField val CLASS_IMBALANCE = of("classImbalance") - - @JvmField - val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") - - @JvmField val COLUMN_AVERAGE = of("columnAverage") - - @JvmField val COLUMN_DRIFT = of("columnDrift") - - @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") - - @JvmField val CONFIDENCE_DISTRIBUTION = of("confidenceDistribution") - - @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") - - @JvmField val CONTAINS_PII = of("containsPii") - - @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") - - @JvmField val CORRELATED_FEATURES = of("correlatedFeatures") - - @JvmField val CUSTOM_METRIC = of("customMetric") - - @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") - - @JvmField val EMPTY_FEATURES = of("emptyFeatures") - - @JvmField val FEATURE_DRIFT = of("featureDrift") - - @JvmField val FEATURE_PROFILE = of("featureProfile") - - @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") - - @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") - - @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") - - @JvmField val IS_CODE = of("isCode") - - @JvmField val IS_JSON = of("isJson") - - @JvmField val LLM_RUBRIC_V2 = of("llmRubricV2") - - @JvmField val LABEL_DRIFT = of("labelDrift") - - @JvmField val METRICS = of("metrics") - - @JvmField val NEW_CATEGORIES = of("newCategories") - - @JvmField val NEW_LABELS = of("newLabels") - - @JvmField val NULL_ROW_COUNT = of("nullRowCount") - - @JvmField val PP_SCORE = of("ppScore") - - @JvmField val QUASI_CONSTANT_FEATURES = of("quasiConstantFeatures") - - @JvmField val SENTENCE_LENGTH = of("sentenceLength") - - @JvmField val SIZE_RATIO = of("sizeRatio") - - @JvmField val SPECIAL_CHARACTERS = of("specialCharacters") - - @JvmField val STRING_VALIDATION = of("stringValidation") - - @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") - - @JvmStatic fun of(value: String) = InsightName(JsonField.of(value)) - } - - /** An enum containing [InsightName]'s known values. */ - enum class Known { - CHARACTER_LENGTH, - CLASS_IMBALANCE, - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, - COLUMN_AVERAGE, - COLUMN_DRIFT, - COLUMN_VALUES_MATCH, - CONFIDENCE_DISTRIBUTION, - CONFLICTING_LABEL_ROW_COUNT, - CONTAINS_PII, - CONTAINS_VALID_URL, - CORRELATED_FEATURES, - CUSTOM_METRIC, - DUPLICATE_ROW_COUNT, - EMPTY_FEATURES, - FEATURE_DRIFT, - FEATURE_PROFILE, - GREAT_EXPECTATIONS, - GROUP_BY_COLUMN_STATS_CHECK, - ILL_FORMED_ROW_COUNT, - IS_CODE, - IS_JSON, - LLM_RUBRIC_V2, - LABEL_DRIFT, - METRICS, - NEW_CATEGORIES, - NEW_LABELS, - NULL_ROW_COUNT, - PP_SCORE, - QUASI_CONSTANT_FEATURES, - SENTENCE_LENGTH, - SIZE_RATIO, - SPECIAL_CHARACTERS, - STRING_VALIDATION, - TRAIN_VAL_LEAKAGE_ROW_COUNT, - } - - /** - * An enum containing [InsightName]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [InsightName] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CHARACTER_LENGTH, - CLASS_IMBALANCE, - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, - COLUMN_AVERAGE, - COLUMN_DRIFT, - COLUMN_VALUES_MATCH, - CONFIDENCE_DISTRIBUTION, - CONFLICTING_LABEL_ROW_COUNT, - CONTAINS_PII, - CONTAINS_VALID_URL, - CORRELATED_FEATURES, - CUSTOM_METRIC, - DUPLICATE_ROW_COUNT, - EMPTY_FEATURES, - FEATURE_DRIFT, - FEATURE_PROFILE, - GREAT_EXPECTATIONS, - GROUP_BY_COLUMN_STATS_CHECK, - ILL_FORMED_ROW_COUNT, - IS_CODE, - IS_JSON, - LLM_RUBRIC_V2, - LABEL_DRIFT, - METRICS, - NEW_CATEGORIES, - NEW_LABELS, - NULL_ROW_COUNT, - PP_SCORE, - QUASI_CONSTANT_FEATURES, - SENTENCE_LENGTH, - SIZE_RATIO, - SPECIAL_CHARACTERS, - STRING_VALIDATION, - TRAIN_VAL_LEAKAGE_ROW_COUNT, - /** - * An enum member indicating that [InsightName] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CHARACTER_LENGTH -> Value.CHARACTER_LENGTH - CLASS_IMBALANCE -> Value.CLASS_IMBALANCE - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B - COLUMN_AVERAGE -> Value.COLUMN_AVERAGE - COLUMN_DRIFT -> Value.COLUMN_DRIFT - COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH - CONFIDENCE_DISTRIBUTION -> Value.CONFIDENCE_DISTRIBUTION - CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT - CONTAINS_PII -> Value.CONTAINS_PII - CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL - CORRELATED_FEATURES -> Value.CORRELATED_FEATURES - CUSTOM_METRIC -> Value.CUSTOM_METRIC - DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT - EMPTY_FEATURES -> Value.EMPTY_FEATURES - FEATURE_DRIFT -> Value.FEATURE_DRIFT - FEATURE_PROFILE -> Value.FEATURE_PROFILE - GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS - GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK - ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT - IS_CODE -> Value.IS_CODE - IS_JSON -> Value.IS_JSON - LLM_RUBRIC_V2 -> Value.LLM_RUBRIC_V2 - LABEL_DRIFT -> Value.LABEL_DRIFT - METRICS -> Value.METRICS - NEW_CATEGORIES -> Value.NEW_CATEGORIES - NEW_LABELS -> Value.NEW_LABELS - NULL_ROW_COUNT -> Value.NULL_ROW_COUNT - PP_SCORE -> Value.PP_SCORE - QUASI_CONSTANT_FEATURES -> Value.QUASI_CONSTANT_FEATURES - SENTENCE_LENGTH -> Value.SENTENCE_LENGTH - SIZE_RATIO -> Value.SIZE_RATIO - SPECIAL_CHARACTERS -> Value.SPECIAL_CHARACTERS - STRING_VALIDATION -> Value.STRING_VALIDATION - TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OpenlayerInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - CHARACTER_LENGTH -> Known.CHARACTER_LENGTH - CLASS_IMBALANCE -> Known.CLASS_IMBALANCE - EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B - COLUMN_AVERAGE -> Known.COLUMN_AVERAGE - COLUMN_DRIFT -> Known.COLUMN_DRIFT - COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH - CONFIDENCE_DISTRIBUTION -> Known.CONFIDENCE_DISTRIBUTION - CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT - CONTAINS_PII -> Known.CONTAINS_PII - CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL - CORRELATED_FEATURES -> Known.CORRELATED_FEATURES - CUSTOM_METRIC -> Known.CUSTOM_METRIC - DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT - EMPTY_FEATURES -> Known.EMPTY_FEATURES - FEATURE_DRIFT -> Known.FEATURE_DRIFT - FEATURE_PROFILE -> Known.FEATURE_PROFILE - GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS - GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK - ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT - IS_CODE -> Known.IS_CODE - IS_JSON -> Known.IS_JSON - LLM_RUBRIC_V2 -> Known.LLM_RUBRIC_V2 - LABEL_DRIFT -> Known.LABEL_DRIFT - METRICS -> Known.METRICS - NEW_CATEGORIES -> Known.NEW_CATEGORIES - NEW_LABELS -> Known.NEW_LABELS - NULL_ROW_COUNT -> Known.NULL_ROW_COUNT - PP_SCORE -> Known.PP_SCORE - QUASI_CONSTANT_FEATURES -> Known.QUASI_CONSTANT_FEATURES - SENTENCE_LENGTH -> Known.SENTENCE_LENGTH - SIZE_RATIO -> Known.SIZE_RATIO - SPECIAL_CHARACTERS -> Known.SPECIAL_CHARACTERS - STRING_VALIDATION -> Known.STRING_VALIDATION - TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT - else -> throw OpenlayerInvalidDataException("Unknown InsightName: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OpenlayerInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OpenlayerInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): InsightName = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OpenlayerInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is InsightName && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class InsightParameter private constructor( private val name: JsonField, @@ -3148,15 +3120,15 @@ private constructor( return true } - return /* spotless:off */ other is TestListResponse && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TestListResponse && _meta == other._meta && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(items, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(_meta, items, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TestListResponse{items=$items, additionalProperties=$additionalProperties}" + "TestListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt index 5045cc8f..f9ecbcb1 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt @@ -48,10 +48,7 @@ internal class TestResultListResponseTest { .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() - .insightName( - TestResultListResponse.Item.Goal.Threshold.InsightName - .DUPLICATE_ROW_COUNT - ) + .insightName("duplicateRowCount") .addInsightParameter( TestResultListResponse.Item.Goal.Threshold .InsightParameter @@ -120,10 +117,7 @@ internal class TestResultListResponseTest { .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() - .insightName( - TestResultListResponse.Item.Goal.Threshold.InsightName - .DUPLICATE_ROW_COUNT - ) + .insightName("duplicateRowCount") .addInsightParameter( TestResultListResponse.Item.Goal.Threshold.InsightParameter .builder() @@ -197,10 +191,7 @@ internal class TestResultListResponseTest { .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() - .insightName( - TestResultListResponse.Item.Goal.Threshold.InsightName - .DUPLICATE_ROW_COUNT - ) + .insightName("duplicateRowCount") .addInsightParameter( TestResultListResponse.Item.Goal.Threshold .InsightParameter diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt index 6051c9ef..53cca3af 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt @@ -48,10 +48,7 @@ internal class TestResultListResponseTest { .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() - .insightName( - TestResultListResponse.Item.Goal.Threshold.InsightName - .DUPLICATE_ROW_COUNT - ) + .insightName("duplicateRowCount") .addInsightParameter( TestResultListResponse.Item.Goal.Threshold .InsightParameter @@ -120,10 +117,7 @@ internal class TestResultListResponseTest { .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() - .insightName( - TestResultListResponse.Item.Goal.Threshold.InsightName - .DUPLICATE_ROW_COUNT - ) + .insightName("duplicateRowCount") .addInsightParameter( TestResultListResponse.Item.Goal.Threshold.InsightParameter .builder() @@ -197,10 +191,7 @@ internal class TestResultListResponseTest { .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() - .insightName( - TestResultListResponse.Item.Goal.Threshold.InsightName - .DUPLICATE_ROW_COUNT - ) + .insightName("duplicateRowCount") .addInsightParameter( TestResultListResponse.Item.Goal.Threshold .InsightParameter diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt index 53507331..e113b43c 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt @@ -27,7 +27,7 @@ internal class TestCreateParamsTest { .suggested(false) .addThreshold( TestCreateParams.Threshold.builder() - .insightName(TestCreateParams.Threshold.InsightName.DUPLICATE_ROW_COUNT) + .insightName("duplicateRowCount") .addInsightParameter( TestCreateParams.Threshold.InsightParameter.builder() .name("column_name") @@ -97,7 +97,7 @@ internal class TestCreateParamsTest { .suggested(false) .addThreshold( TestCreateParams.Threshold.builder() - .insightName(TestCreateParams.Threshold.InsightName.DUPLICATE_ROW_COUNT) + .insightName("duplicateRowCount") .addInsightParameter( TestCreateParams.Threshold.InsightParameter.builder() .name("column_name") @@ -139,7 +139,7 @@ internal class TestCreateParamsTest { assertThat(body.thresholds()) .containsExactly( TestCreateParams.Threshold.builder() - .insightName(TestCreateParams.Threshold.InsightName.DUPLICATE_ROW_COUNT) + .insightName("duplicateRowCount") .addInsightParameter( TestCreateParams.Threshold.InsightParameter.builder() .name("column_name") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt index 81df5c07..f4e284f2 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt @@ -29,7 +29,7 @@ internal class TestCreateResponseTest { .suggested(false) .addThreshold( TestCreateResponse.Threshold.builder() - .insightName(TestCreateResponse.Threshold.InsightName.DUPLICATE_ROW_COUNT) + .insightName("duplicateRowCount") .addInsightParameter( TestCreateResponse.Threshold.InsightParameter.builder() .name("column_name") @@ -74,7 +74,7 @@ internal class TestCreateResponseTest { assertThat(testCreateResponse.thresholds()) .containsExactly( TestCreateResponse.Threshold.builder() - .insightName(TestCreateResponse.Threshold.InsightName.DUPLICATE_ROW_COUNT) + .insightName("duplicateRowCount") .addInsightParameter( TestCreateResponse.Threshold.InsightParameter.builder() .name("column_name") @@ -117,7 +117,7 @@ internal class TestCreateResponseTest { .suggested(false) .addThreshold( TestCreateResponse.Threshold.builder() - .insightName(TestCreateResponse.Threshold.InsightName.DUPLICATE_ROW_COUNT) + .insightName("duplicateRowCount") .addInsightParameter( TestCreateResponse.Threshold.InsightParameter.builder() .name("column_name") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt index 1f32f4a2..915e8704 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt @@ -15,6 +15,15 @@ internal class TestListResponseTest { fun create() { val testListResponse = TestListResponse.builder() + ._meta( + TestListResponse._Meta + .builder() + .page(1L) + .perPage(1L) + .totalItems(0L) + .totalPages(0L) + .build() + ) .addItem( TestListResponse.Item.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -33,9 +42,7 @@ internal class TestListResponseTest { .suggested(false) .addThreshold( TestListResponse.Item.Threshold.builder() - .insightName( - TestListResponse.Item.Threshold.InsightName.DUPLICATE_ROW_COUNT - ) + .insightName("duplicateRowCount") .addInsightParameter( TestListResponse.Item.Threshold.InsightParameter.builder() .name("column_name") @@ -63,6 +70,16 @@ internal class TestListResponseTest { ) .build() + assertThat(testListResponse._meta()) + .isEqualTo( + TestListResponse._Meta + .builder() + .page(1L) + .perPage(1L) + .totalItems(0L) + .totalPages(0L) + .build() + ) assertThat(testListResponse.items()) .containsExactly( TestListResponse.Item.builder() @@ -82,9 +99,7 @@ internal class TestListResponseTest { .suggested(false) .addThreshold( TestListResponse.Item.Threshold.builder() - .insightName( - TestListResponse.Item.Threshold.InsightName.DUPLICATE_ROW_COUNT - ) + .insightName("duplicateRowCount") .addInsightParameter( TestListResponse.Item.Threshold.InsightParameter.builder() .name("column_name") @@ -115,6 +130,15 @@ internal class TestListResponseTest { val jsonMapper = jsonMapper() val testListResponse = TestListResponse.builder() + ._meta( + TestListResponse._Meta + .builder() + .page(1L) + .perPage(1L) + .totalItems(0L) + .totalPages(0L) + .build() + ) .addItem( TestListResponse.Item.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -133,9 +157,7 @@ internal class TestListResponseTest { .suggested(false) .addThreshold( TestListResponse.Item.Threshold.builder() - .insightName( - TestListResponse.Item.Threshold.InsightName.DUPLICATE_ROW_COUNT - ) + .insightName("duplicateRowCount") .addInsightParameter( TestListResponse.Item.Threshold.InsightParameter.builder() .name("column_name") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt index 29e4a402..cc01be9e 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt @@ -43,7 +43,7 @@ internal class TestServiceAsyncTest { .suggested(false) .addThreshold( TestCreateParams.Threshold.builder() - .insightName(TestCreateParams.Threshold.InsightName.DUPLICATE_ROW_COUNT) + .insightName("duplicateRowCount") .addInsightParameter( TestCreateParams.Threshold.InsightParameter.builder() .name("column_name") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt index c1d7ca69..ec3b3e75 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt @@ -43,7 +43,7 @@ internal class TestServiceTest { .suggested(false) .addThreshold( TestCreateParams.Threshold.builder() - .insightName(TestCreateParams.Threshold.InsightName.DUPLICATE_ROW_COUNT) + .insightName("duplicateRowCount") .addInsightParameter( TestCreateParams.Threshold.InsightParameter.builder() .name("column_name") From ded01c545f44e1372efeffd478fc02612172fdd6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 10:39:56 +0000 Subject: [PATCH 72/74] feat(api): api update --- .stats.yml | 4 +- .../testresults/TestResultListResponse.kt | 364 ++- .../testresults/TestResultListResponse.kt | 364 ++- .../models/projects/tests/TestCreateParams.kt | 354 ++- .../projects/tests/TestCreateResponse.kt | 354 ++- .../models/projects/tests/TestListResponse.kt | 676 ++--- .../models/projects/tests/TestUpdateParams.kt | 2320 +++++++++++++++++ .../projects/tests/TestUpdateResponse.kt | 197 ++ .../async/projects/TestServiceAsync.kt | 29 + .../async/projects/TestServiceAsyncImpl.kt | 39 + .../services/blocking/projects/TestService.kt | 26 + .../blocking/projects/TestServiceImpl.kt | 36 + .../testresults/TestResultListResponseTest.kt | 15 +- .../testresults/TestResultListResponseTest.kt | 15 +- .../projects/tests/TestCreateParamsTest.kt | 6 +- .../projects/tests/TestCreateResponseTest.kt | 6 +- .../projects/tests/TestListResponseTest.kt | 40 +- .../projects/tests/TestUpdateParamsTest.kt | 161 ++ .../projects/tests/TestUpdateResponseTest.kt | 41 + .../async/projects/TestServiceAsyncTest.kt | 59 +- .../blocking/projects/TestServiceTest.kt | 58 +- 21 files changed, 4745 insertions(+), 419 deletions(-) create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestUpdateParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestUpdateResponse.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestUpdateParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestUpdateResponseTest.kt diff --git a/.stats.yml b/.stats.yml index 4546c8ad..09980137 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ -configured_endpoints: 17 -openapi_spec_hash: 8827ead72aa0c635ccafac5e008fe247 +configured_endpoints: 18 +openapi_spec_hash: 4f09f95fd31c148d1be80b7e643346ce config_hash: 30422a4611d93ca69e4f1aff60b9ddb5 diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt index da5447fc..3f65823c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponse.kt @@ -2360,7 +2360,7 @@ private constructor( class Threshold private constructor( - private val insightName: JsonField, + private val insightName: JsonField, private val insightParameters: JsonField>, private val measurement: JsonField, private val operator: JsonField, @@ -2373,7 +2373,7 @@ private constructor( private constructor( @JsonProperty("insightName") @ExcludeMissing - insightName: JsonField = JsonMissing.of(), + insightName: JsonField = JsonMissing.of(), @JsonProperty("insightParameters") @ExcludeMissing insightParameters: JsonField> = JsonMissing.of(), @@ -2405,10 +2405,12 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun insightName(): Optional = insightName.getOptional("insightName") + fun insightName(): Optional = insightName.getOptional("insightName") /** - * The insight parameters. Required only for some test subtypes. + * The insight parameters. Required only for some test subtypes. For example, for + * tests that require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] * * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -2457,7 +2459,7 @@ private constructor( */ @JsonProperty("insightName") @ExcludeMissing - fun _insightName(): JsonField = insightName + fun _insightName(): JsonField = insightName /** * Returns the raw JSON value of [insightParameters]. @@ -2528,7 +2530,7 @@ private constructor( /** A builder for [Threshold]. */ class Builder internal constructor() { - private var insightName: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() private var insightParameters: JsonField>? = null private var measurement: JsonField = JsonMissing.of() private var operator: JsonField = JsonMissing.of() @@ -2548,20 +2550,25 @@ private constructor( } /** The insight name to be evaluated. */ - fun insightName(insightName: String) = insightName(JsonField.of(insightName)) + fun insightName(insightName: InsightName) = + insightName(JsonField.of(insightName)) /** * Sets [Builder.insightName] to an arbitrary JSON value. * - * You should usually call [Builder.insightName] with a well-typed [String] + * You should usually call [Builder.insightName] with a well-typed [InsightName] * value instead. This method is primarily for setting the field to an * undocumented or not yet supported value. */ - fun insightName(insightName: JsonField) = apply { + fun insightName(insightName: JsonField) = apply { this.insightName = insightName } - /** The insight parameters. Required only for some test subtypes. */ + /** + * The insight parameters. Required only for some test subtypes. For example, + * for tests that require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] + */ fun insightParameters(insightParameters: List?) = insightParameters(JsonField.ofNullable(insightParameters)) @@ -2707,7 +2714,7 @@ private constructor( return@apply } - insightName() + insightName().ifPresent { it.validate() } insightParameters().ifPresent { it.forEach { it.validate() } } measurement() operator().ifPresent { it.validate() } @@ -2732,7 +2739,7 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (insightName.asKnown().isPresent) 1 else 0) + + (insightName.asKnown().getOrNull()?.validity() ?: 0) + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (measurement.asKnown().isPresent) 1 else 0) + @@ -2740,6 +2747,339 @@ private constructor( (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) + /** The insight name to be evaluated. */ + class InsightName + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val CHARACTER_LENGTH = of("characterLength") + + @JvmField val CLASS_IMBALANCE = of("classImbalance") + + @JvmField + val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") + + @JvmField val COLUMN_AVERAGE = of("columnAverage") + + @JvmField val COLUMN_DRIFT = of("columnDrift") + + @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") + + @JvmField val CONFIDENCE_DISTRIBUTION = of("confidenceDistribution") + + @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") + + @JvmField val CONTAINS_PII = of("containsPii") + + @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") + + @JvmField val CORRELATED_FEATURES = of("correlatedFeatures") + + @JvmField val CUSTOM_METRIC = of("customMetric") + + @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") + + @JvmField val EMPTY_FEATURES = of("emptyFeatures") + + @JvmField val FEATURE_DRIFT = of("featureDrift") + + @JvmField val FEATURE_PROFILE = of("featureProfile") + + @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") + + @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") + + @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") + + @JvmField val IS_CODE = of("isCode") + + @JvmField val IS_JSON = of("isJson") + + @JvmField val LLM_RUBRIC_V2 = of("llmRubricV2") + + @JvmField val LABEL_DRIFT = of("labelDrift") + + @JvmField val METRICS = of("metrics") + + @JvmField val NEW_CATEGORIES = of("newCategories") + + @JvmField val NEW_LABELS = of("newLabels") + + @JvmField val NULL_ROW_COUNT = of("nullRowCount") + + @JvmField val PP_SCORE = of("ppScore") + + @JvmField val QUASI_CONSTANT_FEATURES = of("quasiConstantFeatures") + + @JvmField val SENTENCE_LENGTH = of("sentenceLength") + + @JvmField val SIZE_RATIO = of("sizeRatio") + + @JvmField val SPECIAL_CHARACTERS = of("specialCharacters") + + @JvmField val STRING_VALIDATION = of("stringValidation") + + @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") + + @JvmStatic fun of(value: String) = InsightName(JsonField.of(value)) + } + + /** An enum containing [InsightName]'s known values. */ + enum class Known { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + } + + /** + * An enum containing [InsightName]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [InsightName] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + /** + * An enum member indicating that [InsightName] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CHARACTER_LENGTH -> Value.CHARACTER_LENGTH + CLASS_IMBALANCE -> Value.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> + Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Value.COLUMN_AVERAGE + COLUMN_DRIFT -> Value.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Value.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Value.CONTAINS_PII + CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Value.CORRELATED_FEATURES + CUSTOM_METRIC -> Value.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Value.EMPTY_FEATURES + FEATURE_DRIFT -> Value.FEATURE_DRIFT + FEATURE_PROFILE -> Value.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT + IS_CODE -> Value.IS_CODE + IS_JSON -> Value.IS_JSON + LLM_RUBRIC_V2 -> Value.LLM_RUBRIC_V2 + LABEL_DRIFT -> Value.LABEL_DRIFT + METRICS -> Value.METRICS + NEW_CATEGORIES -> Value.NEW_CATEGORIES + NEW_LABELS -> Value.NEW_LABELS + NULL_ROW_COUNT -> Value.NULL_ROW_COUNT + PP_SCORE -> Value.PP_SCORE + QUASI_CONSTANT_FEATURES -> Value.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Value.SENTENCE_LENGTH + SIZE_RATIO -> Value.SIZE_RATIO + SPECIAL_CHARACTERS -> Value.SPECIAL_CHARACTERS + STRING_VALIDATION -> Value.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + CHARACTER_LENGTH -> Known.CHARACTER_LENGTH + CLASS_IMBALANCE -> Known.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> + Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Known.COLUMN_AVERAGE + COLUMN_DRIFT -> Known.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Known.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Known.CONTAINS_PII + CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Known.CORRELATED_FEATURES + CUSTOM_METRIC -> Known.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Known.EMPTY_FEATURES + FEATURE_DRIFT -> Known.FEATURE_DRIFT + FEATURE_PROFILE -> Known.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT + IS_CODE -> Known.IS_CODE + IS_JSON -> Known.IS_JSON + LLM_RUBRIC_V2 -> Known.LLM_RUBRIC_V2 + LABEL_DRIFT -> Known.LABEL_DRIFT + METRICS -> Known.METRICS + NEW_CATEGORIES -> Known.NEW_CATEGORIES + NEW_LABELS -> Known.NEW_LABELS + NULL_ROW_COUNT -> Known.NULL_ROW_COUNT + PP_SCORE -> Known.PP_SCORE + QUASI_CONSTANT_FEATURES -> Known.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Known.SENTENCE_LENGTH + SIZE_RATIO -> Known.SIZE_RATIO + SPECIAL_CHARACTERS -> Known.SPECIAL_CHARACTERS + STRING_VALIDATION -> Known.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> + throw OpenlayerInvalidDataException("Unknown InsightName: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): InsightName = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InsightName && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + class InsightParameter private constructor( private val name: JsonField, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt index 4008e972..adcbdab7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponse.kt @@ -2360,7 +2360,7 @@ private constructor( class Threshold private constructor( - private val insightName: JsonField, + private val insightName: JsonField, private val insightParameters: JsonField>, private val measurement: JsonField, private val operator: JsonField, @@ -2373,7 +2373,7 @@ private constructor( private constructor( @JsonProperty("insightName") @ExcludeMissing - insightName: JsonField = JsonMissing.of(), + insightName: JsonField = JsonMissing.of(), @JsonProperty("insightParameters") @ExcludeMissing insightParameters: JsonField> = JsonMissing.of(), @@ -2405,10 +2405,12 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun insightName(): Optional = insightName.getOptional("insightName") + fun insightName(): Optional = insightName.getOptional("insightName") /** - * The insight parameters. Required only for some test subtypes. + * The insight parameters. Required only for some test subtypes. For example, for + * tests that require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] * * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -2457,7 +2459,7 @@ private constructor( */ @JsonProperty("insightName") @ExcludeMissing - fun _insightName(): JsonField = insightName + fun _insightName(): JsonField = insightName /** * Returns the raw JSON value of [insightParameters]. @@ -2528,7 +2530,7 @@ private constructor( /** A builder for [Threshold]. */ class Builder internal constructor() { - private var insightName: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() private var insightParameters: JsonField>? = null private var measurement: JsonField = JsonMissing.of() private var operator: JsonField = JsonMissing.of() @@ -2548,20 +2550,25 @@ private constructor( } /** The insight name to be evaluated. */ - fun insightName(insightName: String) = insightName(JsonField.of(insightName)) + fun insightName(insightName: InsightName) = + insightName(JsonField.of(insightName)) /** * Sets [Builder.insightName] to an arbitrary JSON value. * - * You should usually call [Builder.insightName] with a well-typed [String] + * You should usually call [Builder.insightName] with a well-typed [InsightName] * value instead. This method is primarily for setting the field to an * undocumented or not yet supported value. */ - fun insightName(insightName: JsonField) = apply { + fun insightName(insightName: JsonField) = apply { this.insightName = insightName } - /** The insight parameters. Required only for some test subtypes. */ + /** + * The insight parameters. Required only for some test subtypes. For example, + * for tests that require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] + */ fun insightParameters(insightParameters: List?) = insightParameters(JsonField.ofNullable(insightParameters)) @@ -2707,7 +2714,7 @@ private constructor( return@apply } - insightName() + insightName().ifPresent { it.validate() } insightParameters().ifPresent { it.forEach { it.validate() } } measurement() operator().ifPresent { it.validate() } @@ -2732,7 +2739,7 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (insightName.asKnown().isPresent) 1 else 0) + + (insightName.asKnown().getOrNull()?.validity() ?: 0) + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (measurement.asKnown().isPresent) 1 else 0) + @@ -2740,6 +2747,339 @@ private constructor( (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) + /** The insight name to be evaluated. */ + class InsightName + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val CHARACTER_LENGTH = of("characterLength") + + @JvmField val CLASS_IMBALANCE = of("classImbalance") + + @JvmField + val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") + + @JvmField val COLUMN_AVERAGE = of("columnAverage") + + @JvmField val COLUMN_DRIFT = of("columnDrift") + + @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") + + @JvmField val CONFIDENCE_DISTRIBUTION = of("confidenceDistribution") + + @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") + + @JvmField val CONTAINS_PII = of("containsPii") + + @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") + + @JvmField val CORRELATED_FEATURES = of("correlatedFeatures") + + @JvmField val CUSTOM_METRIC = of("customMetric") + + @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") + + @JvmField val EMPTY_FEATURES = of("emptyFeatures") + + @JvmField val FEATURE_DRIFT = of("featureDrift") + + @JvmField val FEATURE_PROFILE = of("featureProfile") + + @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") + + @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") + + @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") + + @JvmField val IS_CODE = of("isCode") + + @JvmField val IS_JSON = of("isJson") + + @JvmField val LLM_RUBRIC_V2 = of("llmRubricV2") + + @JvmField val LABEL_DRIFT = of("labelDrift") + + @JvmField val METRICS = of("metrics") + + @JvmField val NEW_CATEGORIES = of("newCategories") + + @JvmField val NEW_LABELS = of("newLabels") + + @JvmField val NULL_ROW_COUNT = of("nullRowCount") + + @JvmField val PP_SCORE = of("ppScore") + + @JvmField val QUASI_CONSTANT_FEATURES = of("quasiConstantFeatures") + + @JvmField val SENTENCE_LENGTH = of("sentenceLength") + + @JvmField val SIZE_RATIO = of("sizeRatio") + + @JvmField val SPECIAL_CHARACTERS = of("specialCharacters") + + @JvmField val STRING_VALIDATION = of("stringValidation") + + @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") + + @JvmStatic fun of(value: String) = InsightName(JsonField.of(value)) + } + + /** An enum containing [InsightName]'s known values. */ + enum class Known { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + } + + /** + * An enum containing [InsightName]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [InsightName] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + /** + * An enum member indicating that [InsightName] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CHARACTER_LENGTH -> Value.CHARACTER_LENGTH + CLASS_IMBALANCE -> Value.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> + Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Value.COLUMN_AVERAGE + COLUMN_DRIFT -> Value.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Value.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Value.CONTAINS_PII + CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Value.CORRELATED_FEATURES + CUSTOM_METRIC -> Value.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Value.EMPTY_FEATURES + FEATURE_DRIFT -> Value.FEATURE_DRIFT + FEATURE_PROFILE -> Value.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT + IS_CODE -> Value.IS_CODE + IS_JSON -> Value.IS_JSON + LLM_RUBRIC_V2 -> Value.LLM_RUBRIC_V2 + LABEL_DRIFT -> Value.LABEL_DRIFT + METRICS -> Value.METRICS + NEW_CATEGORIES -> Value.NEW_CATEGORIES + NEW_LABELS -> Value.NEW_LABELS + NULL_ROW_COUNT -> Value.NULL_ROW_COUNT + PP_SCORE -> Value.PP_SCORE + QUASI_CONSTANT_FEATURES -> Value.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Value.SENTENCE_LENGTH + SIZE_RATIO -> Value.SIZE_RATIO + SPECIAL_CHARACTERS -> Value.SPECIAL_CHARACTERS + STRING_VALIDATION -> Value.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + CHARACTER_LENGTH -> Known.CHARACTER_LENGTH + CLASS_IMBALANCE -> Known.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> + Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Known.COLUMN_AVERAGE + COLUMN_DRIFT -> Known.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Known.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Known.CONTAINS_PII + CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Known.CORRELATED_FEATURES + CUSTOM_METRIC -> Known.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Known.EMPTY_FEATURES + FEATURE_DRIFT -> Known.FEATURE_DRIFT + FEATURE_PROFILE -> Known.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT + IS_CODE -> Known.IS_CODE + IS_JSON -> Known.IS_JSON + LLM_RUBRIC_V2 -> Known.LLM_RUBRIC_V2 + LABEL_DRIFT -> Known.LABEL_DRIFT + METRICS -> Known.METRICS + NEW_CATEGORIES -> Known.NEW_CATEGORIES + NEW_LABELS -> Known.NEW_LABELS + NULL_ROW_COUNT -> Known.NULL_ROW_COUNT + PP_SCORE -> Known.PP_SCORE + QUASI_CONSTANT_FEATURES -> Known.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Known.SENTENCE_LENGTH + SIZE_RATIO -> Known.SIZE_RATIO + SPECIAL_CHARACTERS -> Known.SPECIAL_CHARACTERS + STRING_VALIDATION -> Known.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> + throw OpenlayerInvalidDataException("Unknown InsightName: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): InsightName = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InsightName && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + class InsightParameter private constructor( private val name: JsonField, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt index fee3025e..13947875 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateParams.kt @@ -2339,7 +2339,7 @@ private constructor( class Threshold private constructor( - private val insightName: JsonField, + private val insightName: JsonField, private val insightParameters: JsonField>, private val measurement: JsonField, private val operator: JsonField, @@ -2352,7 +2352,7 @@ private constructor( private constructor( @JsonProperty("insightName") @ExcludeMissing - insightName: JsonField = JsonMissing.of(), + insightName: JsonField = JsonMissing.of(), @JsonProperty("insightParameters") @ExcludeMissing insightParameters: JsonField> = JsonMissing.of(), @@ -2382,10 +2382,12 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun insightName(): Optional = insightName.getOptional("insightName") + fun insightName(): Optional = insightName.getOptional("insightName") /** - * The insight parameters. Required only for some test subtypes. + * The insight parameters. Required only for some test subtypes. For example, for tests that + * require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] * * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -2432,7 +2434,7 @@ private constructor( */ @JsonProperty("insightName") @ExcludeMissing - fun _insightName(): JsonField = insightName + fun _insightName(): JsonField = insightName /** * Returns the raw JSON value of [insightParameters]. @@ -2498,7 +2500,7 @@ private constructor( /** A builder for [Threshold]. */ class Builder internal constructor() { - private var insightName: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() private var insightParameters: JsonField>? = null private var measurement: JsonField = JsonMissing.of() private var operator: JsonField = JsonMissing.of() @@ -2518,20 +2520,24 @@ private constructor( } /** The insight name to be evaluated. */ - fun insightName(insightName: String) = insightName(JsonField.of(insightName)) + fun insightName(insightName: InsightName) = insightName(JsonField.of(insightName)) /** * Sets [Builder.insightName] to an arbitrary JSON value. * - * You should usually call [Builder.insightName] with a well-typed [String] value + * You should usually call [Builder.insightName] with a well-typed [InsightName] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun insightName(insightName: JsonField) = apply { + fun insightName(insightName: JsonField) = apply { this.insightName = insightName } - /** The insight parameters. Required only for some test subtypes. */ + /** + * The insight parameters. Required only for some test subtypes. For example, for tests + * that require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] + */ fun insightParameters(insightParameters: List?) = insightParameters(JsonField.ofNullable(insightParameters)) @@ -2672,7 +2678,7 @@ private constructor( return@apply } - insightName() + insightName().ifPresent { it.validate() } insightParameters().ifPresent { it.forEach { it.validate() } } measurement() operator().ifPresent { it.validate() } @@ -2697,13 +2703,337 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (insightName.asKnown().isPresent) 1 else 0) + + (insightName.asKnown().getOrNull()?.validity() ?: 0) + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (measurement.asKnown().isPresent) 1 else 0) + (operator.asKnown().getOrNull()?.validity() ?: 0) + (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) + /** The insight name to be evaluated. */ + class InsightName @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val CHARACTER_LENGTH = of("characterLength") + + @JvmField val CLASS_IMBALANCE = of("classImbalance") + + @JvmField val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") + + @JvmField val COLUMN_AVERAGE = of("columnAverage") + + @JvmField val COLUMN_DRIFT = of("columnDrift") + + @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") + + @JvmField val CONFIDENCE_DISTRIBUTION = of("confidenceDistribution") + + @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") + + @JvmField val CONTAINS_PII = of("containsPii") + + @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") + + @JvmField val CORRELATED_FEATURES = of("correlatedFeatures") + + @JvmField val CUSTOM_METRIC = of("customMetric") + + @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") + + @JvmField val EMPTY_FEATURES = of("emptyFeatures") + + @JvmField val FEATURE_DRIFT = of("featureDrift") + + @JvmField val FEATURE_PROFILE = of("featureProfile") + + @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") + + @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") + + @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") + + @JvmField val IS_CODE = of("isCode") + + @JvmField val IS_JSON = of("isJson") + + @JvmField val LLM_RUBRIC_V2 = of("llmRubricV2") + + @JvmField val LABEL_DRIFT = of("labelDrift") + + @JvmField val METRICS = of("metrics") + + @JvmField val NEW_CATEGORIES = of("newCategories") + + @JvmField val NEW_LABELS = of("newLabels") + + @JvmField val NULL_ROW_COUNT = of("nullRowCount") + + @JvmField val PP_SCORE = of("ppScore") + + @JvmField val QUASI_CONSTANT_FEATURES = of("quasiConstantFeatures") + + @JvmField val SENTENCE_LENGTH = of("sentenceLength") + + @JvmField val SIZE_RATIO = of("sizeRatio") + + @JvmField val SPECIAL_CHARACTERS = of("specialCharacters") + + @JvmField val STRING_VALIDATION = of("stringValidation") + + @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") + + @JvmStatic fun of(value: String) = InsightName(JsonField.of(value)) + } + + /** An enum containing [InsightName]'s known values. */ + enum class Known { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + } + + /** + * An enum containing [InsightName]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [InsightName] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + /** + * An enum member indicating that [InsightName] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CHARACTER_LENGTH -> Value.CHARACTER_LENGTH + CLASS_IMBALANCE -> Value.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Value.COLUMN_AVERAGE + COLUMN_DRIFT -> Value.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Value.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Value.CONTAINS_PII + CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Value.CORRELATED_FEATURES + CUSTOM_METRIC -> Value.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Value.EMPTY_FEATURES + FEATURE_DRIFT -> Value.FEATURE_DRIFT + FEATURE_PROFILE -> Value.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT + IS_CODE -> Value.IS_CODE + IS_JSON -> Value.IS_JSON + LLM_RUBRIC_V2 -> Value.LLM_RUBRIC_V2 + LABEL_DRIFT -> Value.LABEL_DRIFT + METRICS -> Value.METRICS + NEW_CATEGORIES -> Value.NEW_CATEGORIES + NEW_LABELS -> Value.NEW_LABELS + NULL_ROW_COUNT -> Value.NULL_ROW_COUNT + PP_SCORE -> Value.PP_SCORE + QUASI_CONSTANT_FEATURES -> Value.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Value.SENTENCE_LENGTH + SIZE_RATIO -> Value.SIZE_RATIO + SPECIAL_CHARACTERS -> Value.SPECIAL_CHARACTERS + STRING_VALIDATION -> Value.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + CHARACTER_LENGTH -> Known.CHARACTER_LENGTH + CLASS_IMBALANCE -> Known.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Known.COLUMN_AVERAGE + COLUMN_DRIFT -> Known.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Known.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Known.CONTAINS_PII + CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Known.CORRELATED_FEATURES + CUSTOM_METRIC -> Known.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Known.EMPTY_FEATURES + FEATURE_DRIFT -> Known.FEATURE_DRIFT + FEATURE_PROFILE -> Known.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT + IS_CODE -> Known.IS_CODE + IS_JSON -> Known.IS_JSON + LLM_RUBRIC_V2 -> Known.LLM_RUBRIC_V2 + LABEL_DRIFT -> Known.LABEL_DRIFT + METRICS -> Known.METRICS + NEW_CATEGORIES -> Known.NEW_CATEGORIES + NEW_LABELS -> Known.NEW_LABELS + NULL_ROW_COUNT -> Known.NULL_ROW_COUNT + PP_SCORE -> Known.PP_SCORE + QUASI_CONSTANT_FEATURES -> Known.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Known.SENTENCE_LENGTH + SIZE_RATIO -> Known.SIZE_RATIO + SPECIAL_CHARACTERS -> Known.SPECIAL_CHARACTERS + STRING_VALIDATION -> Known.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> throw OpenlayerInvalidDataException("Unknown InsightName: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): InsightName = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InsightName && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + class InsightParameter private constructor( private val name: JsonField, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt index 804667da..8daa8003 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponse.kt @@ -1406,7 +1406,7 @@ private constructor( class Threshold private constructor( - private val insightName: JsonField, + private val insightName: JsonField, private val insightParameters: JsonField>, private val measurement: JsonField, private val operator: JsonField, @@ -1419,7 +1419,7 @@ private constructor( private constructor( @JsonProperty("insightName") @ExcludeMissing - insightName: JsonField = JsonMissing.of(), + insightName: JsonField = JsonMissing.of(), @JsonProperty("insightParameters") @ExcludeMissing insightParameters: JsonField> = JsonMissing.of(), @@ -1449,10 +1449,12 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun insightName(): Optional = insightName.getOptional("insightName") + fun insightName(): Optional = insightName.getOptional("insightName") /** - * The insight parameters. Required only for some test subtypes. + * The insight parameters. Required only for some test subtypes. For example, for tests that + * require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] * * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -1499,7 +1501,7 @@ private constructor( */ @JsonProperty("insightName") @ExcludeMissing - fun _insightName(): JsonField = insightName + fun _insightName(): JsonField = insightName /** * Returns the raw JSON value of [insightParameters]. @@ -1565,7 +1567,7 @@ private constructor( /** A builder for [Threshold]. */ class Builder internal constructor() { - private var insightName: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() private var insightParameters: JsonField>? = null private var measurement: JsonField = JsonMissing.of() private var operator: JsonField = JsonMissing.of() @@ -1585,20 +1587,24 @@ private constructor( } /** The insight name to be evaluated. */ - fun insightName(insightName: String) = insightName(JsonField.of(insightName)) + fun insightName(insightName: InsightName) = insightName(JsonField.of(insightName)) /** * Sets [Builder.insightName] to an arbitrary JSON value. * - * You should usually call [Builder.insightName] with a well-typed [String] value + * You should usually call [Builder.insightName] with a well-typed [InsightName] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun insightName(insightName: JsonField) = apply { + fun insightName(insightName: JsonField) = apply { this.insightName = insightName } - /** The insight parameters. Required only for some test subtypes. */ + /** + * The insight parameters. Required only for some test subtypes. For example, for tests + * that require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] + */ fun insightParameters(insightParameters: List?) = insightParameters(JsonField.ofNullable(insightParameters)) @@ -1739,7 +1745,7 @@ private constructor( return@apply } - insightName() + insightName().ifPresent { it.validate() } insightParameters().ifPresent { it.forEach { it.validate() } } measurement() operator().ifPresent { it.validate() } @@ -1764,13 +1770,337 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (insightName.asKnown().isPresent) 1 else 0) + + (insightName.asKnown().getOrNull()?.validity() ?: 0) + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (measurement.asKnown().isPresent) 1 else 0) + (operator.asKnown().getOrNull()?.validity() ?: 0) + (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) + /** The insight name to be evaluated. */ + class InsightName @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val CHARACTER_LENGTH = of("characterLength") + + @JvmField val CLASS_IMBALANCE = of("classImbalance") + + @JvmField val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") + + @JvmField val COLUMN_AVERAGE = of("columnAverage") + + @JvmField val COLUMN_DRIFT = of("columnDrift") + + @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") + + @JvmField val CONFIDENCE_DISTRIBUTION = of("confidenceDistribution") + + @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") + + @JvmField val CONTAINS_PII = of("containsPii") + + @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") + + @JvmField val CORRELATED_FEATURES = of("correlatedFeatures") + + @JvmField val CUSTOM_METRIC = of("customMetric") + + @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") + + @JvmField val EMPTY_FEATURES = of("emptyFeatures") + + @JvmField val FEATURE_DRIFT = of("featureDrift") + + @JvmField val FEATURE_PROFILE = of("featureProfile") + + @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") + + @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") + + @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") + + @JvmField val IS_CODE = of("isCode") + + @JvmField val IS_JSON = of("isJson") + + @JvmField val LLM_RUBRIC_V2 = of("llmRubricV2") + + @JvmField val LABEL_DRIFT = of("labelDrift") + + @JvmField val METRICS = of("metrics") + + @JvmField val NEW_CATEGORIES = of("newCategories") + + @JvmField val NEW_LABELS = of("newLabels") + + @JvmField val NULL_ROW_COUNT = of("nullRowCount") + + @JvmField val PP_SCORE = of("ppScore") + + @JvmField val QUASI_CONSTANT_FEATURES = of("quasiConstantFeatures") + + @JvmField val SENTENCE_LENGTH = of("sentenceLength") + + @JvmField val SIZE_RATIO = of("sizeRatio") + + @JvmField val SPECIAL_CHARACTERS = of("specialCharacters") + + @JvmField val STRING_VALIDATION = of("stringValidation") + + @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") + + @JvmStatic fun of(value: String) = InsightName(JsonField.of(value)) + } + + /** An enum containing [InsightName]'s known values. */ + enum class Known { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + } + + /** + * An enum containing [InsightName]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [InsightName] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + /** + * An enum member indicating that [InsightName] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CHARACTER_LENGTH -> Value.CHARACTER_LENGTH + CLASS_IMBALANCE -> Value.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Value.COLUMN_AVERAGE + COLUMN_DRIFT -> Value.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Value.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Value.CONTAINS_PII + CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Value.CORRELATED_FEATURES + CUSTOM_METRIC -> Value.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Value.EMPTY_FEATURES + FEATURE_DRIFT -> Value.FEATURE_DRIFT + FEATURE_PROFILE -> Value.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT + IS_CODE -> Value.IS_CODE + IS_JSON -> Value.IS_JSON + LLM_RUBRIC_V2 -> Value.LLM_RUBRIC_V2 + LABEL_DRIFT -> Value.LABEL_DRIFT + METRICS -> Value.METRICS + NEW_CATEGORIES -> Value.NEW_CATEGORIES + NEW_LABELS -> Value.NEW_LABELS + NULL_ROW_COUNT -> Value.NULL_ROW_COUNT + PP_SCORE -> Value.PP_SCORE + QUASI_CONSTANT_FEATURES -> Value.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Value.SENTENCE_LENGTH + SIZE_RATIO -> Value.SIZE_RATIO + SPECIAL_CHARACTERS -> Value.SPECIAL_CHARACTERS + STRING_VALIDATION -> Value.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + CHARACTER_LENGTH -> Known.CHARACTER_LENGTH + CLASS_IMBALANCE -> Known.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Known.COLUMN_AVERAGE + COLUMN_DRIFT -> Known.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Known.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Known.CONTAINS_PII + CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Known.CORRELATED_FEATURES + CUSTOM_METRIC -> Known.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Known.EMPTY_FEATURES + FEATURE_DRIFT -> Known.FEATURE_DRIFT + FEATURE_PROFILE -> Known.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT + IS_CODE -> Known.IS_CODE + IS_JSON -> Known.IS_JSON + LLM_RUBRIC_V2 -> Known.LLM_RUBRIC_V2 + LABEL_DRIFT -> Known.LABEL_DRIFT + METRICS -> Known.METRICS + NEW_CATEGORIES -> Known.NEW_CATEGORIES + NEW_LABELS -> Known.NEW_LABELS + NULL_ROW_COUNT -> Known.NULL_ROW_COUNT + PP_SCORE -> Known.PP_SCORE + QUASI_CONSTANT_FEATURES -> Known.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Known.SENTENCE_LENGTH + SIZE_RATIO -> Known.SIZE_RATIO + SPECIAL_CHARACTERS -> Known.SPECIAL_CHARACTERS + STRING_VALIDATION -> Known.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> throw OpenlayerInvalidDataException("Unknown InsightName: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): InsightName = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InsightName && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + class InsightParameter private constructor( private val name: JsonField, diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt index b42c76fd..e3a0fd60 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestListResponse.kt @@ -34,22 +34,14 @@ import kotlin.jvm.optionals.getOrNull class TestListResponse private constructor( - private val _meta: JsonField<_Meta>, private val items: JsonField>, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("_meta") @ExcludeMissing _meta: JsonField<_Meta> = JsonMissing.of(), - @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of(), - ) : this(_meta, items, mutableMapOf()) - - /** - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun _meta(): _Meta = _meta.getRequired("_meta") + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) /** * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is @@ -57,13 +49,6 @@ private constructor( */ fun items(): List = items.getRequired("items") - /** - * Returns the raw JSON value of [_meta]. - * - * Unlike [_meta], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("_meta") @ExcludeMissing fun __meta(): JsonField<_Meta> = _meta - /** * Returns the raw JSON value of [items]. * @@ -90,7 +75,6 @@ private constructor( * * The following fields are required: * ```java - * ._meta() * .items() * ``` */ @@ -100,27 +84,15 @@ private constructor( /** A builder for [TestListResponse]. */ class Builder internal constructor() { - private var _meta: JsonField<_Meta>? = null private var items: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(testListResponse: TestListResponse) = apply { - _meta = testListResponse._meta items = testListResponse.items.map { it.toMutableList() } additionalProperties = testListResponse.additionalProperties.toMutableMap() } - fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta)) - - /** - * Sets [Builder._meta] to an arbitrary JSON value. - * - * You should usually call [Builder._meta] with a well-typed [_Meta] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } - fun items(items: List) = items(JsonField.of(items)) /** @@ -170,7 +142,6 @@ private constructor( * * The following fields are required: * ```java - * ._meta() * .items() * ``` * @@ -178,7 +149,6 @@ private constructor( */ fun build(): TestListResponse = TestListResponse( - checkRequired("_meta", _meta), checkRequired("items", items).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) @@ -191,7 +161,6 @@ private constructor( return@apply } - _meta().validate() items().forEach { it.validate() } validated = true } @@ -211,280 +180,7 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (_meta.asKnown().getOrNull()?.validity() ?: 0) + - (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - class _Meta - private constructor( - private val page: JsonField, - private val perPage: JsonField, - private val totalItems: JsonField, - private val totalPages: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("page") @ExcludeMissing page: JsonField = JsonMissing.of(), - @JsonProperty("perPage") @ExcludeMissing perPage: JsonField = JsonMissing.of(), - @JsonProperty("totalItems") - @ExcludeMissing - totalItems: JsonField = JsonMissing.of(), - @JsonProperty("totalPages") - @ExcludeMissing - totalPages: JsonField = JsonMissing.of(), - ) : this(page, perPage, totalItems, totalPages, mutableMapOf()) - - /** - * The current page. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun page(): Long = page.getRequired("page") - - /** - * The number of items per page. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun perPage(): Long = perPage.getRequired("perPage") - - /** - * The total number of items. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun totalItems(): Long = totalItems.getRequired("totalItems") - - /** - * The total number of pages. - * - * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun totalPages(): Long = totalPages.getRequired("totalPages") - - /** - * Returns the raw JSON value of [page]. - * - * Unlike [page], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("page") @ExcludeMissing fun _page(): JsonField = page - - /** - * Returns the raw JSON value of [perPage]. - * - * Unlike [perPage], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("perPage") @ExcludeMissing fun _perPage(): JsonField = perPage - - /** - * Returns the raw JSON value of [totalItems]. - * - * Unlike [totalItems], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("totalItems") @ExcludeMissing fun _totalItems(): JsonField = totalItems - - /** - * Returns the raw JSON value of [totalPages]. - * - * Unlike [totalPages], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("totalPages") @ExcludeMissing fun _totalPages(): JsonField = totalPages - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [_Meta]. - * - * The following fields are required: - * ```java - * .page() - * .perPage() - * .totalItems() - * .totalPages() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [_Meta]. */ - class Builder internal constructor() { - - private var page: JsonField? = null - private var perPage: JsonField? = null - private var totalItems: JsonField? = null - private var totalPages: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(_meta: _Meta) = apply { - page = _meta.page - perPage = _meta.perPage - totalItems = _meta.totalItems - totalPages = _meta.totalPages - additionalProperties = _meta.additionalProperties.toMutableMap() - } - - /** The current page. */ - fun page(page: Long) = page(JsonField.of(page)) - - /** - * Sets [Builder.page] to an arbitrary JSON value. - * - * You should usually call [Builder.page] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun page(page: JsonField) = apply { this.page = page } - - /** The number of items per page. */ - fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) - - /** - * Sets [Builder.perPage] to an arbitrary JSON value. - * - * You should usually call [Builder.perPage] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun perPage(perPage: JsonField) = apply { this.perPage = perPage } - - /** The total number of items. */ - fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) - - /** - * Sets [Builder.totalItems] to an arbitrary JSON value. - * - * You should usually call [Builder.totalItems] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } - - /** The total number of pages. */ - fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) - - /** - * Sets [Builder.totalPages] to an arbitrary JSON value. - * - * You should usually call [Builder.totalPages] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [_Meta]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .page() - * .perPage() - * .totalItems() - * .totalPages() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): _Meta = - _Meta( - checkRequired("page", page), - checkRequired("perPage", perPage), - checkRequired("totalItems", totalItems), - checkRequired("totalPages", totalPages), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): _Meta = apply { - if (validated) { - return@apply - } - - page() - perPage() - totalItems() - totalPages() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OpenlayerInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (page.asKnown().isPresent) 1 else 0) + - (if (perPage.asKnown().isPresent) 1 else 0) + - (if (totalItems.asKnown().isPresent) 1 else 0) + - (if (totalPages.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is _Meta && page == other.page && perPage == other.perPage && totalItems == other.totalItems && totalPages == other.totalPages && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(page, perPage, totalItems, totalPages, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" - } + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) class Item private constructor( @@ -1887,7 +1583,7 @@ private constructor( class Threshold private constructor( - private val insightName: JsonField, + private val insightName: JsonField, private val insightParameters: JsonField>, private val measurement: JsonField, private val operator: JsonField, @@ -1900,7 +1596,7 @@ private constructor( private constructor( @JsonProperty("insightName") @ExcludeMissing - insightName: JsonField = JsonMissing.of(), + insightName: JsonField = JsonMissing.of(), @JsonProperty("insightParameters") @ExcludeMissing insightParameters: JsonField> = JsonMissing.of(), @@ -1930,10 +1626,12 @@ private constructor( * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun insightName(): Optional = insightName.getOptional("insightName") + fun insightName(): Optional = insightName.getOptional("insightName") /** - * The insight parameters. Required only for some test subtypes. + * The insight parameters. Required only for some test subtypes. For example, for tests + * that require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] * * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -1982,7 +1680,7 @@ private constructor( */ @JsonProperty("insightName") @ExcludeMissing - fun _insightName(): JsonField = insightName + fun _insightName(): JsonField = insightName /** * Returns the raw JSON value of [insightParameters]. @@ -2052,7 +1750,7 @@ private constructor( /** A builder for [Threshold]. */ class Builder internal constructor() { - private var insightName: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() private var insightParameters: JsonField>? = null private var measurement: JsonField = JsonMissing.of() private var operator: JsonField = JsonMissing.of() @@ -2072,20 +1770,24 @@ private constructor( } /** The insight name to be evaluated. */ - fun insightName(insightName: String) = insightName(JsonField.of(insightName)) + fun insightName(insightName: InsightName) = insightName(JsonField.of(insightName)) /** * Sets [Builder.insightName] to an arbitrary JSON value. * - * You should usually call [Builder.insightName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * You should usually call [Builder.insightName] with a well-typed [InsightName] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ - fun insightName(insightName: JsonField) = apply { + fun insightName(insightName: JsonField) = apply { this.insightName = insightName } - /** The insight parameters. Required only for some test subtypes. */ + /** + * The insight parameters. Required only for some test subtypes. For example, for + * tests that require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] + */ fun insightParameters(insightParameters: List?) = insightParameters(JsonField.ofNullable(insightParameters)) @@ -2231,7 +1933,7 @@ private constructor( return@apply } - insightName() + insightName().ifPresent { it.validate() } insightParameters().ifPresent { it.forEach { it.validate() } } measurement() operator().ifPresent { it.validate() } @@ -2256,7 +1958,7 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (insightName.asKnown().isPresent) 1 else 0) + + (insightName.asKnown().getOrNull()?.validity() ?: 0) + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (measurement.asKnown().isPresent) 1 else 0) + @@ -2264,6 +1966,332 @@ private constructor( (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) + /** The insight name to be evaluated. */ + class InsightName + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val CHARACTER_LENGTH = of("characterLength") + + @JvmField val CLASS_IMBALANCE = of("classImbalance") + + @JvmField + val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") + + @JvmField val COLUMN_AVERAGE = of("columnAverage") + + @JvmField val COLUMN_DRIFT = of("columnDrift") + + @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") + + @JvmField val CONFIDENCE_DISTRIBUTION = of("confidenceDistribution") + + @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") + + @JvmField val CONTAINS_PII = of("containsPii") + + @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") + + @JvmField val CORRELATED_FEATURES = of("correlatedFeatures") + + @JvmField val CUSTOM_METRIC = of("customMetric") + + @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") + + @JvmField val EMPTY_FEATURES = of("emptyFeatures") + + @JvmField val FEATURE_DRIFT = of("featureDrift") + + @JvmField val FEATURE_PROFILE = of("featureProfile") + + @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") + + @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") + + @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") + + @JvmField val IS_CODE = of("isCode") + + @JvmField val IS_JSON = of("isJson") + + @JvmField val LLM_RUBRIC_V2 = of("llmRubricV2") + + @JvmField val LABEL_DRIFT = of("labelDrift") + + @JvmField val METRICS = of("metrics") + + @JvmField val NEW_CATEGORIES = of("newCategories") + + @JvmField val NEW_LABELS = of("newLabels") + + @JvmField val NULL_ROW_COUNT = of("nullRowCount") + + @JvmField val PP_SCORE = of("ppScore") + + @JvmField val QUASI_CONSTANT_FEATURES = of("quasiConstantFeatures") + + @JvmField val SENTENCE_LENGTH = of("sentenceLength") + + @JvmField val SIZE_RATIO = of("sizeRatio") + + @JvmField val SPECIAL_CHARACTERS = of("specialCharacters") + + @JvmField val STRING_VALIDATION = of("stringValidation") + + @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") + + @JvmStatic fun of(value: String) = InsightName(JsonField.of(value)) + } + + /** An enum containing [InsightName]'s known values. */ + enum class Known { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + } + + /** + * An enum containing [InsightName]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [InsightName] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + /** + * An enum member indicating that [InsightName] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CHARACTER_LENGTH -> Value.CHARACTER_LENGTH + CLASS_IMBALANCE -> Value.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Value.COLUMN_AVERAGE + COLUMN_DRIFT -> Value.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Value.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Value.CONTAINS_PII + CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Value.CORRELATED_FEATURES + CUSTOM_METRIC -> Value.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Value.EMPTY_FEATURES + FEATURE_DRIFT -> Value.FEATURE_DRIFT + FEATURE_PROFILE -> Value.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT + IS_CODE -> Value.IS_CODE + IS_JSON -> Value.IS_JSON + LLM_RUBRIC_V2 -> Value.LLM_RUBRIC_V2 + LABEL_DRIFT -> Value.LABEL_DRIFT + METRICS -> Value.METRICS + NEW_CATEGORIES -> Value.NEW_CATEGORIES + NEW_LABELS -> Value.NEW_LABELS + NULL_ROW_COUNT -> Value.NULL_ROW_COUNT + PP_SCORE -> Value.PP_SCORE + QUASI_CONSTANT_FEATURES -> Value.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Value.SENTENCE_LENGTH + SIZE_RATIO -> Value.SIZE_RATIO + SPECIAL_CHARACTERS -> Value.SPECIAL_CHARACTERS + STRING_VALIDATION -> Value.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + CHARACTER_LENGTH -> Known.CHARACTER_LENGTH + CLASS_IMBALANCE -> Known.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Known.COLUMN_AVERAGE + COLUMN_DRIFT -> Known.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Known.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Known.CONTAINS_PII + CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Known.CORRELATED_FEATURES + CUSTOM_METRIC -> Known.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Known.EMPTY_FEATURES + FEATURE_DRIFT -> Known.FEATURE_DRIFT + FEATURE_PROFILE -> Known.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT + IS_CODE -> Known.IS_CODE + IS_JSON -> Known.IS_JSON + LLM_RUBRIC_V2 -> Known.LLM_RUBRIC_V2 + LABEL_DRIFT -> Known.LABEL_DRIFT + METRICS -> Known.METRICS + NEW_CATEGORIES -> Known.NEW_CATEGORIES + NEW_LABELS -> Known.NEW_LABELS + NULL_ROW_COUNT -> Known.NULL_ROW_COUNT + PP_SCORE -> Known.PP_SCORE + QUASI_CONSTANT_FEATURES -> Known.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Known.SENTENCE_LENGTH + SIZE_RATIO -> Known.SIZE_RATIO + SPECIAL_CHARACTERS -> Known.SPECIAL_CHARACTERS + STRING_VALIDATION -> Known.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> throw OpenlayerInvalidDataException("Unknown InsightName: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): InsightName = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InsightName && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + class InsightParameter private constructor( private val name: JsonField, @@ -3120,15 +3148,15 @@ private constructor( return true } - return /* spotless:off */ other is TestListResponse && _meta == other._meta && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TestListResponse && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(_meta, items, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(items, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TestListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + "TestListResponse{items=$items, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestUpdateParams.kt new file mode 100644 index 00000000..6ae3779c --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestUpdateParams.kt @@ -0,0 +1,2320 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.projects.tests + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.Params +import com.openlayer.api.core.allMaxBy +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.getOrThrow +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Update tests. */ +class TestUpdateParams +private constructor( + private val projectId: String, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun projectId(): String = projectId + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun payloads(): List = body.payloads() + + /** + * Returns the raw JSON value of [payloads]. + * + * Unlike [payloads], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _payloads(): JsonField> = body._payloads() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + fun _additionalHeaders(): Headers = additionalHeaders + + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [TestUpdateParams]. + * + * The following fields are required: + * ```java + * .projectId() + * .payloads() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TestUpdateParams]. */ + class Builder internal constructor() { + + private var projectId: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(testUpdateParams: TestUpdateParams) = apply { + projectId = testUpdateParams.projectId + body = testUpdateParams.body.toBuilder() + additionalHeaders = testUpdateParams.additionalHeaders.toBuilder() + additionalQueryParams = testUpdateParams.additionalQueryParams.toBuilder() + } + + fun projectId(projectId: String) = apply { this.projectId = projectId } + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [payloads] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun payloads(payloads: List) = apply { body.payloads(payloads) } + + /** + * Sets [Builder.payloads] to an arbitrary JSON value. + * + * You should usually call [Builder.payloads] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun payloads(payloads: JsonField>) = apply { body.payloads(payloads) } + + /** + * Adds a single [Payload] to [payloads]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addPayload(payload: Payload) = apply { body.addPayload(payload) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [TestUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .projectId() + * .payloads() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TestUpdateParams = + TestUpdateParams( + checkRequired("projectId", projectId), + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> projectId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + private constructor( + private val payloads: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("payloads") + @ExcludeMissing + payloads: JsonField> = JsonMissing.of() + ) : this(payloads, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun payloads(): List = payloads.getRequired("payloads") + + /** + * Returns the raw JSON value of [payloads]. + * + * Unlike [payloads], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("payloads") + @ExcludeMissing + fun _payloads(): JsonField> = payloads + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .payloads() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var payloads: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + payloads = body.payloads.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun payloads(payloads: List) = payloads(JsonField.of(payloads)) + + /** + * Sets [Builder.payloads] to an arbitrary JSON value. + * + * You should usually call [Builder.payloads] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun payloads(payloads: JsonField>) = apply { + this.payloads = payloads.map { it.toMutableList() } + } + + /** + * Adds a single [Payload] to [payloads]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addPayload(payload: Payload) = apply { + payloads = + (payloads ?: JsonField.of(mutableListOf())).also { + checkKnown("payloads", it).add(payload) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .payloads() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("payloads", payloads).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + payloads().forEach { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (payloads.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Body && payloads == other.payloads && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(payloads, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{payloads=$payloads, additionalProperties=$additionalProperties}" + } + + class Payload + private constructor( + private val id: JsonField, + private val archived: JsonField, + private val description: JsonValue, + private val name: JsonField, + private val suggested: JsonField, + private val thresholds: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("archived") + @ExcludeMissing + archived: JsonField = JsonMissing.of(), + @JsonProperty("description") @ExcludeMissing description: JsonValue = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("suggested") + @ExcludeMissing + suggested: JsonField = JsonMissing.of(), + @JsonProperty("thresholds") + @ExcludeMissing + thresholds: JsonField> = JsonMissing.of(), + ) : this(id, archived, description, name, suggested, thresholds, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * Whether the test is archived. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun archived(): Optional = archived.getOptional("archived") + + /** The test description. */ + @JsonProperty("description") @ExcludeMissing fun _description(): JsonValue = description + + /** + * The test name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun suggested(): Optional = suggested.getOptional("suggested") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun thresholds(): Optional> = thresholds.getOptional("thresholds") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [archived]. + * + * Unlike [archived], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("archived") @ExcludeMissing fun _archived(): JsonField = archived + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [suggested]. + * + * Unlike [suggested], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("suggested") + @ExcludeMissing + fun _suggested(): JsonField = suggested + + /** + * Returns the raw JSON value of [thresholds]. + * + * Unlike [thresholds], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("thresholds") + @ExcludeMissing + fun _thresholds(): JsonField> = thresholds + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Payload]. + * + * The following fields are required: + * ```java + * .id() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Payload]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var archived: JsonField = JsonMissing.of() + private var description: JsonValue = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var suggested: JsonField = JsonMissing.of() + private var thresholds: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(payload: Payload) = apply { + id = payload.id + archived = payload.archived + description = payload.description + name = payload.name + suggested = payload.suggested + thresholds = payload.thresholds.map { it.toMutableList() } + additionalProperties = payload.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** Whether the test is archived. */ + fun archived(archived: Boolean) = archived(JsonField.of(archived)) + + /** + * Sets [Builder.archived] to an arbitrary JSON value. + * + * You should usually call [Builder.archived] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun archived(archived: JsonField) = apply { this.archived = archived } + + /** The test description. */ + fun description(description: JsonValue) = apply { this.description = description } + + /** The test name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun suggested(suggested: Suggested) = suggested(JsonField.of(suggested)) + + /** + * Sets [Builder.suggested] to an arbitrary JSON value. + * + * You should usually call [Builder.suggested] with a well-typed [Suggested] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun suggested(suggested: JsonField) = apply { this.suggested = suggested } + + fun thresholds(thresholds: List) = thresholds(JsonField.of(thresholds)) + + /** + * Sets [Builder.thresholds] to an arbitrary JSON value. + * + * You should usually call [Builder.thresholds] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun thresholds(thresholds: JsonField>) = apply { + this.thresholds = thresholds.map { it.toMutableList() } + } + + /** + * Adds a single [Threshold] to [thresholds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addThreshold(threshold: Threshold) = apply { + thresholds = + (thresholds ?: JsonField.of(mutableListOf())).also { + checkKnown("thresholds", it).add(threshold) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Payload]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Payload = + Payload( + checkRequired("id", id), + archived, + description, + name, + suggested, + (thresholds ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Payload = apply { + if (validated) { + return@apply + } + + id() + archived() + name() + suggested().ifPresent { it.validate() } + thresholds().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (archived.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (suggested.asKnown().getOrNull()?.validity() ?: 0) + + (thresholds.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Suggested @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val FALSE = of(false) + + @JvmStatic fun of(value: Boolean) = Suggested(JsonField.of(value)) + } + + /** An enum containing [Suggested]'s known values. */ + enum class Known { + FALSE + } + + /** + * An enum containing [Suggested]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Suggested] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + FALSE, + /** + * An enum member indicating that [Suggested] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + FALSE -> Value.FALSE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + FALSE -> Known.FALSE + else -> throw OpenlayerInvalidDataException("Unknown Suggested: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asBoolean(): Boolean = + _value().asBoolean().orElseThrow { + OpenlayerInvalidDataException("Value is not a Boolean") + } + + private var validated: Boolean = false + + fun validate(): Suggested = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Suggested && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Threshold + private constructor( + private val insightName: JsonField, + private val insightParameters: JsonField>, + private val measurement: JsonField, + private val operator: JsonField, + private val thresholdMode: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("insightName") + @ExcludeMissing + insightName: JsonField = JsonMissing.of(), + @JsonProperty("insightParameters") + @ExcludeMissing + insightParameters: JsonField> = JsonMissing.of(), + @JsonProperty("measurement") + @ExcludeMissing + measurement: JsonField = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + operator: JsonField = JsonMissing.of(), + @JsonProperty("thresholdMode") + @ExcludeMissing + thresholdMode: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + ) : this( + insightName, + insightParameters, + measurement, + operator, + thresholdMode, + value, + mutableMapOf(), + ) + + /** + * The insight name to be evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun insightName(): Optional = insightName.getOptional("insightName") + + /** + * The insight parameters. Required only for some test subtypes. For example, for tests + * that require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun insightParameters(): Optional> = + insightParameters.getOptional("insightParameters") + + /** + * The measurement to be evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun measurement(): Optional = measurement.getOptional("measurement") + + /** + * The operator to be used for the evaluation. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun operator(): Optional = operator.getOptional("operator") + + /** + * Whether to use automatic anomaly detection or manual thresholds + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun thresholdMode(): Optional = + thresholdMode.getOptional("thresholdMode") + + /** + * The value to be compared. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun value(): Optional = value.getOptional("value") + + /** + * Returns the raw JSON value of [insightName]. + * + * Unlike [insightName], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("insightName") + @ExcludeMissing + fun _insightName(): JsonField = insightName + + /** + * Returns the raw JSON value of [insightParameters]. + * + * Unlike [insightParameters], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("insightParameters") + @ExcludeMissing + fun _insightParameters(): JsonField> = insightParameters + + /** + * Returns the raw JSON value of [measurement]. + * + * Unlike [measurement], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("measurement") + @ExcludeMissing + fun _measurement(): JsonField = measurement + + /** + * Returns the raw JSON value of [operator]. + * + * Unlike [operator], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("operator") + @ExcludeMissing + fun _operator(): JsonField = operator + + /** + * Returns the raw JSON value of [thresholdMode]. + * + * Unlike [thresholdMode], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("thresholdMode") + @ExcludeMissing + fun _thresholdMode(): JsonField = thresholdMode + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Threshold]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Threshold]. */ + class Builder internal constructor() { + + private var insightName: JsonField = JsonMissing.of() + private var insightParameters: JsonField>? = null + private var measurement: JsonField = JsonMissing.of() + private var operator: JsonField = JsonMissing.of() + private var thresholdMode: JsonField = JsonMissing.of() + private var value: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(threshold: Threshold) = apply { + insightName = threshold.insightName + insightParameters = threshold.insightParameters.map { it.toMutableList() } + measurement = threshold.measurement + operator = threshold.operator + thresholdMode = threshold.thresholdMode + value = threshold.value + additionalProperties = threshold.additionalProperties.toMutableMap() + } + + /** The insight name to be evaluated. */ + fun insightName(insightName: InsightName) = insightName(JsonField.of(insightName)) + + /** + * Sets [Builder.insightName] to an arbitrary JSON value. + * + * You should usually call [Builder.insightName] with a well-typed [InsightName] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun insightName(insightName: JsonField) = apply { + this.insightName = insightName + } + + /** + * The insight parameters. Required only for some test subtypes. For example, for + * tests that require a column name, the insight parameters will be + * [{'name': 'column_name', 'value': 'Age'}] + */ + fun insightParameters(insightParameters: List?) = + insightParameters(JsonField.ofNullable(insightParameters)) + + /** + * Alias for calling [Builder.insightParameters] with + * `insightParameters.orElse(null)`. + */ + fun insightParameters(insightParameters: Optional>) = + insightParameters(insightParameters.getOrNull()) + + /** + * Sets [Builder.insightParameters] to an arbitrary JSON value. + * + * You should usually call [Builder.insightParameters] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun insightParameters(insightParameters: JsonField>) = + apply { + this.insightParameters = insightParameters.map { it.toMutableList() } + } + + /** + * Adds a single [InsightParameter] to [insightParameters]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addInsightParameter(insightParameter: InsightParameter) = apply { + insightParameters = + (insightParameters ?: JsonField.of(mutableListOf())).also { + checkKnown("insightParameters", it).add(insightParameter) + } + } + + /** The measurement to be evaluated. */ + fun measurement(measurement: String) = measurement(JsonField.of(measurement)) + + /** + * Sets [Builder.measurement] to an arbitrary JSON value. + * + * You should usually call [Builder.measurement] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun measurement(measurement: JsonField) = apply { + this.measurement = measurement + } + + /** The operator to be used for the evaluation. */ + fun operator(operator: Operator) = operator(JsonField.of(operator)) + + /** + * Sets [Builder.operator] to an arbitrary JSON value. + * + * You should usually call [Builder.operator] with a well-typed [Operator] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun operator(operator: JsonField) = apply { this.operator = operator } + + /** Whether to use automatic anomaly detection or manual thresholds */ + fun thresholdMode(thresholdMode: ThresholdMode) = + thresholdMode(JsonField.of(thresholdMode)) + + /** + * Sets [Builder.thresholdMode] to an arbitrary JSON value. + * + * You should usually call [Builder.thresholdMode] with a well-typed [ThresholdMode] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun thresholdMode(thresholdMode: JsonField) = apply { + this.thresholdMode = thresholdMode + } + + /** The value to be compared. */ + fun value(value: Value) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [Value] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + /** Alias for calling [value] with `Value.ofNumber(number)`. */ + fun value(number: Double) = value(Value.ofNumber(number)) + + /** Alias for calling [value] with `Value.ofBool(bool)`. */ + fun value(bool: Boolean) = value(Value.ofBool(bool)) + + /** Alias for calling [value] with `Value.ofString(string)`. */ + fun value(string: String) = value(Value.ofString(string)) + + /** Alias for calling [value] with `Value.ofStrings(strings)`. */ + fun valueOfStrings(strings: List) = value(Value.ofStrings(strings)) + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Threshold]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Threshold = + Threshold( + insightName, + (insightParameters ?: JsonMissing.of()).map { it.toImmutable() }, + measurement, + operator, + thresholdMode, + value, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Threshold = apply { + if (validated) { + return@apply + } + + insightName().ifPresent { it.validate() } + insightParameters().ifPresent { it.forEach { it.validate() } } + measurement() + operator().ifPresent { it.validate() } + thresholdMode().ifPresent { it.validate() } + value().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (insightName.asKnown().getOrNull()?.validity() ?: 0) + + (insightParameters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } + ?: 0) + + (if (measurement.asKnown().isPresent) 1 else 0) + + (operator.asKnown().getOrNull()?.validity() ?: 0) + + (thresholdMode.asKnown().getOrNull()?.validity() ?: 0) + + (value.asKnown().getOrNull()?.validity() ?: 0) + + /** The insight name to be evaluated. */ + class InsightName + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val CHARACTER_LENGTH = of("characterLength") + + @JvmField val CLASS_IMBALANCE = of("classImbalance") + + @JvmField + val EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B = of("expectColumnAToBeInColumnB") + + @JvmField val COLUMN_AVERAGE = of("columnAverage") + + @JvmField val COLUMN_DRIFT = of("columnDrift") + + @JvmField val COLUMN_VALUES_MATCH = of("columnValuesMatch") + + @JvmField val CONFIDENCE_DISTRIBUTION = of("confidenceDistribution") + + @JvmField val CONFLICTING_LABEL_ROW_COUNT = of("conflictingLabelRowCount") + + @JvmField val CONTAINS_PII = of("containsPii") + + @JvmField val CONTAINS_VALID_URL = of("containsValidUrl") + + @JvmField val CORRELATED_FEATURES = of("correlatedFeatures") + + @JvmField val CUSTOM_METRIC = of("customMetric") + + @JvmField val DUPLICATE_ROW_COUNT = of("duplicateRowCount") + + @JvmField val EMPTY_FEATURES = of("emptyFeatures") + + @JvmField val FEATURE_DRIFT = of("featureDrift") + + @JvmField val FEATURE_PROFILE = of("featureProfile") + + @JvmField val GREAT_EXPECTATIONS = of("greatExpectations") + + @JvmField val GROUP_BY_COLUMN_STATS_CHECK = of("groupByColumnStatsCheck") + + @JvmField val ILL_FORMED_ROW_COUNT = of("illFormedRowCount") + + @JvmField val IS_CODE = of("isCode") + + @JvmField val IS_JSON = of("isJson") + + @JvmField val LLM_RUBRIC_V2 = of("llmRubricV2") + + @JvmField val LABEL_DRIFT = of("labelDrift") + + @JvmField val METRICS = of("metrics") + + @JvmField val NEW_CATEGORIES = of("newCategories") + + @JvmField val NEW_LABELS = of("newLabels") + + @JvmField val NULL_ROW_COUNT = of("nullRowCount") + + @JvmField val PP_SCORE = of("ppScore") + + @JvmField val QUASI_CONSTANT_FEATURES = of("quasiConstantFeatures") + + @JvmField val SENTENCE_LENGTH = of("sentenceLength") + + @JvmField val SIZE_RATIO = of("sizeRatio") + + @JvmField val SPECIAL_CHARACTERS = of("specialCharacters") + + @JvmField val STRING_VALIDATION = of("stringValidation") + + @JvmField val TRAIN_VAL_LEAKAGE_ROW_COUNT = of("trainValLeakageRowCount") + + @JvmStatic fun of(value: String) = InsightName(JsonField.of(value)) + } + + /** An enum containing [InsightName]'s known values. */ + enum class Known { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + } + + /** + * An enum containing [InsightName]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [InsightName] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CHARACTER_LENGTH, + CLASS_IMBALANCE, + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B, + COLUMN_AVERAGE, + COLUMN_DRIFT, + COLUMN_VALUES_MATCH, + CONFIDENCE_DISTRIBUTION, + CONFLICTING_LABEL_ROW_COUNT, + CONTAINS_PII, + CONTAINS_VALID_URL, + CORRELATED_FEATURES, + CUSTOM_METRIC, + DUPLICATE_ROW_COUNT, + EMPTY_FEATURES, + FEATURE_DRIFT, + FEATURE_PROFILE, + GREAT_EXPECTATIONS, + GROUP_BY_COLUMN_STATS_CHECK, + ILL_FORMED_ROW_COUNT, + IS_CODE, + IS_JSON, + LLM_RUBRIC_V2, + LABEL_DRIFT, + METRICS, + NEW_CATEGORIES, + NEW_LABELS, + NULL_ROW_COUNT, + PP_SCORE, + QUASI_CONSTANT_FEATURES, + SENTENCE_LENGTH, + SIZE_RATIO, + SPECIAL_CHARACTERS, + STRING_VALIDATION, + TRAIN_VAL_LEAKAGE_ROW_COUNT, + /** + * An enum member indicating that [InsightName] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CHARACTER_LENGTH -> Value.CHARACTER_LENGTH + CLASS_IMBALANCE -> Value.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Value.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Value.COLUMN_AVERAGE + COLUMN_DRIFT -> Value.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Value.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Value.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Value.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Value.CONTAINS_PII + CONTAINS_VALID_URL -> Value.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Value.CORRELATED_FEATURES + CUSTOM_METRIC -> Value.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Value.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Value.EMPTY_FEATURES + FEATURE_DRIFT -> Value.FEATURE_DRIFT + FEATURE_PROFILE -> Value.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Value.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Value.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Value.ILL_FORMED_ROW_COUNT + IS_CODE -> Value.IS_CODE + IS_JSON -> Value.IS_JSON + LLM_RUBRIC_V2 -> Value.LLM_RUBRIC_V2 + LABEL_DRIFT -> Value.LABEL_DRIFT + METRICS -> Value.METRICS + NEW_CATEGORIES -> Value.NEW_CATEGORIES + NEW_LABELS -> Value.NEW_LABELS + NULL_ROW_COUNT -> Value.NULL_ROW_COUNT + PP_SCORE -> Value.PP_SCORE + QUASI_CONSTANT_FEATURES -> Value.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Value.SENTENCE_LENGTH + SIZE_RATIO -> Value.SIZE_RATIO + SPECIAL_CHARACTERS -> Value.SPECIAL_CHARACTERS + STRING_VALIDATION -> Value.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Value.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + CHARACTER_LENGTH -> Known.CHARACTER_LENGTH + CLASS_IMBALANCE -> Known.CLASS_IMBALANCE + EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B -> Known.EXPECT_COLUMN_A_TO_BE_IN_COLUMN_B + COLUMN_AVERAGE -> Known.COLUMN_AVERAGE + COLUMN_DRIFT -> Known.COLUMN_DRIFT + COLUMN_VALUES_MATCH -> Known.COLUMN_VALUES_MATCH + CONFIDENCE_DISTRIBUTION -> Known.CONFIDENCE_DISTRIBUTION + CONFLICTING_LABEL_ROW_COUNT -> Known.CONFLICTING_LABEL_ROW_COUNT + CONTAINS_PII -> Known.CONTAINS_PII + CONTAINS_VALID_URL -> Known.CONTAINS_VALID_URL + CORRELATED_FEATURES -> Known.CORRELATED_FEATURES + CUSTOM_METRIC -> Known.CUSTOM_METRIC + DUPLICATE_ROW_COUNT -> Known.DUPLICATE_ROW_COUNT + EMPTY_FEATURES -> Known.EMPTY_FEATURES + FEATURE_DRIFT -> Known.FEATURE_DRIFT + FEATURE_PROFILE -> Known.FEATURE_PROFILE + GREAT_EXPECTATIONS -> Known.GREAT_EXPECTATIONS + GROUP_BY_COLUMN_STATS_CHECK -> Known.GROUP_BY_COLUMN_STATS_CHECK + ILL_FORMED_ROW_COUNT -> Known.ILL_FORMED_ROW_COUNT + IS_CODE -> Known.IS_CODE + IS_JSON -> Known.IS_JSON + LLM_RUBRIC_V2 -> Known.LLM_RUBRIC_V2 + LABEL_DRIFT -> Known.LABEL_DRIFT + METRICS -> Known.METRICS + NEW_CATEGORIES -> Known.NEW_CATEGORIES + NEW_LABELS -> Known.NEW_LABELS + NULL_ROW_COUNT -> Known.NULL_ROW_COUNT + PP_SCORE -> Known.PP_SCORE + QUASI_CONSTANT_FEATURES -> Known.QUASI_CONSTANT_FEATURES + SENTENCE_LENGTH -> Known.SENTENCE_LENGTH + SIZE_RATIO -> Known.SIZE_RATIO + SPECIAL_CHARACTERS -> Known.SPECIAL_CHARACTERS + STRING_VALIDATION -> Known.STRING_VALIDATION + TRAIN_VAL_LEAKAGE_ROW_COUNT -> Known.TRAIN_VAL_LEAKAGE_ROW_COUNT + else -> throw OpenlayerInvalidDataException("Unknown InsightName: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): InsightName = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InsightName && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class InsightParameter + private constructor( + private val name: JsonField, + private val value: JsonValue, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonValue = JsonMissing.of(), + ) : this(name, value, mutableMapOf()) + + /** + * The name of the insight filter. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun name(): String = name.getRequired("name") + + @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [InsightParameter]. + * + * The following fields are required: + * ```java + * .name() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InsightParameter]. */ + class Builder internal constructor() { + + private var name: JsonField? = null + private var value: JsonValue? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(insightParameter: InsightParameter) = apply { + name = insightParameter.name + value = insightParameter.value + additionalProperties = insightParameter.additionalProperties.toMutableMap() + } + + /** The name of the insight filter. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun value(value: JsonValue) = apply { this.value = value } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [InsightParameter]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .name() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): InsightParameter = + InsightParameter( + checkRequired("name", name), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): InsightParameter = apply { + if (validated) { + return@apply + } + + name() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (if (name.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InsightParameter && name == other.name && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(name, value, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InsightParameter{name=$name, value=$value, additionalProperties=$additionalProperties}" + } + + /** The operator to be used for the evaluation. */ + class Operator @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val IS = of("is") + + @JvmField val GREATER = of(">") + + @JvmField val GREATER_OR_EQUALS = of(">=") + + @JvmField val LESS = of("<") + + @JvmField val LESS_OR_EQUALS = of("<=") + + @JvmField val NOT_EQUALS = of("!=") + + @JvmStatic fun of(value: String) = Operator(JsonField.of(value)) + } + + /** An enum containing [Operator]'s known values. */ + enum class Known { + IS, + GREATER, + GREATER_OR_EQUALS, + LESS, + LESS_OR_EQUALS, + NOT_EQUALS, + } + + /** + * An enum containing [Operator]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Operator] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + IS, + GREATER, + GREATER_OR_EQUALS, + LESS, + LESS_OR_EQUALS, + NOT_EQUALS, + /** + * An enum member indicating that [Operator] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + IS -> Value.IS + GREATER -> Value.GREATER + GREATER_OR_EQUALS -> Value.GREATER_OR_EQUALS + LESS -> Value.LESS + LESS_OR_EQUALS -> Value.LESS_OR_EQUALS + NOT_EQUALS -> Value.NOT_EQUALS + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + IS -> Known.IS + GREATER -> Known.GREATER + GREATER_OR_EQUALS -> Known.GREATER_OR_EQUALS + LESS -> Known.LESS + LESS_OR_EQUALS -> Known.LESS_OR_EQUALS + NOT_EQUALS -> Known.NOT_EQUALS + else -> throw OpenlayerInvalidDataException("Unknown Operator: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Operator = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Operator && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Whether to use automatic anomaly detection or manual thresholds */ + class ThresholdMode + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val AUTOMATIC = of("automatic") + + @JvmField val MANUAL = of("manual") + + @JvmStatic fun of(value: String) = ThresholdMode(JsonField.of(value)) + } + + /** An enum containing [ThresholdMode]'s known values. */ + enum class Known { + AUTOMATIC, + MANUAL, + } + + /** + * An enum containing [ThresholdMode]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [ThresholdMode] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + AUTOMATIC, + MANUAL, + /** + * An enum member indicating that [ThresholdMode] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + AUTOMATIC -> Value.AUTOMATIC + MANUAL -> Value.MANUAL + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + AUTOMATIC -> Known.AUTOMATIC + MANUAL -> Known.MANUAL + else -> throw OpenlayerInvalidDataException("Unknown ThresholdMode: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): ThresholdMode = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ThresholdMode && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The value to be compared. */ + @JsonDeserialize(using = Value.Deserializer::class) + @JsonSerialize(using = Value.Serializer::class) + class Value + private constructor( + private val number: Double? = null, + private val bool: Boolean? = null, + private val string: String? = null, + private val strings: List? = null, + private val _json: JsonValue? = null, + ) { + + fun number(): Optional = Optional.ofNullable(number) + + fun bool(): Optional = Optional.ofNullable(bool) + + fun string(): Optional = Optional.ofNullable(string) + + fun strings(): Optional> = Optional.ofNullable(strings) + + fun isNumber(): Boolean = number != null + + fun isBool(): Boolean = bool != null + + fun isString(): Boolean = string != null + + fun isStrings(): Boolean = strings != null + + fun asNumber(): Double = number.getOrThrow("number") + + fun asBool(): Boolean = bool.getOrThrow("bool") + + fun asString(): String = string.getOrThrow("string") + + fun asStrings(): List = strings.getOrThrow("strings") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T = + when { + number != null -> visitor.visitNumber(number) + bool != null -> visitor.visitBool(bool) + string != null -> visitor.visitString(string) + strings != null -> visitor.visitStrings(strings) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + fun validate(): Value = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitNumber(number: Double) {} + + override fun visitBool(bool: Boolean) {} + + override fun visitString(string: String) {} + + override fun visitStrings(strings: List) {} + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitNumber(number: Double) = 1 + + override fun visitBool(bool: Boolean) = 1 + + override fun visitString(string: String) = 1 + + override fun visitStrings(strings: List) = strings.size + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Value && number == other.number && bool == other.bool && string == other.string && strings == other.strings /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(number, bool, string, strings) /* spotless:on */ + + override fun toString(): String = + when { + number != null -> "Value{number=$number}" + bool != null -> "Value{bool=$bool}" + string != null -> "Value{string=$string}" + strings != null -> "Value{strings=$strings}" + _json != null -> "Value{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Value") + } + + companion object { + + @JvmStatic fun ofNumber(number: Double) = Value(number = number) + + @JvmStatic fun ofBool(bool: Boolean) = Value(bool = bool) + + @JvmStatic fun ofString(string: String) = Value(string = string) + + @JvmStatic fun ofStrings(strings: List) = Value(strings = strings) + } + + /** + * An interface that defines how to map each variant of [Value] to a value of type + * [T]. + */ + interface Visitor { + + fun visitNumber(number: Double): T + + fun visitBool(bool: Boolean): T + + fun visitString(string: String): T + + fun visitStrings(strings: List): T + + /** + * Maps an unknown variant of [Value] to a value of type [T]. + * + * An instance of [Value] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on + * an older version than the API, then the API may respond with new variants + * that the SDK is unaware of. + * + * @throws OpenlayerInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw OpenlayerInvalidDataException("Unknown Value: $json") + } + } + + internal class Deserializer : BaseDeserializer(Value::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Value { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef())?.let { + Value(number = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Value(bool = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Value(string = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef>())?.let { + Value(strings = it, _json = json) + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely + // incompatible with all the possible variants (e.g. deserializing from + // object). + 0 -> Value(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then use + // the first completely valid match, or simply the first match if none + // are completely valid. + else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + } + } + } + + internal class Serializer : BaseSerializer(Value::class) { + + override fun serialize( + value: Value, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.number != null -> generator.writeObject(value.number) + value.bool != null -> generator.writeObject(value.bool) + value.string != null -> generator.writeObject(value.string) + value.strings != null -> generator.writeObject(value.strings) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Value") + } + } + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Threshold && insightName == other.insightName && insightParameters == other.insightParameters && measurement == other.measurement && operator == other.operator && thresholdMode == other.thresholdMode && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(insightName, insightParameters, measurement, operator, thresholdMode, value, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Threshold{insightName=$insightName, insightParameters=$insightParameters, measurement=$measurement, operator=$operator, thresholdMode=$thresholdMode, value=$value, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Payload && id == other.id && archived == other.archived && description == other.description && name == other.name && suggested == other.suggested && thresholds == other.thresholds && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, archived, description, name, suggested, thresholds, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Payload{id=$id, archived=$archived, description=$description, name=$name, suggested=$suggested, thresholds=$thresholds, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TestUpdateParams && projectId == other.projectId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(projectId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ + + override fun toString() = + "TestUpdateParams{projectId=$projectId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestUpdateResponse.kt new file mode 100644 index 00000000..6d083e16 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/tests/TestUpdateResponse.kt @@ -0,0 +1,197 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.projects.tests + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional + +class TestUpdateResponse +private constructor( + private val taskResultId: JsonField, + private val taskResultUrl: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("taskResultId") + @ExcludeMissing + taskResultId: JsonField = JsonMissing.of(), + @JsonProperty("taskResultUrl") + @ExcludeMissing + taskResultUrl: JsonField = JsonMissing.of(), + ) : this(taskResultId, taskResultUrl, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun taskResultId(): Optional = taskResultId.getOptional("taskResultId") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun taskResultUrl(): Optional = taskResultUrl.getOptional("taskResultUrl") + + /** + * Returns the raw JSON value of [taskResultId]. + * + * Unlike [taskResultId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("taskResultId") + @ExcludeMissing + fun _taskResultId(): JsonField = taskResultId + + /** + * Returns the raw JSON value of [taskResultUrl]. + * + * Unlike [taskResultUrl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("taskResultUrl") + @ExcludeMissing + fun _taskResultUrl(): JsonField = taskResultUrl + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [TestUpdateResponse]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TestUpdateResponse]. */ + class Builder internal constructor() { + + private var taskResultId: JsonField = JsonMissing.of() + private var taskResultUrl: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(testUpdateResponse: TestUpdateResponse) = apply { + taskResultId = testUpdateResponse.taskResultId + taskResultUrl = testUpdateResponse.taskResultUrl + additionalProperties = testUpdateResponse.additionalProperties.toMutableMap() + } + + fun taskResultId(taskResultId: String) = taskResultId(JsonField.of(taskResultId)) + + /** + * Sets [Builder.taskResultId] to an arbitrary JSON value. + * + * You should usually call [Builder.taskResultId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun taskResultId(taskResultId: JsonField) = apply { + this.taskResultId = taskResultId + } + + fun taskResultUrl(taskResultUrl: String) = taskResultUrl(JsonField.of(taskResultUrl)) + + /** + * Sets [Builder.taskResultUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.taskResultUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun taskResultUrl(taskResultUrl: JsonField) = apply { + this.taskResultUrl = taskResultUrl + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [TestUpdateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): TestUpdateResponse = + TestUpdateResponse(taskResultId, taskResultUrl, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): TestUpdateResponse = apply { + if (validated) { + return@apply + } + + taskResultId() + taskResultUrl() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (taskResultId.asKnown().isPresent) 1 else 0) + + (if (taskResultUrl.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TestUpdateResponse && taskResultId == other.taskResultId && taskResultUrl == other.taskResultUrl && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(taskResultId, taskResultUrl, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TestUpdateResponse{taskResultId=$taskResultId, taskResultUrl=$taskResultUrl, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsync.kt index 11ccd47b..b80be91c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsync.kt @@ -9,6 +9,8 @@ import com.openlayer.api.models.projects.tests.TestCreateParams import com.openlayer.api.models.projects.tests.TestCreateResponse import com.openlayer.api.models.projects.tests.TestListParams import com.openlayer.api.models.projects.tests.TestListResponse +import com.openlayer.api.models.projects.tests.TestUpdateParams +import com.openlayer.api.models.projects.tests.TestUpdateResponse import java.util.concurrent.CompletableFuture interface TestServiceAsync { @@ -28,6 +30,16 @@ interface TestServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** Update tests. */ + fun update(params: TestUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see [update] */ + fun update( + params: TestUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + /** List tests under a project. */ fun list(params: TestListParams): CompletableFuture = list(params, RequestOptions.none()) @@ -58,6 +70,23 @@ interface TestServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** + * Returns a raw HTTP response for `put /projects/{projectId}/tests`, but is otherwise the + * same as [TestServiceAsync.update]. + */ + @MustBeClosed + fun update( + params: TestUpdateParams + ): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + params: TestUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + /** * Returns a raw HTTP response for `get /projects/{projectId}/tests`, but is otherwise the * same as [TestServiceAsync.list]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncImpl.kt index a4bb054e..1877190f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncImpl.kt @@ -19,6 +19,8 @@ import com.openlayer.api.models.projects.tests.TestCreateParams import com.openlayer.api.models.projects.tests.TestCreateResponse import com.openlayer.api.models.projects.tests.TestListParams import com.openlayer.api.models.projects.tests.TestListResponse +import com.openlayer.api.models.projects.tests.TestUpdateParams +import com.openlayer.api.models.projects.tests.TestUpdateResponse import java.util.concurrent.CompletableFuture class TestServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -37,6 +39,13 @@ class TestServiceAsyncImpl internal constructor(private val clientOptions: Clien // post /projects/{projectId}/tests withRawResponse().create(params, requestOptions).thenApply { it.parse() } + override fun update( + params: TestUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // put /projects/{projectId}/tests + withRawResponse().update(params, requestOptions).thenApply { it.parse() } + override fun list( params: TestListParams, requestOptions: RequestOptions, @@ -79,6 +88,36 @@ class TestServiceAsyncImpl internal constructor(private val clientOptions: Clien } } + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun update( + params: TestUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("projects", params._pathParam(0), "tests") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestService.kt index 4c272d6b..fb1d9eed 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestService.kt @@ -9,6 +9,8 @@ import com.openlayer.api.models.projects.tests.TestCreateParams import com.openlayer.api.models.projects.tests.TestCreateResponse import com.openlayer.api.models.projects.tests.TestListParams import com.openlayer.api.models.projects.tests.TestListResponse +import com.openlayer.api.models.projects.tests.TestUpdateParams +import com.openlayer.api.models.projects.tests.TestUpdateResponse interface TestService { @@ -26,6 +28,15 @@ interface TestService { requestOptions: RequestOptions = RequestOptions.none(), ): TestCreateResponse + /** Update tests. */ + fun update(params: TestUpdateParams): TestUpdateResponse = update(params, RequestOptions.none()) + + /** @see [update] */ + fun update( + params: TestUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): TestUpdateResponse + /** List tests under a project. */ fun list(params: TestListParams): TestListResponse = list(params, RequestOptions.none()) @@ -53,6 +64,21 @@ interface TestService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** + * Returns a raw HTTP response for `put /projects/{projectId}/tests`, but is otherwise the + * same as [TestService.update]. + */ + @MustBeClosed + fun update(params: TestUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + params: TestUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + /** * Returns a raw HTTP response for `get /projects/{projectId}/tests`, but is otherwise the * same as [TestService.list]. diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestServiceImpl.kt index 685e51bd..aec8bd95 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/TestServiceImpl.kt @@ -19,6 +19,8 @@ import com.openlayer.api.models.projects.tests.TestCreateParams import com.openlayer.api.models.projects.tests.TestCreateResponse import com.openlayer.api.models.projects.tests.TestListParams import com.openlayer.api.models.projects.tests.TestListResponse +import com.openlayer.api.models.projects.tests.TestUpdateParams +import com.openlayer.api.models.projects.tests.TestUpdateResponse class TestServiceImpl internal constructor(private val clientOptions: ClientOptions) : TestService { @@ -35,6 +37,13 @@ class TestServiceImpl internal constructor(private val clientOptions: ClientOpti // post /projects/{projectId}/tests withRawResponse().create(params, requestOptions).parse() + override fun update( + params: TestUpdateParams, + requestOptions: RequestOptions, + ): TestUpdateResponse = + // put /projects/{projectId}/tests + withRawResponse().update(params, requestOptions).parse() + override fun list(params: TestListParams, requestOptions: RequestOptions): TestListResponse = // get /projects/{projectId}/tests withRawResponse().list(params, requestOptions).parse() @@ -71,6 +80,33 @@ class TestServiceImpl internal constructor(private val clientOptions: ClientOpti } } + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun update( + params: TestUpdateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("projects", params._pathParam(0), "tests") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt index f9ecbcb1..5045cc8f 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/commits/testresults/TestResultListResponseTest.kt @@ -48,7 +48,10 @@ internal class TestResultListResponseTest { .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") + .insightName( + TestResultListResponse.Item.Goal.Threshold.InsightName + .DUPLICATE_ROW_COUNT + ) .addInsightParameter( TestResultListResponse.Item.Goal.Threshold .InsightParameter @@ -117,7 +120,10 @@ internal class TestResultListResponseTest { .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") + .insightName( + TestResultListResponse.Item.Goal.Threshold.InsightName + .DUPLICATE_ROW_COUNT + ) .addInsightParameter( TestResultListResponse.Item.Goal.Threshold.InsightParameter .builder() @@ -191,7 +197,10 @@ internal class TestResultListResponseTest { .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") + .insightName( + TestResultListResponse.Item.Goal.Threshold.InsightName + .DUPLICATE_ROW_COUNT + ) .addInsightParameter( TestResultListResponse.Item.Goal.Threshold .InsightParameter diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt index 53cca3af..6051c9ef 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/inferencepipelines/testresults/TestResultListResponseTest.kt @@ -48,7 +48,10 @@ internal class TestResultListResponseTest { .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") + .insightName( + TestResultListResponse.Item.Goal.Threshold.InsightName + .DUPLICATE_ROW_COUNT + ) .addInsightParameter( TestResultListResponse.Item.Goal.Threshold .InsightParameter @@ -117,7 +120,10 @@ internal class TestResultListResponseTest { .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") + .insightName( + TestResultListResponse.Item.Goal.Threshold.InsightName + .DUPLICATE_ROW_COUNT + ) .addInsightParameter( TestResultListResponse.Item.Goal.Threshold.InsightParameter .builder() @@ -191,7 +197,10 @@ internal class TestResultListResponseTest { .suggested(false) .addThreshold( TestResultListResponse.Item.Goal.Threshold.builder() - .insightName("duplicateRowCount") + .insightName( + TestResultListResponse.Item.Goal.Threshold.InsightName + .DUPLICATE_ROW_COUNT + ) .addInsightParameter( TestResultListResponse.Item.Goal.Threshold .InsightParameter diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt index e113b43c..53507331 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateParamsTest.kt @@ -27,7 +27,7 @@ internal class TestCreateParamsTest { .suggested(false) .addThreshold( TestCreateParams.Threshold.builder() - .insightName("duplicateRowCount") + .insightName(TestCreateParams.Threshold.InsightName.DUPLICATE_ROW_COUNT) .addInsightParameter( TestCreateParams.Threshold.InsightParameter.builder() .name("column_name") @@ -97,7 +97,7 @@ internal class TestCreateParamsTest { .suggested(false) .addThreshold( TestCreateParams.Threshold.builder() - .insightName("duplicateRowCount") + .insightName(TestCreateParams.Threshold.InsightName.DUPLICATE_ROW_COUNT) .addInsightParameter( TestCreateParams.Threshold.InsightParameter.builder() .name("column_name") @@ -139,7 +139,7 @@ internal class TestCreateParamsTest { assertThat(body.thresholds()) .containsExactly( TestCreateParams.Threshold.builder() - .insightName("duplicateRowCount") + .insightName(TestCreateParams.Threshold.InsightName.DUPLICATE_ROW_COUNT) .addInsightParameter( TestCreateParams.Threshold.InsightParameter.builder() .name("column_name") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt index f4e284f2..81df5c07 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestCreateResponseTest.kt @@ -29,7 +29,7 @@ internal class TestCreateResponseTest { .suggested(false) .addThreshold( TestCreateResponse.Threshold.builder() - .insightName("duplicateRowCount") + .insightName(TestCreateResponse.Threshold.InsightName.DUPLICATE_ROW_COUNT) .addInsightParameter( TestCreateResponse.Threshold.InsightParameter.builder() .name("column_name") @@ -74,7 +74,7 @@ internal class TestCreateResponseTest { assertThat(testCreateResponse.thresholds()) .containsExactly( TestCreateResponse.Threshold.builder() - .insightName("duplicateRowCount") + .insightName(TestCreateResponse.Threshold.InsightName.DUPLICATE_ROW_COUNT) .addInsightParameter( TestCreateResponse.Threshold.InsightParameter.builder() .name("column_name") @@ -117,7 +117,7 @@ internal class TestCreateResponseTest { .suggested(false) .addThreshold( TestCreateResponse.Threshold.builder() - .insightName("duplicateRowCount") + .insightName(TestCreateResponse.Threshold.InsightName.DUPLICATE_ROW_COUNT) .addInsightParameter( TestCreateResponse.Threshold.InsightParameter.builder() .name("column_name") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt index 915e8704..1f32f4a2 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestListResponseTest.kt @@ -15,15 +15,6 @@ internal class TestListResponseTest { fun create() { val testListResponse = TestListResponse.builder() - ._meta( - TestListResponse._Meta - .builder() - .page(1L) - .perPage(1L) - .totalItems(0L) - .totalPages(0L) - .build() - ) .addItem( TestListResponse.Item.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -42,7 +33,9 @@ internal class TestListResponseTest { .suggested(false) .addThreshold( TestListResponse.Item.Threshold.builder() - .insightName("duplicateRowCount") + .insightName( + TestListResponse.Item.Threshold.InsightName.DUPLICATE_ROW_COUNT + ) .addInsightParameter( TestListResponse.Item.Threshold.InsightParameter.builder() .name("column_name") @@ -70,16 +63,6 @@ internal class TestListResponseTest { ) .build() - assertThat(testListResponse._meta()) - .isEqualTo( - TestListResponse._Meta - .builder() - .page(1L) - .perPage(1L) - .totalItems(0L) - .totalPages(0L) - .build() - ) assertThat(testListResponse.items()) .containsExactly( TestListResponse.Item.builder() @@ -99,7 +82,9 @@ internal class TestListResponseTest { .suggested(false) .addThreshold( TestListResponse.Item.Threshold.builder() - .insightName("duplicateRowCount") + .insightName( + TestListResponse.Item.Threshold.InsightName.DUPLICATE_ROW_COUNT + ) .addInsightParameter( TestListResponse.Item.Threshold.InsightParameter.builder() .name("column_name") @@ -130,15 +115,6 @@ internal class TestListResponseTest { val jsonMapper = jsonMapper() val testListResponse = TestListResponse.builder() - ._meta( - TestListResponse._Meta - .builder() - .page(1L) - .perPage(1L) - .totalItems(0L) - .totalPages(0L) - .build() - ) .addItem( TestListResponse.Item.builder() .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") @@ -157,7 +133,9 @@ internal class TestListResponseTest { .suggested(false) .addThreshold( TestListResponse.Item.Threshold.builder() - .insightName("duplicateRowCount") + .insightName( + TestListResponse.Item.Threshold.InsightName.DUPLICATE_ROW_COUNT + ) .addInsightParameter( TestListResponse.Item.Threshold.InsightParameter.builder() .name("column_name") diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestUpdateParamsTest.kt new file mode 100644 index 00000000..939a22c3 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestUpdateParamsTest.kt @@ -0,0 +1,161 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.projects.tests + +import com.openlayer.api.core.JsonValue +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class TestUpdateParamsTest { + + @Test + fun create() { + TestUpdateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addPayload( + TestUpdateParams.Payload.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .archived(false) + .description( + JsonValue.from("This test checks for duplicate rows in the dataset.") + ) + .name("No duplicate rows") + .suggested(TestUpdateParams.Payload.Suggested.FALSE) + .addThreshold( + TestUpdateParams.Payload.Threshold.builder() + .insightName( + TestUpdateParams.Payload.Threshold.InsightName.DUPLICATE_ROW_COUNT + ) + .addInsightParameter( + TestUpdateParams.Payload.Threshold.InsightParameter.builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) + .measurement("duplicateRowCount") + .operator(TestUpdateParams.Payload.Threshold.Operator.LESS_OR_EQUALS) + .thresholdMode( + TestUpdateParams.Payload.Threshold.ThresholdMode.AUTOMATIC + ) + .value(0.0) + .build() + ) + .build() + ) + .build() + } + + @Test + fun pathParams() { + val params = + TestUpdateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addPayload( + TestUpdateParams.Payload.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun body() { + val params = + TestUpdateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addPayload( + TestUpdateParams.Payload.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .archived(false) + .description( + JsonValue.from("This test checks for duplicate rows in the dataset.") + ) + .name("No duplicate rows") + .suggested(TestUpdateParams.Payload.Suggested.FALSE) + .addThreshold( + TestUpdateParams.Payload.Threshold.builder() + .insightName( + TestUpdateParams.Payload.Threshold.InsightName + .DUPLICATE_ROW_COUNT + ) + .addInsightParameter( + TestUpdateParams.Payload.Threshold.InsightParameter.builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) + .measurement("duplicateRowCount") + .operator( + TestUpdateParams.Payload.Threshold.Operator.LESS_OR_EQUALS + ) + .thresholdMode( + TestUpdateParams.Payload.Threshold.ThresholdMode.AUTOMATIC + ) + .value(0.0) + .build() + ) + .build() + ) + .build() + + val body = params._body() + + assertThat(body.payloads()) + .containsExactly( + TestUpdateParams.Payload.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .archived(false) + .description( + JsonValue.from("This test checks for duplicate rows in the dataset.") + ) + .name("No duplicate rows") + .suggested(TestUpdateParams.Payload.Suggested.FALSE) + .addThreshold( + TestUpdateParams.Payload.Threshold.builder() + .insightName( + TestUpdateParams.Payload.Threshold.InsightName.DUPLICATE_ROW_COUNT + ) + .addInsightParameter( + TestUpdateParams.Payload.Threshold.InsightParameter.builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) + .measurement("duplicateRowCount") + .operator(TestUpdateParams.Payload.Threshold.Operator.LESS_OR_EQUALS) + .thresholdMode( + TestUpdateParams.Payload.Threshold.ThresholdMode.AUTOMATIC + ) + .value(0.0) + .build() + ) + .build() + ) + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + TestUpdateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addPayload( + TestUpdateParams.Payload.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + .build() + + val body = params._body() + + assertThat(body.payloads()) + .containsExactly( + TestUpdateParams.Payload.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestUpdateResponseTest.kt new file mode 100644 index 00000000..030a1e02 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/projects/tests/TestUpdateResponseTest.kt @@ -0,0 +1,41 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.projects.tests + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class TestUpdateResponseTest { + + @Test + fun create() { + val testUpdateResponse = + TestUpdateResponse.builder() + .taskResultId("taskResultId") + .taskResultUrl("taskResultUrl") + .build() + + assertThat(testUpdateResponse.taskResultId()).contains("taskResultId") + assertThat(testUpdateResponse.taskResultUrl()).contains("taskResultUrl") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val testUpdateResponse = + TestUpdateResponse.builder() + .taskResultId("taskResultId") + .taskResultUrl("taskResultUrl") + .build() + + val roundtrippedTestUpdateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(testUpdateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedTestUpdateResponse).isEqualTo(testUpdateResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt index cc01be9e..831e71dd 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/projects/TestServiceAsyncTest.kt @@ -7,6 +7,7 @@ import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync import com.openlayer.api.core.JsonValue import com.openlayer.api.models.projects.tests.TestCreateParams import com.openlayer.api.models.projects.tests.TestListParams +import com.openlayer.api.models.projects.tests.TestUpdateParams import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -43,7 +44,7 @@ internal class TestServiceAsyncTest { .suggested(false) .addThreshold( TestCreateParams.Threshold.builder() - .insightName("duplicateRowCount") + .insightName(TestCreateParams.Threshold.InsightName.DUPLICATE_ROW_COUNT) .addInsightParameter( TestCreateParams.Threshold.InsightParameter.builder() .name("column_name") @@ -72,6 +73,62 @@ internal class TestServiceAsyncTest { test.validate() } + @Test + fun update() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val testServiceAsync = client.projects().tests() + + val testFuture = + testServiceAsync.update( + TestUpdateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addPayload( + TestUpdateParams.Payload.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .archived(false) + .description( + JsonValue.from( + "This test checks for duplicate rows in the dataset." + ) + ) + .name("No duplicate rows") + .suggested(TestUpdateParams.Payload.Suggested.FALSE) + .addThreshold( + TestUpdateParams.Payload.Threshold.builder() + .insightName( + TestUpdateParams.Payload.Threshold.InsightName + .DUPLICATE_ROW_COUNT + ) + .addInsightParameter( + TestUpdateParams.Payload.Threshold.InsightParameter + .builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) + .measurement("duplicateRowCount") + .operator( + TestUpdateParams.Payload.Threshold.Operator.LESS_OR_EQUALS + ) + .thresholdMode( + TestUpdateParams.Payload.Threshold.ThresholdMode.AUTOMATIC + ) + .value(0.0) + .build() + ) + .build() + ) + .build() + ) + + val test = testFuture.get() + test.validate() + } + @Test fun list() { val client = diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt index ec3b3e75..374f7e9c 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/TestServiceTest.kt @@ -7,6 +7,7 @@ import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.core.JsonValue import com.openlayer.api.models.projects.tests.TestCreateParams import com.openlayer.api.models.projects.tests.TestListParams +import com.openlayer.api.models.projects.tests.TestUpdateParams import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -43,7 +44,7 @@ internal class TestServiceTest { .suggested(false) .addThreshold( TestCreateParams.Threshold.builder() - .insightName("duplicateRowCount") + .insightName(TestCreateParams.Threshold.InsightName.DUPLICATE_ROW_COUNT) .addInsightParameter( TestCreateParams.Threshold.InsightParameter.builder() .name("column_name") @@ -71,6 +72,61 @@ internal class TestServiceTest { test.validate() } + @Test + fun update() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val testService = client.projects().tests() + + val test = + testService.update( + TestUpdateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addPayload( + TestUpdateParams.Payload.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .archived(false) + .description( + JsonValue.from( + "This test checks for duplicate rows in the dataset." + ) + ) + .name("No duplicate rows") + .suggested(TestUpdateParams.Payload.Suggested.FALSE) + .addThreshold( + TestUpdateParams.Payload.Threshold.builder() + .insightName( + TestUpdateParams.Payload.Threshold.InsightName + .DUPLICATE_ROW_COUNT + ) + .addInsightParameter( + TestUpdateParams.Payload.Threshold.InsightParameter + .builder() + .name("column_name") + .value(JsonValue.from("Age")) + .build() + ) + .measurement("duplicateRowCount") + .operator( + TestUpdateParams.Payload.Threshold.Operator.LESS_OR_EQUALS + ) + .thresholdMode( + TestUpdateParams.Payload.Threshold.ThresholdMode.AUTOMATIC + ) + .value(0.0) + .build() + ) + .build() + ) + .build() + ) + + test.validate() + } + @Test fun list() { val client = From f3cbb18190ca478c5136a85224814edb0f9f19ef Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 11:34:05 +0000 Subject: [PATCH 73/74] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 09980137..2b09528b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 18 -openapi_spec_hash: 4f09f95fd31c148d1be80b7e643346ce +openapi_spec_hash: 20f058101a252f7500803d66aff58eb3 config_hash: 30422a4611d93ca69e4f1aff60b9ddb5 From 9c2a494fca2a2c69e6947c94414a315b8ca47b3d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 11:34:37 +0000 Subject: [PATCH 74/74] release: 0.1.0-alpha.12 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 111 ++++++++++++++++++++++++++++++++++ README.md | 10 +-- build.gradle.kts | 2 +- 4 files changed, 118 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ee49ac2d..fd0ccba9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.11" + ".": "0.1.0-alpha.12" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ab2c9931..7e075c52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,116 @@ # Changelog +## 0.1.0-alpha.12 (2025-04-25) + +Full Changelog: [v0.1.0-alpha.11...v0.1.0-alpha.12](https://github.com/openlayer-ai/openlayer-java/compare/v0.1.0-alpha.11...v0.1.0-alpha.12) + +### ⚠ BREAKING CHANGES + +* **client:** refactor exception structure and methods ([#93](https://github.com/openlayer-ai/openlayer-java/issues/93)) +* **client:** **Migration:** Previously you would access error JSON on an exception via `exception.error()._additionalProperties()`, which would return `Map`. Now you would access this via `exception.body()`, which returns `JsonValue`. You should no longer assume that the returned error JSON is an object. You can check via `exception.body().asObject()`. +* **client:** move classes into subpackages and shorten names ([#80](https://github.com/openlayer-ai/openlayer-java/issues/80)) + +### Features + +* **api:** add endpoint to retrieve commit by id ([#77](https://github.com/openlayer-ai/openlayer-java/issues/77)) ([5087297](https://github.com/openlayer-ai/openlayer-java/commit/50872978eab416d1395b8619b965e7135d2aef65)) +* **api:** add test creation endpoint ([0282634](https://github.com/openlayer-ai/openlayer-java/commit/02826344cb144623d177771d5cc066490cbe9bb5)) +* **api:** api update ([ded01c5](https://github.com/openlayer-ai/openlayer-java/commit/ded01c545f44e1372efeffd478fc02612172fdd6)) +* **api:** api update ([afb521e](https://github.com/openlayer-ai/openlayer-java/commit/afb521e47092ec517327a7398a4a1f768f411e41)) +* **api:** api update ([76afcb9](https://github.com/openlayer-ai/openlayer-java/commit/76afcb9b2d3f5ab89cd420cbdb084ab400ce5622)) +* **api:** api update ([420f95c](https://github.com/openlayer-ai/openlayer-java/commit/420f95c52275d20441bce4bca05420b4dfd9e4ad)) +* **api:** api update ([a18a3b0](https://github.com/openlayer-ai/openlayer-java/commit/a18a3b06d20f8c2d8414d0b1ce116d8bd5dad387)) +* **api:** api update ([cedc29f](https://github.com/openlayer-ai/openlayer-java/commit/cedc29f79a787b41f0474355d38e2ef94c044123)) +* **api:** expose test retrieval endpoint ([8fdd96d](https://github.com/openlayer-ai/openlayer-java/commit/8fdd96d6b76ffdbf24914b50cf5d57197bbcd1ab)) +* **api:** expose test retrieval endpoint ([6a5c141](https://github.com/openlayer-ai/openlayer-java/commit/6a5c14163b155b89cc3225c28ae37d5d4d594bff)) +* **api:** expose test update endpoint ([7ae882e](https://github.com/openlayer-ai/openlayer-java/commit/7ae882e19aca6c298a0184d135a4365b5148f3ce)) +* **client:** add `close` method ([207ba78](https://github.com/openlayer-ai/openlayer-java/commit/207ba785d6409b4a6b5ede70f3944313cd625b6c)) +* **client:** add enum validation method ([0c69b0d](https://github.com/openlayer-ai/openlayer-java/commit/0c69b0d67f818d7511495b196978e1d9a6f6de7d)) +* **client:** expose request body setter and getter ([#106](https://github.com/openlayer-ai/openlayer-java/issues/106)) ([8725baa](https://github.com/openlayer-ai/openlayer-java/commit/8725baa3ddd8d7fe53c607cd9d2e7f14373b37df)) +* **client:** make datetime deserialization more lenient ([#105](https://github.com/openlayer-ai/openlayer-java/issues/105)) ([ac0fa47](https://github.com/openlayer-ai/openlayer-java/commit/ac0fa470239a5ad32e3d372354f63da231a98480)) +* **client:** make union deserialization more robust ([#104](https://github.com/openlayer-ai/openlayer-java/issues/104)) ([0c69b0d](https://github.com/openlayer-ai/openlayer-java/commit/0c69b0d67f818d7511495b196978e1d9a6f6de7d)) +* **client:** support a lower jackson version ([#99](https://github.com/openlayer-ai/openlayer-java/issues/99)) ([86e9363](https://github.com/openlayer-ai/openlayer-java/commit/86e936338872071e1dcc80f0549adcb21f8aa205)) +* **client:** support setting base URL via env var ([08e6ac1](https://github.com/openlayer-ai/openlayer-java/commit/08e6ac1c7327d8c832035b29242b10c8678f2543)) +* **client:** throw on incompatible jackson version ([86e9363](https://github.com/openlayer-ai/openlayer-java/commit/86e936338872071e1dcc80f0549adcb21f8aa205)) + + +### Bug Fixes + +* **client:** bump to better jackson version ([fc11f45](https://github.com/openlayer-ai/openlayer-java/commit/fc11f45df797c93281e670e35ecd00c6530d0af4)) +* **client:** don't call `validate()` during deserialization if we don't have to ([#101](https://github.com/openlayer-ai/openlayer-java/issues/101)) ([5ce9c06](https://github.com/openlayer-ai/openlayer-java/commit/5ce9c0686bbf66a4f0e3e2acad3356664671d287)) +* **client:** limit json deserialization coercion ([#102](https://github.com/openlayer-ai/openlayer-java/issues/102)) ([15fddc3](https://github.com/openlayer-ai/openlayer-java/commit/15fddc34beea081f9afb69dc87302b65c1e82340)) +* **client:** make some classes and constructors non-public ([882eb61](https://github.com/openlayer-ai/openlayer-java/commit/882eb61286bb52c15224a36677a934523ccb4fb3)) +* **client:** map deserialization bug ([17fc1d7](https://github.com/openlayer-ai/openlayer-java/commit/17fc1d796ea7b17d34c0b14374fff3420a14397e)) +* **client:** return `Optional<T>` instead of `Optional` ([#109](https://github.com/openlayer-ai/openlayer-java/issues/109)) ([c2c1501](https://github.com/openlayer-ai/openlayer-java/commit/c2c150161ea17067c68e3ce7c54deebdf2461c4a)) +* **client:** support kotlin 1.8 runtime ([#90](https://github.com/openlayer-ai/openlayer-java/issues/90)) ([f2b112b](https://github.com/openlayer-ai/openlayer-java/commit/f2b112b2f218ba39307aad1ed17c0d6114142d3a)) +* pluralize `list` response variables ([#103](https://github.com/openlayer-ai/openlayer-java/issues/103)) ([c1cde72](https://github.com/openlayer-ai/openlayer-java/commit/c1cde726f563abe38a5188647c6f05df01d034e8)) + + +### Performance Improvements + +* **client:** cached parsed type in `HttpResponseFor` ([#107](https://github.com/openlayer-ai/openlayer-java/issues/107)) ([3bd7a4c](https://github.com/openlayer-ai/openlayer-java/commit/3bd7a4cc174f22a5e2ef4510ee1576563ad608c2)) +* **internal:** improve compilation+test speed ([e2aafa7](https://github.com/openlayer-ai/openlayer-java/commit/e2aafa770f685aed27c842b1c7c6e61258d967b3)) + + +### Chores + +* **ci:** add timeout thresholds for CI jobs ([cdf2938](https://github.com/openlayer-ai/openlayer-java/commit/cdf29389f0d198ea0dca008e0f235bfbeec1327b)) +* **ci:** only use depot for staging repos ([2cb59ec](https://github.com/openlayer-ai/openlayer-java/commit/2cb59ec3924c68c6d7faa97fbbbccd6d3489f3fd)) +* **client:** move classes into subpackages and shorten names ([#80](https://github.com/openlayer-ai/openlayer-java/issues/80)) ([6e35cbf](https://github.com/openlayer-ai/openlayer-java/commit/6e35cbf67eab70e90be376b4835a9b000f265cf9)) +* **client:** refactor exception structure and methods ([#93](https://github.com/openlayer-ai/openlayer-java/issues/93)) ([d1ee889](https://github.com/openlayer-ai/openlayer-java/commit/d1ee889f1b5a4b8e97fff690f0c4db997441278f)) +* **client:** remove unnecessary json state from some query param classes ([0c69b0d](https://github.com/openlayer-ai/openlayer-java/commit/0c69b0d67f818d7511495b196978e1d9a6f6de7d)) +* **internal:** add invalid json deserialization tests ([0c69b0d](https://github.com/openlayer-ai/openlayer-java/commit/0c69b0d67f818d7511495b196978e1d9a6f6de7d)) +* **internal:** add json roundtripping tests ([0c69b0d](https://github.com/openlayer-ai/openlayer-java/commit/0c69b0d67f818d7511495b196978e1d9a6f6de7d)) +* **internal:** add missing release please block ([#92](https://github.com/openlayer-ai/openlayer-java/issues/92)) ([722165b](https://github.com/openlayer-ai/openlayer-java/commit/722165bcfa13936fc3ed70592833293495f1ed20)) +* **internal:** codegen related update ([caff21a](https://github.com/openlayer-ai/openlayer-java/commit/caff21a6eabf0cc2386ebb707023a0bcbac0fd35)) +* **internal:** codegen related update ([c23eea2](https://github.com/openlayer-ai/openlayer-java/commit/c23eea21cd8a3895c7ed616998516df64ac1b9dd)) +* **internal:** codegen related update ([2885a5a](https://github.com/openlayer-ai/openlayer-java/commit/2885a5a402fa4cea4e5363a5dbec1bd255a9060b)) +* **internal:** codegen related update ([a62fb1f](https://github.com/openlayer-ai/openlayer-java/commit/a62fb1f2042721f6ce4eb84ff33bfd9704829266)) +* **internal:** codegen related update ([ca04676](https://github.com/openlayer-ai/openlayer-java/commit/ca0467688568fe952dc57739c6306209f68761f8)) +* **internal:** codegen related update ([#79](https://github.com/openlayer-ai/openlayer-java/issues/79)) ([3ee21d4](https://github.com/openlayer-ai/openlayer-java/commit/3ee21d4a05dddebac33326fd9c0cbde11bf39062)) +* **internal:** codegen related update ([#85](https://github.com/openlayer-ai/openlayer-java/issues/85)) ([3d4d199](https://github.com/openlayer-ai/openlayer-java/commit/3d4d19974440297e5b1f4fdd220ae2c29adfad00)) +* **internal:** delete duplicate tests ([ece3d6d](https://github.com/openlayer-ai/openlayer-java/commit/ece3d6d3f438671e2b4fab916f9295c668d2f137)) +* **internal:** delete unused methods and annotations ([#100](https://github.com/openlayer-ai/openlayer-java/issues/100)) ([17fc1d7](https://github.com/openlayer-ai/openlayer-java/commit/17fc1d796ea7b17d34c0b14374fff3420a14397e)) +* **internal:** expand CI branch coverage ([273f4a7](https://github.com/openlayer-ai/openlayer-java/commit/273f4a712c63235e663b5e2ddba53797f2cf441c)) +* **internal:** fix example formatting ([#95](https://github.com/openlayer-ai/openlayer-java/issues/95)) ([5c782e5](https://github.com/openlayer-ai/openlayer-java/commit/5c782e5d75daafb3eea58bbe5c834a3cf3444783)) +* **internal:** generate more tests ([db068dc](https://github.com/openlayer-ai/openlayer-java/commit/db068dc6e79b6a3fa77fe7b22a9a7bf31b61b8d9)) +* **internal:** java 17 -> 21 on ci ([7bcb837](https://github.com/openlayer-ai/openlayer-java/commit/7bcb837a326dc585fae7b88c8f104243d936b20a)) +* **internal:** make multipart assertions more robust ([ac5dc3b](https://github.com/openlayer-ai/openlayer-java/commit/ac5dc3bb775247428b484019d4f5a936877dac0e)) +* **internal:** reduce CI branch coverage ([3169980](https://github.com/openlayer-ai/openlayer-java/commit/3169980b67081c80cadb5af4869982a2a3eadedd)) +* **internal:** refactor `ErrorHandlingTest` ([2fca9f1](https://github.com/openlayer-ai/openlayer-java/commit/2fca9f1dbdc492be75166cc9727660dffd325ce8)) +* **internal:** refactor enum query param serialization ([#91](https://github.com/openlayer-ai/openlayer-java/issues/91)) ([b928602](https://github.com/openlayer-ai/openlayer-java/commit/b92860288151baab73f6ad26ffbd0976a3f54aab)) +* **internal:** refactor query param serialization impl and tests ([#87](https://github.com/openlayer-ai/openlayer-java/issues/87)) ([301bc32](https://github.com/openlayer-ai/openlayer-java/commit/301bc32db49ad7d0b417b98996f11ed445c2501c)) +* **internal:** refactor some test assertions ([ece3d6d](https://github.com/openlayer-ai/openlayer-java/commit/ece3d6d3f438671e2b4fab916f9295c668d2f137)) +* **internal:** reformat some tests ([#89](https://github.com/openlayer-ai/openlayer-java/issues/89)) ([db068dc](https://github.com/openlayer-ai/openlayer-java/commit/db068dc6e79b6a3fa77fe7b22a9a7bf31b61b8d9)) +* **internal:** remove extra empty newlines ([#81](https://github.com/openlayer-ai/openlayer-java/issues/81)) ([9eba32c](https://github.com/openlayer-ai/openlayer-java/commit/9eba32cbaa34b9c97ac7efd81533066229470ea5)) +* **internal:** remove some unnecessary `constructor` keywords ([882eb61](https://github.com/openlayer-ai/openlayer-java/commit/882eb61286bb52c15224a36677a934523ccb4fb3)) +* **internal:** remove unnecessary `assertNotNull` calls ([ac5dc3b](https://github.com/openlayer-ai/openlayer-java/commit/ac5dc3bb775247428b484019d4f5a936877dac0e)) +* **internal:** remove unnecessary import ([#96](https://github.com/openlayer-ai/openlayer-java/issues/96)) ([4852f0f](https://github.com/openlayer-ai/openlayer-java/commit/4852f0fc5face081a9d899a940ac15ee771df2e4)) +* **internal:** remove workflow ([54e8c73](https://github.com/openlayer-ai/openlayer-java/commit/54e8c738a650f838cdc25c71ad355c17b6b23867)) +* **internal:** rename `getPathParam` ([#88](https://github.com/openlayer-ai/openlayer-java/issues/88)) ([ece3d6d](https://github.com/openlayer-ai/openlayer-java/commit/ece3d6d3f438671e2b4fab916f9295c668d2f137)) +* **internal:** reorder some params methodsc ([ece3d6d](https://github.com/openlayer-ai/openlayer-java/commit/ece3d6d3f438671e2b4fab916f9295c668d2f137)) +* **internal:** swap from `getNullable` to `getOptional` ([#108](https://github.com/openlayer-ai/openlayer-java/issues/108)) ([3975381](https://github.com/openlayer-ai/openlayer-java/commit/3975381f2e6a9183a11200ca5a2e1ff5a260e784)) +* **internal:** version bump ([4937ab9](https://github.com/openlayer-ai/openlayer-java/commit/4937ab9a3d67bdb756b8632dd934d4330e3b6f5a)) +* **tests:** improve enum examples ([#111](https://github.com/openlayer-ai/openlayer-java/issues/111)) ([b8c855b](https://github.com/openlayer-ai/openlayer-java/commit/b8c855b09d13118ca76e7c053f5a1c76f33c4640)) + + +### Documentation + +* `async` and `sync` method comments ([0083c41](https://github.com/openlayer-ai/openlayer-java/commit/0083c41a6cc82a368e64ec0a812935597fa330e5)) +* add `build` method comments ([#86](https://github.com/openlayer-ai/openlayer-java/issues/86)) ([e6da0bf](https://github.com/openlayer-ai/openlayer-java/commit/e6da0bfc278f0405e7a875e53574abff11033bea)) +* add client documentation ([ad4f217](https://github.com/openlayer-ai/openlayer-java/commit/ad4f217728a1fc01dacc4587004a086350f4ccc4)) +* add comments to `JsonField` classes ([c2c1501](https://github.com/openlayer-ai/openlayer-java/commit/c2c150161ea17067c68e3ce7c54deebdf2461c4a)) +* builder, enum, and union comments ([5f394f5](https://github.com/openlayer-ai/openlayer-java/commit/5f394f52f0d57b38f9664f135e58fa89f98a19d5)) +* **client:** update jackson compat error message ([33c7cf9](https://github.com/openlayer-ai/openlayer-java/commit/33c7cf90367555a55d05077d2846745cc6b0983d)) +* deduplicate and refine comments ([#84](https://github.com/openlayer-ai/openlayer-java/issues/84)) ([687dd63](https://github.com/openlayer-ai/openlayer-java/commit/687dd630eed0499e0b786c0df214c8671ae43402)) +* document how to forcibly omit required field ([f7bf9f7](https://github.com/openlayer-ai/openlayer-java/commit/f7bf9f790253baaf2b8f9a192eac238db160e62b)) +* explain http client customization ([5e6f544](https://github.com/openlayer-ai/openlayer-java/commit/5e6f54455db9a5a6ff8b9f5c7884813c17e57a0b)) +* explain jackson compat in readme ([574dcea](https://github.com/openlayer-ai/openlayer-java/commit/574dcea5c0841a33730b45f935393f5a21355c96)) +* minor readme tweak ([#98](https://github.com/openlayer-ai/openlayer-java/issues/98)) ([dd9ea15](https://github.com/openlayer-ai/openlayer-java/commit/dd9ea155bb0a7f67ab500de13ee44def664d253e)) +* refine comments on multipart params ([#94](https://github.com/openlayer-ai/openlayer-java/issues/94)) ([ac5dc3b](https://github.com/openlayer-ai/openlayer-java/commit/ac5dc3bb775247428b484019d4f5a936877dac0e)) +* swap examples used in readme ([#110](https://github.com/openlayer-ai/openlayer-java/issues/110)) ([f7bf9f7](https://github.com/openlayer-ai/openlayer-java/commit/f7bf9f790253baaf2b8f9a192eac238db160e62b)) +* update documentation links to be more uniform ([c2b3e9d](https://github.com/openlayer-ai/openlayer-java/commit/c2b3e9d3b77d6b7b0d5aadf6a5141fb4f00a47bc)) +* update readme exception docs ([#97](https://github.com/openlayer-ai/openlayer-java/issues/97)) ([7eafb98](https://github.com/openlayer-ai/openlayer-java/commit/7eafb987ad975163a4bda700271c3c752f6b4430)) + ## 0.1.0-alpha.11 (2024-12-20) Full Changelog: [v0.1.0-alpha.10...v0.1.0-alpha.11](https://github.com/openlayer-ai/openlayer-java/compare/v0.1.0-alpha.10...v0.1.0-alpha.11) diff --git a/README.md b/README.md index ec50bf4d..e1b2ea9f 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.openlayer.api/openlayer-java)](https://central.sonatype.com/artifact/com.openlayer.api/openlayer-java/0.1.0-alpha.11) -[![javadoc](https://javadoc.io/badge2/com.openlayer.api/openlayer-java/0.1.0-alpha.11/javadoc.svg)](https://javadoc.io/doc/com.openlayer.api/openlayer-java/0.1.0-alpha.11) +[![Maven Central](https://img.shields.io/maven-central/v/com.openlayer.api/openlayer-java)](https://central.sonatype.com/artifact/com.openlayer.api/openlayer-java/0.1.0-alpha.12) +[![javadoc](https://javadoc.io/badge2/com.openlayer.api/openlayer-java/0.1.0-alpha.12/javadoc.svg)](https://javadoc.io/doc/com.openlayer.api/openlayer-java/0.1.0-alpha.12) @@ -13,7 +13,7 @@ It is generated with [Stainless](https://www.stainless.com/). -The REST API documentation can be found on [openlayer.com](https://openlayer.com/docs/api-reference/rest/overview). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openlayer.api/openlayer-java/0.1.0-alpha.11). +The REST API documentation can be found on [openlayer.com](https://openlayer.com/docs/api-reference/rest/overview). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openlayer.api/openlayer-java/0.1.0-alpha.12). @@ -24,7 +24,7 @@ The REST API documentation can be found on [openlayer.com](https://openlayer.com ### Gradle ```kotlin -implementation("com.openlayer.api:openlayer-java:0.1.0-alpha.11") +implementation("com.openlayer.api:openlayer-java:0.1.0-alpha.12") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.openlayer.api:openlayer-java:0.1.0-alpha.11") com.openlayer.api openlayer-java - 0.1.0-alpha.11 + 0.1.0-alpha.12 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 90d26370..e74d61c0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.openlayer.api" - version = "0.1.0-alpha.11" // x-release-please-version + version = "0.1.0-alpha.12" // x-release-please-version } subprojects {